1#ifndef STAN_MATH_OPENCL_PRIM_MATRIX_POWER_HPP
2#define STAN_MATH_OPENCL_PRIM_MATRIX_POWER_HPP
25template <
typename T_m,
26 require_all_kernel_expressions_and_none_scalar_t<T_m>* =
nullptr>
28 const char* function =
"matrix_power(OpenCL)";
36 for (
int nn = n - 1; nn > 0; nn /= 2) {
isfinite_< as_operation_cl_t< T > > isfinite(T &&a)
auto check_cl(const char *function, const char *var_name, T &&y, const char *must_be)
Constructs a check on opencl matrix or expression.
auto constant(const T a, int rows, int cols)
Matrix of repeated values in kernel generator expressions.
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
void check_nonnegative(const char *function, const char *name, const T_y &y)
Check if y is non-negative.
T value_of(const fvar< T > &v)
Return the value of the specified variable.
plain_type_t< T_m > matrix_power(T_m &&M, const int n)
Returns the nth power of the specific matrix.
auto diag_matrix(T_x &&x)
Return a square diagonal matrix with the specified vector of coefficients as the diagonal values.
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...