Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
multiply_lower_tri_self_transpose.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__FWD__MATRIX__MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
2 #define STAN__AGRAD__FWD__MATRIX__MULTIPLY_LOWER_TRI_SELF_TRANSPOSE_HPP
3 
4 #include <vector>
10 
11 namespace stan {
12  namespace agrad {
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:21
Eigen::Matrix< T, C, R > transpose(const Eigen::Matrix< T, R, C > &m)
Definition: transpose.hpp:12
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Definition: typedefs.hpp:14
Eigen::Matrix< fvar< T >, R, R > multiply_lower_tri_self_transpose(const Eigen::Matrix< fvar< T >, R, C > &m)

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