Stan  1.0
probability, sampling & optimization
Classes | Namespaces | Functions
agrad.hpp File Reference
#include <cmath>
#include <cstddef>
#include <limits>
#include <stdexcept>
#include <vector>
#include <ostream>
#include <iostream>
#include <stan/memory/stack_alloc.hpp>

Go to the source code of this file.

Classes

class  stan::agrad::chainable
 Abstract base class for variable implementations that handles memory management and applying the chain rule. More...
 
class  stan::agrad::vari
 The variable implementation base class. More...
 
class  stan::agrad::var
 Independent (input) and dependent (output) variables for gradients. More...
 
struct  std::numeric_limits< stan::agrad::var >
 Specialization of numeric limits for var objects. More...
 

Namespaces

 stan
 Probability, optimization and sampling library.
 
 stan::agrad
 Function gradients via reverse-mode automatic differentiation.
 
 std
 Template specification of functions in std for Stan.
 

Functions

static void stan::agrad::recover_memory ()
 Recover memory used for all variables for reuse. More...
 
static void stan::agrad::grad (chainable *vi)
 Compute the gradient for all variables starting from the specified root variable implementation. More...
 
void stan::agrad::print_stack (std::ostream &o)
 Prints the auto-dif variable stack. More...
 
bool stan::agrad::operator== (const var &a, const var &b)
 Equality operator comparing two variables' values (C++). More...
 
bool stan::agrad::operator== (const var &a, const double b)
 Equality operator comparing a variable's value and a double (C++). More...
 
bool stan::agrad::operator== (const double a, const var &b)
 Equality operator comparing a scalar and a variable's value (C++). More...
 
bool stan::agrad::operator!= (const var &a, const var &b)
 Inequality operator comparing two variables' values (C++). More...
 
bool stan::agrad::operator!= (const var &a, const double b)
 Inequality operator comparing a variable's value and a double (C++). More...
 
bool stan::agrad::operator!= (const double a, const var &b)
 Inequality operator comparing a double and a variable's value (C++). More...
 
bool stan::agrad::operator< (const var &a, const var &b)
 Less than operator comparing variables' values (C++). More...
 
bool stan::agrad::operator< (const var &a, const double b)
 Less than operator comparing variable's value and a double (C++). More...
 
bool stan::agrad::operator< (const double a, const var &b)
 Less than operator comparing a double and variable's value (C++). More...
 
bool stan::agrad::operator> (const var &a, const var &b)
 Greater than operator comparing variables' values (C++). More...
 
bool stan::agrad::operator> (const var &a, const double b)
 Greater than operator comparing variable's value and double (C++). More...
 
bool stan::agrad::operator> (const double a, const var &b)
 Greater than operator comparing a double and a variable's value (C++). More...
 
bool stan::agrad::operator<= (const var &a, const var &b)
 Less than or equal operator comparing two variables' values (C++). More...
 
bool stan::agrad::operator<= (const var &a, const double b)
 Less than or equal operator comparing a variable's value and a scalar (C++). More...
 
bool stan::agrad::operator<= (const double a, const var &b)
 Less than or equal operator comparing a double and variable's value (C++). More...
 
bool stan::agrad::operator>= (const var &a, const var &b)
 Greater than or equal operator comparing two variables' values (C++). More...
 
bool stan::agrad::operator>= (const var &a, const double b)
 Greater than or equal operator comparing variable's value and double (C++). More...
 
bool stan::agrad::operator>= (const double a, const var &b)
 Greater than or equal operator comparing double and variable's value (C++). More...
 
bool stan::agrad::operator! (const var &a)
 Prefix logical negation for the value of variables (C++). More...
 
var stan::agrad::operator+ (const var &a)
 Unary plus operator for variables (C++). More...
 
var stan::agrad::operator- (const var &a)
 Unary negation operator for variables (C++). More...
 
var stan::agrad::operator+ (const var &a, const var &b)
 Addition operator for variables (C++). More...
 
var stan::agrad::operator+ (const var &a, const double b)
 Addition operator for variable and scalar (C++). More...
 
var stan::agrad::operator+ (const double a, const var &b)
 Addition operator for scalar and variable (C++). More...
 
var stan::agrad::operator- (const var &a, const var &b)
 Subtraction operator for variables (C++). More...
 
var stan::agrad::operator- (const var &a, const double b)
 Subtraction operator for variable and scalar (C++). More...
 
var stan::agrad::operator- (const double a, const var &b)
 Subtraction operator for scalar and variable (C++). More...
 
var stan::agrad::operator* (const var &a, const var &b)
 Multiplication operator for two variables (C++). More...
 
var stan::agrad::operator* (const var &a, const double b)
 Multiplication operator for a variable and a scalar (C++). More...
 
var stan::agrad::operator* (const double a, const var &b)
 Multiplication operator for a scalar and a variable (C++). More...
 
var stan::agrad::operator/ (const var &a, const var &b)
 Division operator for two variables (C++). More...
 
var stan::agrad::operator/ (const var &a, const double b)
 Division operator for dividing a variable by a scalar (C++). More...
 
var stan::agrad::operator/ (const double a, const var &b)
 Division operator for dividing a scalar by a variable (C++). More...
 
var & stan::agrad::operator++ (var &a)
 Prefix increment operator for variables (C++). More...
 
var stan::agrad::operator++ (var &a, int dummy)
 Postfix increment operator for variables (C++). More...
 
var & stan::agrad::operator-- (var &a)
 Prefix decrement operator for variables (C++). More...
 
var stan::agrad::operator-- (var &a, int dummy)
 Postfix decrement operator for variables (C++). More...
 
var stan::agrad::exp (const var &a)
 Return the exponentiation of the specified variable (cmath). More...
 
var stan::agrad::log (const var &a)
 Return the natural log of the specified variable (cmath). More...
 
var stan::agrad::log10 (const var &a)
 Return the base 10 log of the specified variable (cmath). More...
 
var stan::agrad::sqrt (const var &a)
 Return the square root of the specified variable (cmath). More...
 
var stan::agrad::pow (const var &base, const var &exponent)
 Return the base raised to the power of the exponent (cmath). More...
 
var stan::agrad::pow (const var &base, const double exponent)
 Return the base variable raised to the power of the exponent scalar (cmath). More...
 
var stan::agrad::pow (const double base, const var &exponent)
 Return the base scalar raised to the power of the exponent variable (cmath). More...
 
var stan::agrad::cos (const var &a)
 Return the cosine of a radian-scaled variable (cmath). More...
 
var stan::agrad::sin (const var &a)
 Return the sine of a radian-scaled variable (cmath). More...
 
var stan::agrad::tan (const var &a)
 Return the tangent of a radian-scaled variable (cmath). More...
 
var stan::agrad::acos (const var &a)
 Return the principal value of the arc cosine of a variable, in radians (cmath). More...
 
var stan::agrad::asin (const var &a)
 Return the principal value of the arc sine, in radians, of the specified variable (cmath). More...
 
var stan::agrad::atan (const var &a)
 Return the principal value of the arc tangent, in radians, of the specified variable (cmath). More...
 
var stan::agrad::atan2 (const var &a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second (cmath). More...
 
var stan::agrad::atan2 (const var &a, const double b)
 Return the principal value of the arc tangent, in radians, of the first variable divided by the second scalar (cmath). More...
 
var stan::agrad::atan2 (const double a, const var &b)
 Return the principal value of the arc tangent, in radians, of the first scalar divided by the second variable (cmath). More...
 
var stan::agrad::cosh (const var &a)
 Return the hyperbolic cosine of the specified variable (cmath). More...
 
var stan::agrad::sinh (const var &a)
 Return the hyperbolic sine of the specified variable (cmath). More...
 
var stan::agrad::tanh (const var &a)
 Return the hyperbolic tangent of the specified variable (cmath). More...
 
var stan::agrad::fabs (const var &a)
 Return the absolute value of the variable (cmath). More...
 
var stan::agrad::floor (const var &a)
 Return the floor of the specified variable (cmath). More...
 
var stan::agrad::ceil (const var &a)
 Return the ceiling of the specified variable (cmath). More...
 
var stan::agrad::fmod (const var &a, const var &b)
 Return the floating point remainder after dividing the first variable by the second (cmath). More...
 
var stan::agrad::fmod (const var &a, const double b)
 Return the floating point remainder after dividing the the first variable by the second scalar (cmath). More...
 
var stan::agrad::fmod (const double a, const var &b)
 Return the floating point remainder after dividing the first scalar by the second variable (cmath). More...
 
var stan::agrad::abs (const var &a)
 Return the absolute value of the variable (std). More...
 
static void stan::agrad::free_memory ()
 Return all memory used for gradients back to the system. More...
 
static void stan::agrad::set_zero_all_adjoints ()
 Reset all adjoint values in the stack to zero. More...
 
void stan::agrad::jacobian (std::vector< var > &dependents, std::vector< var > &independents, std::vector< std::vector< double > > &jacobian)
 Return the Jacobian of the function producing the specified dependent variables with respect to the specified independent variables. More...
 
int std::isnan (const stan::agrad::var &a)
 Checks if the given number is NaN. More...
 
int std::isinf (const stan::agrad::var &a)
 Checks if the given number is infinite. More...
 

Variable Documentation

◆ ad_

double ad_
protected

Definition at line 640 of file agrad.hpp.

◆ avi_

vari* avi_
protected

Definition at line 606 of file agrad.hpp.

◆ bd_

double bd_
protected

Definition at line 629 of file agrad.hpp.

◆ bvi_

vari* bvi_
protected

Definition at line 617 of file agrad.hpp.

◆ cd_

double cd_
protected

Definition at line 668 of file agrad.hpp.

◆ cvi_

vari* cvi_
protected

Definition at line 654 of file agrad.hpp.

◆ exp_val_

const double exp_val_

Definition at line 929 of file agrad.hpp.

◆ size_

const size_t size_
protected

Definition at line 751 of file agrad.hpp.

◆ vis_

vari** vis_
protected

Definition at line 752 of file agrad.hpp.


     [ Stan Home Page ] © 2011–2012, Stan Development Team.