1 #ifndef STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_PADE_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_MATRIX_EXP_PADE_HPP 4 #include <stan/math/prim/mat/fun/MatrixExponential.h> 19 template <
typename MatrixType>
23 Eigen::matrix_exp_computeUV<MatrixType>::run(arg, U, V, squarings, arg(0, 0));
26 MatrixType numer = U + V;
27 MatrixType denom = -U + V;
28 MatrixType pade_approximation = denom.partialPivLu().solve(numer);
29 for (
int i = 0; i < squarings; ++i)
30 pade_approximation *= pade_approximation;
32 return pade_approximation;
MatrixType matrix_exp_pade(const MatrixType &arg)
Computes the matrix exponential, using a Pade approximation, coupled with scaling and squaring...