num::sparse_diagonal_similarity¶
Defined in header <linear/sparse/sparse.hpp>
Compute \(D^{-1} A D\) without leaving the sparse representation.
A diagonal similarity rescales entries in place, so the result carries the pattern of A. Use this form when the transformed matrix is factored or multiplied rather than inspected, since diagonal_similarity densifies it.
Parameters¶
A: Square CSR matrix.weights: Positive diagonal weight entries \(w_i > 0\).
Return value¶
CSR matrix \(D^{-1} A D\) with the pattern of A.
Exceptions¶
std::invalid_argument: If dimensions mismatch or any weight is non-positive.