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

◆ quad_form() [5/8]

template<typename EigMat1 , typename EigMat2 , require_all_eigen_t< EigMat1, EigMat2 > * = nullptr, require_not_eigen_col_vector_t< EigMat2 > * = nullptr, require_any_vt_var< EigMat1, EigMat2 > * = nullptr>
promote_scalar_t< var, EigMat2 > stan::math::quad_form ( const EigMat1 &  A,
const EigMat2 &  B,
bool  symmetric = false 
)
inline

Return the quadratic form \( B^T A B \).

Symmetry of the resulting matrix is not guaranteed due to numerical precision.

Template Parameters
EigMat1type of the first (square) matrix
EigMat2type of the second matrix
Parameters
Asquare matrix
Bsecond matrix
symmetricindicates whether the output should be made symmetric
Returns
The quadratic form, which is a symmetric matrix.
Exceptions
std::invalid_argumentif A is not square, or if A cannot be multiplied by B

Definition at line 244 of file quad_form.hpp.