Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ trace_gen_quad_form() [2/3]

template<typename EigMatD , typename EigMatA , typename EigMatB , require_all_eigen_vt< std::is_arithmetic, EigMatD, EigMatA, EigMatB > * = nullptr>
double stan::math::trace_gen_quad_form ( const EigMatD &  D,
const EigMatA &  A,
const EigMatB &  B 
)
inline

Return the trace of D times the quadratic form of B and A.

That is, ‘trace_gen_quad_form(D, A, B) = trace(D * B’ * A * B).` This is the overload for arithmetic types to allow Eigen's expression templates to be used for efficiency.

Template Parameters
EigMatDtype of the first matrix or expression
EigMatAtype of the second matrix or expression
EigMatBtype of the third matrix or expression
Parameters
Dmultiplier
Aoutside term in quadratic form
Binner term in quadratic form
Returns
trace(D * B' * A * B)
Exceptions
std::domain_errorif A or D is not square
std::domain_errorif A cannot be multiplied by B or B cannot be multiplied by D.

Definition at line 66 of file trace_gen_quad_form.hpp.