1 #ifndef STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_MDIVIDE_LEFT_TRI_HPP 4 #include <boost/math/tools/promotion.hpp> 35 template <
int TriView,
typename T1,
typename T2,
int R1,
int C1,
int R2,
int C2>
36 inline Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type,
39 const Eigen::Matrix<T2, R2, C2> &b) {
42 return promote_common<Eigen::Matrix<T1, R1, C1>, Eigen::Matrix<T2, R1, C1> >(
44 .
template triangularView<TriView>()
46 promote_common<Eigen::Matrix<T1, R2, C2>, Eigen::Matrix<T2, R2, C2> >(
59 template <
int TriView,
typename T,
int R1,
int C1>
61 const Eigen::Matrix<T, R1, C1> &A) {
64 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> b;
66 A.template triangularView<TriView>().solveInPlace(b);
85 template <
int TriView,
int R1,
int C1,
int R2,
int C2>
87 const Eigen::Matrix<double, R1, C1> &A,
88 const Eigen::Matrix<double, R2, C2> &b) {
98 A_inv_cl = tri_inverse<TriangularViewCL::Lower>(A_cl);
100 A_inv_cl = tri_inverse<TriangularViewCL::Upper>(A_cl);
106 return A.template triangularView<TriView>().solve(b);
123 template <
int TriView,
int R1,
int C1>
125 const Eigen::Matrix<double, R1, C1> &A) {
127 const int n = A.rows();
133 A_cl = tri_inverse<TriangularViewCL::Lower>(A_cl);
135 A_cl = tri_inverse<TriangularViewCL::Upper>(A_cl);
140 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> b;
142 A.template triangularView<TriView>().solveInPlace(b);
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > from_matrix_cl(const matrix_cl &src)
Copies the source matrix that is stored on the OpenCL device to the destination Eigen matrix...
int tri_inverse_size_worth_transfer
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
The API to access the methods and values in opencl_context_base.
opencl_context_base::tuning_struct & tuning_opts()
Returns the thread block size for the Cholesky Decompositions L_11.
common_type< T1, T2 >::type promote_common(const F &u)
Return the result of promoting either a scalar or the scalar elements of a container to either of two...
Eigen::Matrix< typename boost::math::tools::promote_args< T1, T2 >::type, R1, C2 > mdivide_left_tri(const Eigen::Matrix< T1, R1, C1 > &A, const Eigen::Matrix< T2, R2, C2 > &b)
Returns the solution of the system Ax=b when A is triangular.
Represents a matrix on the OpenCL device.
Initialization for OpenCL:
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.