![]() |
Stan Math Library
2.12.0
reverse mode automatic differentiation
|
This is a subclass of the vari class for matrix multiplication A * B where A is N by M and B is M by K. More...
#include <multiply.hpp>
Public Member Functions | |
multiply_mat_vari (const Eigen::Matrix< TA, RA, CA > &A, const Eigen::Matrix< TB, CA, CB > &B) | |
Constructor for multiply_mat_vari. More... | |
virtual void | chain () |
Apply the chain rule to this variable based on the variables on which it depends. More... | |
![]() | |
vari (const double x) | |
Construct a variable implementation from a value. More... | |
vari (const double x, bool stacked) | |
virtual | ~vari () |
Throw an illegal argument exception. More... | |
void | init_dependent () |
Initialize the adjoint for this (dependent) variable to 1. More... | |
void | set_zero_adjoint () |
Set the adjoint value of this variable to 0. More... | |
Public Attributes | |
int | A_rows_ |
int | A_cols_ |
int | B_cols_ |
int | A_size_ |
int | B_size_ |
double * | Ad_ |
double * | Bd_ |
vari ** | variRefA_ |
vari ** | variRefB_ |
vari ** | variRefAB_ |
![]() | |
const double | val_ |
The value of this variable. More... | |
double | adj_ |
The adjoint of this variable, which is the partial derivative of this variable with respect to the root variable. More... | |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t nbytes) |
Allocate memory from the underlying memory pool. More... | |
static void | operator delete (void *) |
Delete a pointer from the underlying memory pool. More... | |
This is a subclass of the vari class for matrix multiplication A * B where A is N by M and B is M by K.
The class stores the structure of each matrix, the double values of A and B, and pointers to the varis for A and B if A or B is a var. It also instantiates and stores pointers to varis for all elements of A * B.
TA | Scalar type for matrix A |
RA | Rows for matrix A |
CA | Columns for matrix A, Rows for matrix B |
TB | Scalar type for matrix B |
CB | Columns for matrix B |
Definition at line 38 of file multiply.hpp.
|
inline |
Constructor for multiply_mat_vari.
All memory allocated in ChainableStack's stack_alloc arena.
It is critical for the efficiency of this object that the constructor create new varis that aren't popped onto the var_stack_, but rather are popped onto the var_nochain_stack_. This is controlled to the second argument to vari's constructor.
A | matrix |
B | matrix |
Definition at line 63 of file multiply.hpp.
|
inlinevirtual |
Apply the chain rule to this variable based on the variables on which it depends.
The base implementation in this class is a no-op.
Reimplemented from stan::math::vari.
Definition at line 91 of file multiply.hpp.
int stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::A_cols_ |
Definition at line 40 of file multiply.hpp.
int stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::A_rows_ |
Definition at line 40 of file multiply.hpp.
int stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::A_size_ |
Definition at line 40 of file multiply.hpp.
double* stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::Ad_ |
Definition at line 41 of file multiply.hpp.
int stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::B_cols_ |
Definition at line 40 of file multiply.hpp.
int stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::B_size_ |
Definition at line 40 of file multiply.hpp.
double* stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::Bd_ |
Definition at line 42 of file multiply.hpp.
vari** stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::variRefA_ |
Definition at line 43 of file multiply.hpp.
vari** stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::variRefAB_ |
Definition at line 45 of file multiply.hpp.
vari** stan::math::multiply_mat_vari< TA, RA, CA, TB, CB >::variRefB_ |
Definition at line 44 of file multiply.hpp.