39 template <
typename Scalar>
40 explicit Inertia(
const Eigen::Vector<Scalar, Eigen::Dynamic>&
D) {
41 for (
const auto&
elem :
D) {
42 if (
elem > std::numeric_limits<Scalar>::epsilon()) {
44 }
else if (
elem < -std::numeric_limits<Scalar>::epsilon()) {
57 template <
typename Scalar>
59 const Eigen::Diagonal<
60 const Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>>&
D) {
61 for (
const auto&
elem :
D) {
62 if (
elem > std::numeric_limits<Scalar>::epsilon()) {
64 }
else if (
elem < -std::numeric_limits<Scalar>::epsilon()) {
82struct std::formatter<slp::Inertia> {
87 constexpr auto parse(std::format_parse_context& ctx) {
88 return m_underlying.parse(ctx);
97 template <
typename FmtContext>
101 out = std::format_to(out,
"(");
102 out = m_underlying.format(inertia.
positive, ctx);
103 out = std::format_to(out,
", ");
104 out = m_underlying.format(inertia.
negative, ctx);
105 out = std::format_to(out,
", ");
106 out = m_underlying.format(inertia.
zero, ctx);
107 return std::format_to(out,
")");
111 std::formatter<int> m_underlying;
Definition inertia.hpp:14
int zero
The number of zero eigenvalues.
Definition inertia.hpp:21
Inertia(const Eigen::Diagonal< const Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > > &D)
Definition inertia.hpp:58
constexpr Inertia(int positive, int negative, int zero)
Definition inertia.hpp:31
bool operator==(const Inertia &) const =default
int positive
The number of positive eigenvalues.
Definition inertia.hpp:17
Inertia(const Eigen::Vector< Scalar, Eigen::Dynamic > &D)
Definition inertia.hpp:40
int negative
The number of negative eigenvalues.
Definition inertia.hpp:19
Definition intrusive_shared_ptr.hpp:27