20 std::vector<real> vals,
29 const std::vector<idx>& rows,
30 const std::vector<idx>& cols,
31 const std::vector<real>& vals);
51 return col_idx_.data();
54 return row_ptr_.data();
58 idx n_rows_ = 0, n_cols_ = 0;
59 std::vector<real> vals_;
60 std::vector<idx> col_idx_;
61 std::vector<idx> row_ptr_;
Sparse matrix in Compressed Sparse Row (CSR) format.
real operator()(idx i, idx j) const
Element access A(i,j); returns 0 if outside stored pattern – O(nnz/n)
static SparseMatrix from_triplets(idx n_rows, idx n_cols, const std::vector< idx > &rows, const std::vector< idx > &cols, const std::vector< real > &vals)
Build from coordinate (COO / triplet) lists.
const idx * row_ptr() const
const idx * col_idx() const
const real * values() const
void sparse_matvec(const SparseMatrix &A, const Vector &x, Vector &y)
y = A * x
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)