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

◆ quad_form() [7/8]

template<typename Mat1 , typename Mat2 , require_all_matrix_t< Mat1, Mat2 > * = nullptr, require_not_col_vector_t< Mat2 > * = nullptr, require_any_var_matrix_t< Mat1, Mat2 > * = nullptr>
auto stan::math::quad_form ( const Mat1 &  A,
const Mat2 &  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.

This overload handles arguments where one of Mat1 or Mat2 are var_value<T> where T is an Eigen type. The other type can also be a var_value or it can be a matrix type that inherits from EigenBase

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, which is a symmetric matrix.
Exceptions
std::invalid_argumentif A is not square, or if A cannot be multiplied by B

Definition at line 311 of file quad_form.hpp.