Automatic Differentiation
 
Loading...
Searching...
No Matches
inverse.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_INVERSE_HPP
2#define STAN_MATH_PRIM_FUN_INVERSE_HPP
3
7
8namespace stan {
9namespace math {
10
23template <typename EigMat,
24 require_eigen_vt<std::is_arithmetic, EigMat>* = nullptr>
25inline Eigen::Matrix<value_type_t<EigMat>, EigMat::RowsAtCompileTime,
26 EigMat::ColsAtCompileTime>
27inverse(const EigMat& m) {
28 check_square("inverse", "m", m);
29 if (m.size() == 0) {
30 return {};
31 }
32 return m.inverse();
33}
34
35} // namespace math
36} // namespace stan
37
38#endif
void check_square(const char *function, const char *name, const T_y &y)
Check if the specified matrix is square.
Eigen::Matrix< value_type_t< EigMat >, EigMat::RowsAtCompileTime, EigMat::ColsAtCompileTime > inverse(const EigMat &m)
Forward mode specialization of calculating the inverse of the matrix.
Definition inverse.hpp:29
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...