Automatic Differentiation
 
Loading...
Searching...
No Matches
LDLT_factor.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_LDLT_FACTOR_HPP
2#define STAN_MATH_REV_FUN_LDLT_FACTOR_HPP
3
8
9namespace stan {
10namespace math {
11
17template <typename T>
19 private:
21 Eigen::LDLT<Eigen::MatrixXd> ldlt_;
22
23 public:
24 template <typename S,
26 explicit LDLT_factor(const S& matrix)
27 : matrix_(matrix), ldlt_(matrix.val().ldlt()) {}
28
32 const auto& matrix() const noexcept { return matrix_; }
33
37 const auto& ldlt() const noexcept { return ldlt_; }
38};
39
44template <typename T>
46 private:
47 std::decay_t<T> matrix_;
48 Eigen::LDLT<Eigen::MatrixXd> ldlt_;
49
50 public:
51 template <typename S,
53 explicit LDLT_factor(const S& matrix)
54 : matrix_(matrix), ldlt_(matrix.val().ldlt()) {}
55
59 const auto& matrix() const noexcept { return matrix_; }
60
64 const auto& ldlt() const noexcept { return ldlt_; }
65};
66
67} // namespace math
68} // namespace stan
69#endif
const auto & ldlt() const noexcept
Return a const reference to the LDLT factor of the matrix values.
const auto & matrix() const noexcept
Return a const reference to the underlying matrix.
const auto & ldlt() const noexcept
Return a const reference to the LDLT factor of the matrix values.
const auto & matrix() const noexcept
Return a const reference the underlying var_value
LDLT_factor is a structure that holds a matrix of type T and the LDLT of its values.
require_t< container_type_check_base< is_eigen_matrix_dynamic, value_type_t, TypeCheck, Check... > > require_eigen_matrix_dynamic_vt
Require type satisfies is_eigen_matrix_dynamic.
require_t< std::is_same< std::decay_t< T >, std::decay_t< S > > > require_same_t
Require types T and S satisfies std::is_same.
require_t< is_var_matrix< std::decay_t< T > > > require_var_matrix_t
Require type satisfies is_var_matrix.
typename plain_type< T >::type plain_type_t
typename internal::arena_type_impl< std::decay_t< T > >::type arena_t
Determines a type that can be used in place of T that does any dynamic allocations on the AD stack.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Defines a static member named value which is defined to be false as the primitive scalar types cannot...
Definition is_var.hpp:14