31 default:
return "<invalid>";
43template <
class Index,
class StorageIndex>
69template <
class Index = index_t>
127template <
class... Ts>
129 using Ts::operator()...;
131template <
class... Ts>
141 [](
const Dense &) {
return true; },
142 [](
const auto &) {
return false; },
144 return std::visit(visitor, sp.
value);
150 [](
const Dense &d) {
return d.rows * d.cols; },
151 [](
const auto &s) {
return s.nnz(); },
153 return std::visit(visitor, sp.
value);
158 return std::visit([](
const auto &s) {
return s.symmetry; }, sp.
value);
163 return std::visit([](
const auto &s) {
return s.rows; }, sp.
value);
168 return std::visit([](
const auto &s) {
return s.cols; }, sp.
value);
176using sparsity::Sparsity;
Common linear algebra index types.
bool is_dense(const Sparsity &sp)
Returns true if the sparsity pattern represents a dense matrix.
const char * enum_name(Symmetry s)
std::variant< Dense, SparseCSC< int, int >, SparseCSC< int, long >, SparseCSC< int, long long >, SparseCSC< long, long >, SparseCSC< long, long long >, SparseCSC< long long, long long >, SparseCOO< int >, SparseCOO< long >, SparseCOO< long long > > SparsityVariant
Helper for Sparsity.
length_t num_rows(const Sparsity &sp)
Returns the number of rows of the sparsity pattern.
length_t get_nnz(const Sparsity &sp)
Get the number of structurally nonzero elements.
length_t num_cols(const Sparsity &sp)
Returns the number of rows of the sparsity pattern.
Symmetry
Describes the symmetry of matrices.
Symmetry get_symmetry(const Sparsity &sp)
Returns the symmetry of the sparsity pattern.
@ Unsymmetric
No symmetry.
@ Upper
Symmetric, upper-triangular part is stored.
@ Lower
Symmetric, lower-triangular part is stored.
overloaded(Ts...) -> overloaded< Ts... >
Sparsity(std::convertible_to< SparsityVariant > auto value)
Sparse coordinate list structure (COO).
std::span< const index_t > row_indices
length_t nnz() const
Get the number of structurally nonzero elements.
std::span< const index_t > col_indices
Sparse compressed-column structure (CCS or CSC).
std::span< const index_t > inner_idx
length_t nnz() const
Get the number of structurally nonzero elements.
std::span< const storage_index_t > outer_ptr
StorageIndexFrom storage_index_t
Stores any of the supported sparsity patterns.
Sparsity(std::convertible_to< SparsityVariant > auto value)