Loading [MathJax]/extensions/TeX/AMSsymbols.js
Automatic Differentiation
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches

◆ cov_matrix_constrain() [4/6]

template<typename T , typename Lp , require_std_vector_t< T > * = nullptr, require_convertible_t< return_type_t< T >, Lp > * = nullptr>
auto stan::math::cov_matrix_constrain ( const T &  x,
Eigen::Index  K,
Lp &  lp 
)
inline

Return the symmetric, positive-definite matrix of dimensions K by K resulting from transforming the specified finite vector of size K plus (K choose 2).

This overload handles looping over the elements of a standard vector.

Template Parameters
TA standard vector with inner type inheriting from Eigen::DenseBase or a var_value with inner type inheriting from Eigen::DenseBase with compile time dynamic rows and 1 column
LpScalar type for the lp argument. The scalar type of T should be convertable to this.
Parameters
xThe vector to convert to a covariance matrix
KThe dimensions of the resulting covariance matrix
[in,out]lplog density accumulator
Exceptions
std::domain_errorif (x.size() != K + (K choose 2)).

If the Jacobian parameter is true, the log density accumulator is incremented with the log absolute Jacobian determinant of the transform. All of the transforms are specified with their Jacobians in the Stan Reference Manual chapter Constraint Transforms.

Template Parameters
Jacobianif true, increment log density accumulator with log absolute Jacobian determinant of constraining transform
TA type inheriting from Eigen::DenseBase or a var_value with inner type inheriting from Eigen::DenseBase with compile time dynamic rows and 1 column, or standard vector thereof
LpA scalar type for the lp argument. The scalar type of T should be convertable to this.
Parameters
xThe vector to convert to a covariance matrix
KThe dimensions of the resulting covariance matrix
[in,out]lplog density accumulator
Exceptions
std::domain_errorif (x.size() != K + (K choose 2)).

Definition at line 127 of file cov_matrix_constrain.hpp.