Skip to content

num::ilu0_factor

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

template <std::floating_point T, std::integral Index>
bool ilu0_factor(T *val, const Index *row_ptr, const Index *col_idx,
                 const Index *diagonal, Index *scratch,
                 std::type_identity_t<Index> n) noexcept;

In-place ILU(0) factorization of a CSR value array.

scratch maps columns to positions in the row being eliminated, so matching a pivot row's column is O(1). It is cleared on exit from each row.

Parameters

  • val: CSR values, overwritten with the combined factors.
  • row_ptr: CSR row offsets, size n+1. Not modified.
  • col_idx: CSR column indices, sorted within each row. Not modified.
  • diagonal: Diagonal positions from csr_diagonal_positions.
  • scratch: Workspace of size n; contents on entry and exit are irrelevant.
  • n: Number of rows.

Return value

False if a pivot was zero or non-finite, leaving val partially overwritten.