8#include "proxsuite-nlp/config.hpp"
19using usize = std::make_unsigned<isize>::type;
55 bool performed_llt =
false;
67 : segments_count(nc), outer_stride(os) {
72 : m_data(data), segment_lens(lens), segments_count(nc), outer_stride(os) {
78 : segments_count(static_cast<
isize>(lens.size())) {
79 outer_stride = segments_count;
83 std::fill_n(m_data, size(), BlockKind::Dense);
84 std::copy_n(lens.begin(), nsegments(), segment_lens);
91 isize size() const noexcept {
return segments_count * outer_stride; }
93 return m_data + (i + j * outer_stride);
96 return m_data + (i + j * outer_stride);
114 Eigen::ComputationInfo
122 bool llt_in_place() noexcept;
125 const auto &self = *
this;
127 for (
isize i = 0; i < nsegments(); ++i) {
128 for (
isize j = 0; j < nsegments(); ++j) {
129 out(i, j) =
trans(self(j, i));
136PROXSUITE_NLP_DLLAPI
void
140PROXSUITE_NLP_DLLAPI
void
142 isize const *perm =
nullptr) noexcept;
PROXSUITE_NLP_DLLAPI BlockKind trans(BlockKind a) noexcept
BlockKind of the transpose of a matrix.
std::make_unsigned< isize >::type usize
PROXSUITE_NLP_DLLAPI void print_sparsity_pattern(const SymbolicBlockMatrix &smat) noexcept
PROXSUITE_NLP_DLLAPI BlockKind add(BlockKind a, BlockKind b) noexcept
BlockKind of the addition of two matrices - given by their BlockKind.
PROXSUITE_NLP_DLLAPI BlockKind mul(BlockKind a, BlockKind b) noexcept
BlockKind of the product of two matrices.
PROXSUITE_NLP_DLLAPI void symbolic_deep_copy(const SymbolicBlockMatrix &in, SymbolicBlockMatrix &out, isize const *perm=nullptr) noexcept
Deep copy of a SymbolicBlockMatrix, possibily with a permutation.
BlockKind
Kind of matrix block: zeros, diagonal, lower/upper triangular or dense.
@ Dense
There is no known prior structure; assume a dense block.
@ Diag
The block is diagonal.
@ Zero
All entries in the block are zero.
@ TriL
The block is lower-triangular.
@ TriU
The block is upper-triangular.
Symbolic representation of the sparsity structure of a (square) block matrix.
const BlockKind & operator()(isize i, isize j) const noexcept
SymbolicBlockMatrix(const std::vector< isize > &lens)
isize nsegments() const noexcept
SymbolicBlockMatrix(SymbolicBlockMatrix const &other)=default
Shallow copy constructor.
SymbolicBlockMatrix(isize nc, isize os)
Allocating constructor.
SymbolicBlockMatrix(BlockKind *data, isize *lens, isize nc, isize os)
Constructor from external data.
bool check_if_symmetric() const noexcept
isize size() const noexcept
SymbolicBlockMatrix submatrix(isize i, isize n) noexcept
BlockKind const * ptr(isize i, isize j) const noexcept
BlockKind & operator()(isize i, isize j) noexcept
Get a reference to the block in position (i, j).
Eigen::ComputationInfo brute_force_best_permutation(SymbolicBlockMatrix const &in, isize *best_perm, isize *iwork)
BlockKind * ptr(isize i, isize j) noexcept
SymbolicBlockMatrix & operator=(SymbolicBlockMatrix const &other)=default
SymbolicBlockMatrix copy() const
Deep copy.