Abstractions Lodestar.Abstractions - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Abstractions is 0.2.0 — read its documentation.

Home › Abstractions

Lodestar.Abstractions

The types the other Lodestar packages share, and nothing that computes with them beyond what a sparse matrix needs. CsrMatrix is a compressed sparse row matrix with its row norms and the vector and dense-block products a decomposition runs on; SparseNorm names the row norm a vectorizer applies. Since 0.2.0 it also holds the public data types the packages declare that carry no logic — options, results, enums — each under its original namespace, forwarded from the package that declared it where it moved, so upgrading one package never duplicates a type. A type with logic of its own stays in its package (decision 0003).

Most applications reach it through another package rather than install it directly.

Install

dotnet add package Lodestar.Abstractions

Example

using Lodestar.Abstractions;

// Two rows, three columns: row 0 holds 1 at column 0 and 2 at column 2; row 1 holds 3 at column 1.
// The constructor validates the three arrays; CreateUnchecked skips that, for arrays valid by construction.
CsrMatrix matrix = new(2, 3, [1.0, 2.0, 3.0], [0, 2, 1], [0, 2, 3]);

int rows = matrix.RowCount;             // 2
double firstRow = matrix.RowL1Norm(0);  // 3

Parity

CsrMatrix follows scipy.sparse.csr_matrix's layout: values, column indices and row pointers, in that order. docs/equivalence.md maps each Python call to its C# counterpart, with every deliberate divergence.

Dependencies

A core package (decision 0003), built for net10.0 and netstandard2.0:

  • none

Documentation