Automatic Differentiation
 
Loading...
Searching...
No Matches
inv_square.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_INV_SQUARE_HPP
2#define STAN_MATH_PRIM_FUN_INV_SQUARE_HPP
3
8
9namespace stan {
10namespace math {
11
19template <typename Container,
20 require_not_container_st<std::is_arithmetic, Container>* = nullptr,
22 Container>* = nullptr>
23inline auto inv_square(const Container& x) {
24 return inv(square(x));
25}
26
35template <typename Container,
37inline auto inv_square(const Container& x) {
39 x, [](const auto& v) { return v.array().square().inverse(); });
40}
41
42} // namespace math
43} // namespace stan
44
45#endif
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.
fvar< T > inv_square(const fvar< T > &x)
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
fvar< T > inv(const fvar< T > &x)
Definition inv.hpp:12
fvar< T > square(const fvar< T > &x)
Definition square.hpp:12
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9