Stan Math Library  2.20.0
reverse mode automatic differentiation
matrix_exp_multiply.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP
2 #define STAN_MATH_REV_MAT_FUN_MATRIX_EXP_MULTIPLY_HPP
3 
4 #include <stan/math/rev/meta.hpp>
11 #include <stan/math/rev/core.hpp>
12 
13 namespace stan {
14 namespace math {
15 
25 template <typename Ta, typename Tb, int Cb>
26 inline Eigen::Matrix<typename stan::return_type<Ta, Tb>::type, -1, Cb>
27 matrix_exp_multiply(const Eigen::Matrix<Ta, -1, -1>& A,
28  const Eigen::Matrix<Tb, -1, Cb>& B) {
29  check_nonzero_size("matrix_exp_multiply", "input matrix", A);
30  check_nonzero_size("matrix_exp_multiply", "input matrix", B);
31  check_multiplicable("matrix_exp_multiply", "A", A, "B", B);
32  check_square("matrix_exp_multiply", "input matrix", A);
33  return multiply(matrix_exp(A), B);
34 }
35 
36 } // namespace math
37 } // namespace stan
38 
39 #endif
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
void check_square(const char *function, const char *name, const matrix_cl &y)
Check if the matrix_cl is square.
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< double, -1, Cb > matrix_exp_multiply(const Eigen::MatrixXd &A, const Eigen::Matrix< double, -1, Cb > &B)
Return product of exp(A) and B, where A is a NxN double matrix, B is a NxCb double matrix...
void check_multiplicable(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the matrices can be multiplied.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > matrix_exp(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A)
Return the matrix exponential of the input matrix.
Definition: matrix_exp.hpp:20

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