Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
math
matrix
multiply_lower_tri_self_transpose.hpp
Go to the documentation of this file.
1
#ifndef __STAN__MATH__MATRIX__MULTIPLY_LOWER_TRI_SELF_HPP__
2
#define __STAN__MATH__MATRIX__MULTIPLY_LOWER_TRI_SELF_HPP__
3
4
#include <
stan/math/matrix/typedefs.hpp
>
5
6
namespace
stan {
7
namespace
math {
8
17
inline
matrix_d
18
multiply_lower_tri_self_transpose
(
const
matrix_d
& L) {
19
if
(L.rows() == 0)
20
return
matrix_d
(0,0);
21
if
(L.rows() == 1) {
22
matrix_d
result(1,1);
23
result(0,0) = L(0,0) * L(0,0);
24
return
result;
25
}
26
// FIXME: write custom following agrad/matrix because can't get L_tri into
27
// multiplication as no template support for tri * tri
28
matrix_d
L_tri = L.transpose().triangularView<Eigen::Upper>();
29
return
L.triangularView<Eigen::Lower>() * L_tri;
30
}
31
32
}
33
}
34
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.