Skip to main content

optimal_ell_width

Function optimal_ell_width 

Source
pub fn optimal_ell_width<T: GpuFloat>(row_nnz: &[usize]) -> usize
Expand description

Compute the optimal ELL width from a distribution of per-row nnz counts.

The heuristic balances two competing goals:

  1. Minimise ELL padding waste (favours small width).
  2. Minimise COO overflow volume (favours large width).

It selects the width that minimises estimated total storage cost, modelling ELL cost as rows * width * (sizeof(i32) + sizeof(T)) and COO cost as overflow_nnz * (2 * sizeof(i32) + sizeof(T)).

Returns 1 if row_nnz is empty.