Stan Math Library  2.20.0
reverse mode automatic differentiation
is_lower_triangular.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_IS_LOWER_TRIANGULAR_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_IS_LOWER_TRIANGULAR_HPP
3 
6 
7 namespace stan {
8 namespace math {
9 
10 namespace internal {
11 inline double notNan(double x) { return std::isnan(x) ? 1.0 : x; }
12 } // namespace internal
13 
23 template <typename T_y>
24 inline bool is_lower_triangular(
25  const Eigen::Matrix<T_y, Eigen::Dynamic, Eigen::Dynamic>& y) {
26  return y.unaryExpr(std::function<double(double)>(internal::notNan))
27  .transpose()
28  .isUpperTriangular();
29 }
30 
31 } // namespace math
32 } // namespace stan
33 #endif
int isnan(const stan::math::var &a)
Checks if the given number is NaN.
Definition: std_isnan.hpp:18
bool is_lower_triangular(const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Return true is matrix is lower triangular.

     [ Stan Home Page ] © 2011–2018, Stan Development Team.