Automatic Differentiation
 
Loading...
Searching...
No Matches
mdivide_left_tri_low.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_LOW_HPP
2#define STAN_MATH_PRIM_FUN_MDIVIDE_LEFT_TRI_LOW_HPP
3
7
8namespace stan {
9namespace math {
10
29template <typename T1, typename T2, require_all_eigen_t<T1, T2>* = nullptr,
30 require_all_not_eigen_vt<is_fvar, T1, T2>* = nullptr>
31inline Eigen::Matrix<return_type_t<T1, T2>, std::decay_t<T1>::RowsAtCompileTime,
32 std::decay_t<T2>::ColsAtCompileTime>
33mdivide_left_tri_low(T1&& A, T2&& b) {
34 check_square("mdivide_left_tri_low", "A", A);
35 check_multiplicable("mdivide_left_tri_low", "A", A, "b", b);
36 if (A.rows() == 0) {
37 return {0, b.cols()};
38 }
39
40 return mdivide_left_tri<Eigen::Lower>(std::forward<T1>(A),
41 std::forward<T2>(b));
42}
43
44template <typename T, require_eigen_t<T>* = nullptr,
45 require_not_eigen_vt<is_fvar, T>* = nullptr>
47 check_square("mdivide_left_tri_low", "A", A);
48 if (A.rows() == 0) {
49 return {};
50 }
51
52 return mdivide_left_tri<Eigen::Lower>(A);
53}
54
55} // namespace math
56} // namespace stan
57
58#endif
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.
Eigen::Matrix< value_type_t< T1 >, std::decay_t< T1 >::RowsAtCompileTime, std::decay_t< T2 >::ColsAtCompileTime > mdivide_left_tri_low(T1 &&A, T2 &&b)
typename plain_type< std::decay_t< T > >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...