Automatic Differentiation
 
Loading...
Searching...
No Matches
matrix_exp_multiply.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_MATRIX_EXP_MULTIPLY_HPP
2#define STAN_MATH_REV_FUN_MATRIX_EXP_MULTIPLY_HPP
3
10
11namespace stan {
12namespace math {
13
24template <typename Ta, typename Tb, require_all_eigen_t<Ta, Tb>* = nullptr,
25 require_any_st_autodiff<Ta, Tb>* = nullptr>
26inline Eigen::Matrix<return_type_t<Ta, Tb>, -1, Tb::ColsAtCompileTime>
27matrix_exp_multiply(const Ta& A, const Tb& B) {
28 check_square("matrix_exp_multiply", "input matrix", A);
29 check_multiplicable("matrix_exp_multiply", "A", A, "B", B);
30 if (A.size() == 0) {
31 return {0, B.cols()};
32 }
33
34 return multiply(matrix_exp(A), B);
35}
36
37} // namespace math
38} // namespace stan
39
40#endif
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
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< double, Eigen::Dynamic, EigMat2::ColsAtCompileTime > matrix_exp_multiply(const EigMat1 &A, const EigMat2 &B)
Return product of exp(A) and B, where A is a NxN double matrix, B is a NxCb double matrix,...
auto multiply(const Mat1 &m1, const Mat2 &m2)
Return the product of the specified matrices.
Definition multiply.hpp:18
plain_type_t< T > matrix_exp(const T &A_in)
Return the matrix exponential of the input matrix.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...