Skip to content

num::sparse_diagonal_similarity

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

spmat sparse_diagonal_similarity(const spmat &A, view<const real> weights);

Scale the rows and columns of a sparse matrix, keeping it sparse: \(D^{-1} A D\). The result has the pattern of A.

Exceptions

  • std::invalid_argument: If the dimensions disagree or a weight is not positive.