17 for (
idx i = 0; i < n; ++i) {
18 for (
idx j = 0; j < i; ++j) {
19 if (std::abs(A(i, j) - A(j, i)) > tol) {
34 for (
idx i = 0; i < n; ++i) {
35 for (
idx j = 0; j <= i; ++j) {
37 for (
idx k = 0; k < j; ++k) {
38 sum -= L(i, k) * L(j, k);
45 L(i, j) = std::sqrt(sum);
47 L(i, j) = sum / L(j, j);
62 [[nodiscard]]
const Mat&
base() const noexcept {
return A_; }
63 [[nodiscard]]
idx rows() const noexcept {
return A_.rows(); }
64 [[nodiscard]]
idx cols() const noexcept {
return A_.cols(); }
79 [[nodiscard]]
const Mat&
base() const noexcept {
return A_; }
80 [[nodiscard]]
idx rows() const noexcept {
return A_.rows(); }
81 [[nodiscard]]
idx cols() const noexcept {
return A_.cols(); }
97 throw std::invalid_argument(
"make_symmetric: matrix is not symmetric");
104 throw std::invalid_argument(
"make_spd: matrix is not symmetric positive definite");
constexpr idx rows() const noexcept
constexpr idx cols() const noexcept
idx cols() const noexcept
const Mat & base() const noexcept
void symmetric_matrix_tag
idx rows() const noexcept
void symmetric_matrix_tag
idx rows() const noexcept
const Mat & base() const noexcept
idx cols() const noexcept
Dense row-major matrix templated over scalar type T.
SymmetricMatrix< Matrix > make_symmetric(Matrix A, real tol=1e-12)
bool is_spd(const Matrix &A, real tol=1e-12)
SymmetricMatrix< Matrix > assume_symmetric(Matrix A)
bool is_symmetric(const Matrix &A, real tol=1e-12)
SPDMatrix< Matrix > make_spd(Matrix A, real tol=1e-12)
SPDMatrix< Matrix > assume_spd(Matrix A)