1#ifndef STAN_MATH_OPENCL_REV_SD_HPP
2#define STAN_MATH_OPENCL_REV_SD_HPP
23 require_all_kernel_expressions_and_none_scalar_t<T>* =
nullptr>
28 double A_mean =
mean(A.val());
31 auto diff_expr = A.val() - A_mean;
37 [A, diff](
vari& res)
mutable {
38 A.adj() += res.adj() / (res.val() * (A.size() - 1.0)) * diff;
A variant of matrix_cl that schedules its destructor to be called, so it can be used on the AD stack.
Represents an arithmetic matrix on the OpenCL device.
auto sum_2d(T &&a)
Two dimensional sum - reduction of a kernel generator expression.
results_cl< T_results... > results(T_results &&... results)
Deduces types for constructing results_cl object.
expressions_cl< T_expressions... > expressions(T_expressions &&... expressions)
Deduces types for constructing expressions_cl object.
auto from_matrix_cl(const T &src)
Copies the source matrix that is stored on the OpenCL device to the destination Eigen matrix.
scalar_type_t< T > mean(const T &m)
Returns the sample mean (i.e., average) of the coefficients in the specified std vector,...
var_value< plain_type_t< T > > make_callback_var(T &&value, F &&functor)
Creates a new var initialized with a callback_vari with a given value and reverse-pass callback funct...
fvar< T > sqrt(const fvar< T > &x)
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
double sd(const T &a)
Returns the unbiased sample standard deviation of the coefficients in the specified std vector,...
fvar< T > square(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...