1#ifndef STAN_MATH_OPENCL_REV_VARI_HPP
2#define STAN_MATH_OPENCL_REV_VARI_HPP
37 template <
typename S,
typename U,
48 inline const auto&
val()
const {
return val_; }
74 return vari_view<std::decay_t<
decltype(val_block)>>(std::move(val_block),
75 std::move(adj_block));
85 return vari_view<std::decay_t<
decltype(val_t)>>(std::move(val_t),
96 return vari_view<std::decay_t<
decltype(val_t)>>(std::move(val_t),
107 return vari_view<std::decay_t<
decltype(val_t)>>(std::move(val_t),
120 template <
typename RowIndex,
typename ColIndex>
128 return vari_view<std::decay_t<
decltype(val_t)>>(std::move(val_t),
135 const Eigen::Index
rows()
const {
return val_.rows(); }
139 const Eigen::Index
cols()
const {
return val_.cols(); }
155 static constexpr int RowsAtCompileTime{-1};
159 static constexpr int ColsAtCompileTime{-1};
186 static constexpr int RowsAtCompileTime{-1};
190 static constexpr int ColsAtCompileTime{-1};
206 template <
typename S, require_convertible_t<S&, T>* =
nullptr>
226 template <
typename S, require_eigen_t<S>* =
nullptr,
227 require_vt_same<T, S>* =
nullptr>
251 template <
typename S, require_convertible_t<S&, T>* =
nullptr>
274 template <
typename S,
typename K, require_convertible_t<T, S>* =
nullptr,
275 require_convertible_t<T, K>* =
nullptr>
292 template <
typename,
typename>
A chainable_alloc is an object which is constructed and destructed normally but the memory lifespan i...
Represents operation that determines column index.
Represents operation that determines row index.
Abstract base class that all vari_value and it's derived classes inherit.
auto transpose()
Returns a transposed view into the matrix.
virtual void chain()
Apply the chain rule to this variable based on the variables on which it depends.
T val_
The value of this variable.
vari_cl_base(S &&val, U &&adj)
Construct a matrix_cl variable implementation from a value and adjoint.
const Eigen::Index rows() const
Return the number of rows for this class's val_ member.
auto reverse()
Returns reverse view into the row or column vector.
auto & adj()
Return a reference to the derivative of the root expression with respect to this expression.
auto index(const RowIndex &row_index, const ColIndex &col_index)
Return indexed view into a matrix.
const Eigen::Index cols() const
Return the number of columns for this class's val_ member.
const Eigen::Index size() const
Return the size of this class's val_ member.
T adj_
The adjoint of this variable, which is the partial derivative of this variable with respect to the ro...
auto as_column_vector_or_scalar()
Returns column vector view into the row or column vector.
auto block(int row, int col, int rows, int cols)
Returns a view into a block of matrix.
const auto & val() const
Return a constant reference to the value of this vari.
vari_value(S &&x, bool stacked)
Construct an matrix_cl variable implementation from a value.
vari_value(S &&val, K &&adj)
Construct a dense Eigen variable implementation from a preconstructed values and adjoints.
vari_value(S &&x)
Construct a matrix_cl variable implementation from a value.
vari_value(const S &x)
Construct a matrix_cl variable implementation from an Eigen value.
void set_zero_adjoint() final
Set the adjoint value of this variable to 0.
void set_zero_adjoint() final
A vari_view is used to read from a slice of a vari_value with an inner eigen type.
require_t< is_kernel_expression_lhs< std::decay_t< T > > > require_kernel_expression_lhs_t
Require type satisfies is_kernel_expression_lhs.
require_t< is_matrix_cl< std::decay_t< T > > > require_matrix_cl_t
Require type satisfies is_matrix_cl.
auto block_zero_based(T &&a, int start_row, int start_col, int rows, int cols)
Block of a kernel generator expression.
auto as_column_vector_or_scalar(T &&a)
as_column_vector_or_scalar of a kernel generator expression.
auto transpose(Arg &&a)
Transposes a kernel generator expression.
auto constant(const T a, int rows, int cols)
Matrix of repeated values in kernel generator expressions.
auto indexing(T_mat &&mat, T_row_index &&row_index, T_col_index &&col_index)
Index a kernel generator expression using two expressions for indices.
auto col(T_x &&x, size_t j)
Return the specified column of the specified kernel generator expression using start-at-1 indexing.
int64_t cols(const T_x &x)
Returns the number of columns in the specified kernel generator expression.
int64_t rows(const T_x &x)
Returns the number of rows in the specified kernel generator expression.
auto row(T_x &&x, size_t j)
Return the specified row of the specified kernel generator expression using start-at-1 indexing.
auto reverse(T_x &&x)
Return reversed view into the specified vector or row vector.
std::enable_if_t< Check::value > require_t
If condition is true, template is enabled.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
std::vector< ChainableT * > var_stack_
std::vector< ChainableT * > var_nochain_stack_
static thread_local AutodiffStackStorage * instance_