| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

crossprod.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_FWD_MAT_FUN_CROSSPROD_HPP
2 #define STAN_MATH_FWD_MAT_FUN_CROSSPROD_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>, C, C>
17 crossprod(const Eigen::Matrix<fvar<T>, R, C>& m) {
18 if (m.rows() == 0)
19 return Eigen::Matrix<fvar<T>, C, C>(0, 0);
20 return stan::math::multiply(stan::math::transpose(m), m);
21 }
22
23 }
24 }
25 #endif
typedefs.hpp
stan
Definition: log_sum_exp.hpp:8
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:21
multiply.hpp
transpose.hpp
stan::math::crossprod
Eigen::Matrix< fvar< T >, C, C > crossprod(const Eigen::Matrix< fvar< T >, R, C > &m)
Definition: crossprod.hpp:17
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–2016, Stan Development Team.