1#ifndef STAN_MATH_FWD_FUN_MDIVIDE_LEFT_LDLT_HPP
2#define STAN_MATH_FWD_FUN_MDIVIDE_LEFT_LDLT_HPP
23template <
typename T,
typename EigMat,
24 require_eigen_vt<std::is_arithmetic, T>* =
nullptr,
25 require_eigen_vt<is_fvar, EigMat>* =
nullptr>
26inline Eigen::Matrix<value_type_t<EigMat>, Eigen::Dynamic,
27 EigMat::ColsAtCompileTime>
30 constexpr int R2 = EigMat::RowsAtCompileTime;
31 constexpr int C2 = EigMat::ColsAtCompileTime;
34 const auto& b_ref =
to_ref(b);
35 Eigen::Matrix<EigMatValueScalar, R2, C2> b_val(b.rows(), b.cols());
36 Eigen::Matrix<EigMatValueScalar, R2, C2> b_der(b.rows(), b.cols());
37 for (
int j = 0; j < b.cols(); j++) {
38 for (
int i = 0; i < b.rows(); i++) {
39 b_val.coeffRef(i, j) = b_ref.coeff(i, j).val_;
40 b_der.coeffRef(i, j) = b_ref.coeff(i, j).d_;
LDLT_factor is a structure that holds a matrix of type T and the LDLT of its values.
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
void check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the matrices can be multiplied.
Eigen::Matrix< value_type_t< EigMat >, Eigen::Dynamic, EigMat::ColsAtCompileTime > mdivide_left_ldlt(LDLT_factor< T > &A, const EigMat &b)
Returns the solution of the system Ax=b given an LDLT_factor of A.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
fvar< T > to_fvar(const T &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...