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
tcrossprod.hpp
Go to the documentation of this file.
1
#ifndef __STAN__MATH__MATRIX__TCROSSPROD_HPP__
2
#define __STAN__MATH__MATRIX__TCROSSPROD_HPP__
3
4
#include <
stan/math/matrix/Eigen.hpp
>
5
#include <
stan/math/matrix/typedefs.hpp
>
6
7
namespace
stan {
8
namespace
math {
9
16
inline
matrix_d
17
tcrossprod
(
const
matrix_d
& M) {
18
if
(M.rows() == 0)
19
return
matrix_d
(0,0);
20
if
(M.rows() == 1)
21
return
M * M.transpose();
22
matrix_d
result(M.rows(),M.rows());
23
return
result
24
.setZero()
25
.selfadjointView<Eigen::Upper>()
26
.rankUpdate(M);
27
}
28
29
}
30
}
31
#endif
[
Stan Home Page
]
© 2011–2013, Stan Development Team.