Stan Math Library  2.6.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
multiply_lower_tri_self_transpose.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
2 #define STAN_MATH_FWD_MAT_FUN_MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
3 
9 #include <vector>
10 
11 namespace stan {
12  namespace math {
13 
14  template<typename T, int R, int C>
15  inline
16  Eigen::Matrix<fvar<T>, R, R>
17  multiply_lower_tri_self_transpose(const Eigen::Matrix<fvar<T>, R, C>& m) {
18  if (m.rows() == 0)
19  return Eigen::Matrix<fvar<T>, R, R>(0, 0);
20  Eigen::Matrix<fvar<T>, R, C> L(m.rows(), m.cols());
21  L.setZero();
22 
23  for (size_type i = 0; i < m.rows(); i++) {
24  for (size_type j = 0; (j < i + 1) && (j < m.cols()); j++)
25  L(i, j) = m(i, j);
26  }
27 
29  }
30 
31  }
32 }
33 #endif
Eigen::Matrix< fvar< T >, R1, C1 > multiply(const Eigen::Matrix< fvar< T >, R1, C1 > &m, const fvar< T > &c)
Definition: multiply.hpp:20
Eigen::Matrix< fvar< T >, R, R > multiply_lower_tri_self_transpose(const Eigen::Matrix< fvar< T >, R, C > &m)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
Definition: typedefs.hpp:13
Eigen::Matrix< T, C, R > transpose(const Eigen::Matrix< T, R, C > &m)
Definition: transpose.hpp:12

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