1#ifndef STAN_MATH_OPENCL_REV_REP_MATRIX_HPP
2#define STAN_MATH_OPENCL_REV_REP_MATRIX_HPP
29template <
typename T_ret, require_var_vt<is_matrix_cl, T_ret>* =
nullptr>
33 A.adj() += sum(res.adj());
58 if (A.adj().size() != 0) {
59 matrix_cl<double> A_adj = std::move(A.adj());
61 opencl_kernels::rep_matrix_rev(
62 cl::NDRange(A_adj.rows(), A_adj.cols()), A_adj, res.adj(),
63 res.adj().rows(), res.adj().cols(), res.adj().view());
64 } catch (const cl::Error& e) {
65 check_opencl_error(
"rep_matrix(rev OpenCL)", e);
67 A.adj() = std::move(A_adj);
Represents an arithmetic matrix on the OpenCL device.
require_all_t< is_kernel_expression_and_not_scalar< Types >... > require_all_kernel_expressions_and_none_scalar_t
Enables a template if all given types are non-scalar types that are a valid kernel generator expressi...
auto rep_matrix(const value_type_t< T > &x, int n, int m)
Creates a matrix_cl by replicating the given value of arithmetic type.
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...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...