Automatic Differentiation
 
Loading...
Searching...
No Matches
inv.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_INV_HPP
2#define STAN_MATH_PRIM_FUN_INV_HPP
3
8
9namespace stan {
10namespace math {
11
19struct inv_fun {
20 template <typename T>
21 static inline auto fun(const T& x) {
22 return 1.0 / x;
23 }
24};
25
34template <
37inline auto inv(const T& x) {
39}
40
49template <typename Container,
52 Container>* = nullptr>
53inline auto inv(const Container& x) {
55 x, [](const auto& v) { return v.array().inverse(); });
56}
57
58} // namespace math
59} // namespace stan
60
61#endif
require_not_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_not_container_st
Require type does not satisfy is_container.
require_t< container_type_check_base< is_container, scalar_type_t, TypeCheck, Check... > > require_container_st
Require type satisfies is_container.
require_all_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< Types > >... > require_all_not_nonscalar_prim_or_rev_kernel_expression_t
Require none of the types satisfy is_nonscalar_prim_or_rev_kernel_expression.
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:28
fvar< T > inv(const fvar< T > &x)
Definition inv.hpp:13
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Definition inv.hpp:21
Structure to wrap 1.0 / x so that it can be vectorized.
Definition inv.hpp:19