1 #ifndef STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP
2 #define STAN_MATH_PRIM_FUN_MDIVIDE_RIGHT_TRI_LOW_HPP
3 
4 #include <stan/math/prim/meta.hpp>
5 #include <stan/math/prim/fun/Eigen.hpp>
6 #include <stan/math/prim/fun/mdivide_right_tri.hpp>
7 
8 namespace stan {
9 namespace math {
10 
11 /**
12  * Returns the solution of the system x tri(A) = b when tri(A) is a
13  * lower triangular view of the matrix A.
14  *
15  * @tparam EigMat1 type of the right-hand side matrix or vector
16  * @tparam EigMat2 type of the second matrix
17  *
18  * @param b right-hand side matrix or vector
19  * @param A matrix
20  * @return x = b * tri(A)^-1, solution of the linear system.
21  * @throws std::domain_error if A is not square or the rows of b don't
22  * match the size of A.
23  */
24 template <typename EigMat1, typename EigMat2,
25           require_all_eigen_t<EigMat1, EigMat2>* = nullptr,
26           require_all_not_vt_fvar<EigMat1, EigMat2>* = nullptr>
27 inline Eigen::Matrix<return_type_t<EigMat1, EigMat2>,
28                      EigMat1::RowsAtCompileTime, EigMat2::ColsAtCompileTime>
mdivide_right_tri_low(const EigMat1 & b,const EigMat2 & A)29 mdivide_right_tri_low(const EigMat1& b, const EigMat2& A) {
30   return mdivide_right_tri<Eigen::Lower>(b, A);
31 }
32 
33 }  // namespace math
34 }  // namespace stan
35 
36 #endif
37