Skip to content

num::csr_diagonal_positions

Defined in header <linear/solvers/ilu.hpp>

template <std::integral Index>
bool csr_diagonal_positions(Index *diagonal, const Index *row_ptr, const Index *col_idx,
                            std::type_identity_t<Index> n) noexcept;

Locate each row's diagonal entry in a CSR pattern.

Requires column indices sorted within each row.

Parameters

  • diagonal: Output, size n: index into col_idx of entry (i,i).
  • row_ptr: CSR row offsets, size n+1.
  • col_idx: CSR column indices, sorted within each row.
  • n: Number of rows.

Return value

False if some row has no diagonal entry, which ILU(0) cannot proceed without.