Automatic Differentiation
 
Loading...
Searching...
No Matches
mdivide_left_tri_low.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_MDIVIDE_LEFT_TRI_LOW_HPP
2#define STAN_MATH_OPENCL_PRIM_MDIVIDE_LEFT_TRI_LOW_HPP
3#ifdef STAN_OPENCL
4
9
10namespace stan {
11namespace math {
12
24template <typename T1, typename T2,
25 require_all_kernel_expressions_t<T1, T2>* = nullptr>
26inline matrix_cl<double> mdivide_left_tri_low(const T1& A, const T2& b) {
27 check_square("mdivide_left_tri_low", "A", A);
28 check_multiplicable("mdivide_left_tri_low", "A", A, "b", b);
29 if (A.size() == 0 || b.size() == 0) {
30 return matrix_cl<double>(A.rows(), b.cols());
31 }
32 return tri_inverse<matrix_cl_view::Lower>(eval(A)) * b;
33}
34
43template <typename T, require_all_kernel_expressions_t<T>* = nullptr>
45 check_square("mdivide_left_tri_low", "A", A);
46 if (A.size() == 0) {
47 return A;
48 }
49 return tri_inverse<matrix_cl_view::Lower>(eval(A));
50}
51
52} // namespace math
53} // namespace stan
54#endif
55#endif
Represents an arithmetic matrix on the OpenCL device.
Definition matrix_cl.hpp:47
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
void check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the matrices can be multiplied.
T eval(T &&arg)
Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions ...
Definition eval.hpp:20
Eigen::Matrix< value_type_t< T1 >, T1::RowsAtCompileTime, T2::ColsAtCompileTime > mdivide_left_tri_low(const T1 &A, const T2 &b)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...