Skip to content

num::diagonal

Defined in header <linear/sparse/sparse.hpp>

template <class M>
requires repr::csr<M>
vec<real> diagonal(const M &A);

Return the main diagonal of a sparse matrix, with 0 for entries not stored: \(d_i = a_{ii}\).