| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/mat/fun/typedefs.hpp>
6 #include <stan/math/fwd/mat/fun/typedefs.hpp>
7 #include <stan/math/fwd/mat/fun/multiply.hpp>
8 #include <stan/math/prim/mat/fun/transpose.hpp>
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
28 return stan::math::multiply(L, stan::math::transpose(L));
29 }
30
31 }
32 }
33 #endif
typedefs.hpp
stan::math::multiply
Eigen::Matrix< fvar< T >, R1, C1 > multiply(const Eigen::Matrix< fvar< T >, R1, C1 > &m, const fvar< T > &c)
Definition: multiply.hpp:20
multiply.hpp
transpose.hpp
stan::math::multiply_lower_tri_self_transpose
Eigen::Matrix< fvar< T >, R, R > multiply_lower_tri_self_transpose(const Eigen::Matrix< fvar< T >, R, C > &m)
Definition: multiply_lower_tri_self_transpose.hpp:17
stan::math::size_type
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.hpp
stan::math::transpose
Eigen::Matrix< T, C, R > transpose(const Eigen::Matrix< T, R, C > &m)
Definition: transpose.hpp:12
stan::math::fvar
Definition: fvar.hpp:13
typedefs.hpp

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