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

◆ quad_form_impl()

template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
auto stan::math::internal::quad_form_impl ( const Mat1 &  A,
const Mat2 &  B,
bool  symmetric 
)
inline

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

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

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

Definition at line 117 of file quad_form.hpp.