Automatic Differentiation
 
Loading...
Searching...
No Matches
cholesky_corr_constrain.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  stan
 The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation from C or the boost::math::lgamma implementation.
 
namespace  stan::math
 Matrices and templated mathematical functions.
 
namespace  stan::math::internal
 A comparator that works for any container type that has the brackets operator.
 

Enumerations

enum class  stan::math::internal::CorrOrder : uint8_t {
  stan::math::internal::row = 0 ,
  stan::math::internal::column = 1
}
 Order of the partial correlations in the unconstrained vector: row for cholesky_corr_constrain (row 1, then row 2, ...), column for corr_matrix_constrain and cov_matrix_constrain_lkj (column 0, then column 1, ...). More...
 

Functions

template<CorrOrder Order>
Eigen::Index stan::math::internal::cholesky_corr_position (Eigen::Index row, Eigen::Index col, Eigen::Index K)
 Return the position in the unconstrained vector of the partial correlation for element (row, col), col < row, of the Cholesky factor.
 
auto stan::math::internal::cholesky_corr_log_jacobian_coefficients (Eigen::Index K)
 Return a lazy expression of the coefficients c for which the log absolute Jacobian determinant of cholesky_corr_constrain is -sum_n c_n log(cosh(y_n)), in row order: the coefficient of element (row, col) is row + 1 - col, with row recovered from the position by inverting cholesky_corr_position<CorrOrder::row>.
 
auto stan::math::internal::corr_matrix_log_jacobian_coefficients (Eigen::Index K)
 Return a lazy expression of the coefficients c for which the log absolute Jacobian determinant of corr_matrix_constrain is -sum_n c_n log(cosh(y_n)), in column order: the coefficient of every element of column col is K - col (equation 11 of Lewandowski, Kurowicka and Joe, 2009), with col recovered from the position by inverting cholesky_corr_position<CorrOrder::column>.
 
template<CorrOrder Order, typename EigVec , typename LogCoshVec , require_all_eigen_vector_t< EigVec, LogCoshVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > stan::math::internal::cholesky_corr_factor (EigVec &&y, LogCoshVec &&log_cosh_y, Eigen::Index K)
 Return the Cholesky factor of a correlation matrix from unconstrained values y, whose partial correlations are tanh(y).
 
template<typename EigVec , require_eigen_col_vector_t< EigVec > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > stan::math::cholesky_corr_constrain (EigVec &&y, int K)
 Return the Cholesky factor of a K x K correlation matrix from the K (K - 1) / 2 unconstrained values y, whose partial correlations are tanh(y) in row order.
 
template<typename EigVec , typename Lp , require_eigen_col_vector_t< EigVec > * = nullptr, require_convertible_t< return_type_t< EigVec >, Lp > * = nullptr>
Eigen::Matrix< value_type_t< EigVec >, Eigen::Dynamic, Eigen::Dynamic > stan::math::cholesky_corr_constrain (EigVec &&y, int K, Lp &lp)
 Return the Cholesky factor of a K x K correlation matrix from the K (K - 1) / 2 unconstrained values y, and add the log absolute Jacobian determinant of the transform to lp.
 
template<typename T , require_std_vector_t< T > * = nullptr>
auto stan::math::cholesky_corr_constrain (T &&y, int K)
 Return The cholesky of a KxK correlation matrix.
 
template<typename T , typename Lp , require_std_vector_t< T > * = nullptr, require_convertible_t< return_type_t< T >, Lp > * = nullptr>
auto stan::math::cholesky_corr_constrain (T &&y, int K, Lp &lp)
 Return The cholesky of a KxK correlation matrix.