1#ifndef STAN_MATH_OPENCL_PRIM_ADD_DIAG_HPP
2#define STAN_MATH_OPENCL_PRIM_ADD_DIAG_HPP
24template <
typename T_m,
typename T_a,
25 require_all_kernel_expressions_and_none_scalar_t<T_m>* =
nullptr,
26 require_all_kernel_expressions_t<T_a>* =
nullptr>
29 const size_t length_diag = std::min(mat.rows(), mat.cols());
31 to_add,
"diagonal", length_diag);
Represents an arithmetic matrix on the OpenCL device.
auto diagonal(T &&a)
Diagonal of a kernel generator expression.
void check_consistent_sizes(const char *)
Trivial no input case, this function is a no-op.
auto add_diag(T_m &&mat, T_a &&to_add)
Returns a Matrix with values added along the main diagonal.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Checks if decayed type is a var, fvar, or arithmetic.