1#ifndef STAN_MATH_REV_CORE_READ_VAR_HPP
2#define STAN_MATH_REV_CORE_READ_VAR_HPP
17template <
typename EigRev,
typename EigVari,
typename EigDbl>
27 inline decltype(
auto)
operator()(Eigen::Index
row, Eigen::Index
col)
const {
33 inline decltype(
auto)
operator()(Eigen::Index index)
const {
36 return var_mat.coeffRef(index).vi_->adj_;
44template <
typename EigRev,
typename EigDbl>
53 template <
typename T = EigRev, require_st_same<T, var>* =
nullptr>
54 inline decltype(
auto)
operator()(Eigen::Index
row, Eigen::Index
col)
const {
59 template <
typename T = EigRev, require_st_same<T, var>* =
nullptr>
60 inline decltype(
auto)
operator()(Eigen::Index index)
const {
62 return var_mat.coeffRef(index).vi_->adj_;
65 template <
typename T = EigRev, require_st_same<T, vari*>* =
nullptr>
66 inline decltype(
auto)
operator()(Eigen::Index
row, Eigen::Index
col)
const {
71 template <
typename T = EigRev, require_st_same<T, vari*>* =
nullptr>
72 inline decltype(
auto)
operator()(Eigen::Index index)
const {
74 return var_mat.coeffRef(index)->adj_;
82template <
typename EigVar,
typename EigVari>
91 inline decltype(
auto)
operator()(Eigen::Index
row, Eigen::Index
col)
const {
96 inline decltype(
auto)
operator()(Eigen::Index index)
const {
98 return var_mat.coeffRef(index).vi_->val_;
106template <
typename EigVar,
typename EigVari>
115 inline decltype(
auto)
operator()(Eigen::Index
row, Eigen::Index
col)
const {
120 inline decltype(
auto)
operator()(Eigen::Index index)
const {
122 return var_mat.coeffRef(index).vi_->adj_;
138template <
typename EigVar,
typename EigVari,
typename EigDbl>
140 EigDbl& ValMat, EigDbl& AdjMat) {
142 = EigDbl::NullaryExpr(VarMat.rows(), VarMat.cols(),
144 VarMat, VariMat, ValMat));
157template <
typename EigRev,
typename EigDbl>
158inline void read_val_adj(
const EigRev& VarMat, EigDbl& ValMat, EigDbl& AdjMat) {
159 AdjMat = EigDbl::NullaryExpr(
160 VarMat.rows(), VarMat.cols(),
174template <
typename EigVar,
typename EigVari,
typename EigDbl>
177 ValMat = EigDbl::NullaryExpr(
178 VarMat.rows(), VarMat.cols(),
192template <
typename EigVar,
typename EigVari,
typename EigDbl>
195 AdjMat = EigDbl::NullaryExpr(
196 VarMat.rows(), VarMat.cols(),
val_adj_functor(const EigRev &arg1, EigDbl &arg2)
Functor for extracting the values and adjoints from a matrix of var or vari.
vi_adj_functor(const EigVar &arg1, EigVari &arg2)
Functor for extracting the varis and adjoints from a matrix of var.
vi_val_adj_functor(const EigRev &arg1, EigVari &arg2, EigDbl &arg3)
Functor for extracting the vari*, values, and adjoints from a matrix of var.
vi_val_functor(const EigVar &arg1, EigVari &arg2)
Functor for extracting the varis and values from a matrix of var.
auto col(T_x &&x, size_t j)
Return the specified column of the specified kernel generator expression using start-at-1 indexing.
auto row(T_x &&x, size_t j)
Return the specified row of the specified kernel generator expression using start-at-1 indexing.
void read_val_adj(const EigRev &VarMat, EigDbl &ValMat, EigDbl &AdjMat)
Function applying the val_adj_functor to extract the values and adjoints of a given var or vari matri...
void read_vi_val_adj(const EigVar &VarMat, EigVari &VariMat, EigDbl &ValMat, EigDbl &AdjMat)
Function applying the vi_val_adj_functor to extract the vari*, values, and adjoints of a given var ma...
void read_vi_val(const EigVar &VarMat, EigVari &VariMat, EigDbl &ValMat)
Function applying the vi_val_functor to extract the varis and and values of a given var matrix into s...
void read_vi_adj(const EigVar &VarMat, EigVari &VariMat, EigDbl &AdjMat)
Function applying the vi_adj_functor to extract the varis and and adjoints of a given var matrix into...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...