Stan Math Library  2.20.0
reverse mode automatic differentiation
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 
7 
8 namespace stan {
9 namespace math {
10 
11 template <typename T, int R, int C>
12 inline Eigen::Matrix<fvar<T>, C, C> crossprod(
13  const Eigen::Matrix<fvar<T>, R, C>& m) {
14  if (m.rows() == 0)
15  return Eigen::Matrix<fvar<T>, C, C>(0, 0);
16  return multiply(transpose(m), m);
17 }
18 
19 } // namespace math
20 } // namespace stan
21 #endif
Eigen::Matrix< fvar< T >, R1, C1 > multiply(const Eigen::Matrix< fvar< T >, R1, C1 > &m, const fvar< T > &c)
Definition: multiply.hpp:14
Eigen::Matrix< fvar< T >, C, C > crossprod(const Eigen::Matrix< fvar< T >, R, C > &m)
Definition: crossprod.hpp:12
matrix_cl transpose(const matrix_cl &src)
Takes the transpose of the matrix on the OpenCL device.
Definition: transpose.hpp:20
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.
Definition: fvar.hpp:41

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