ExtensionsMathNet Lodestar.Extensions.MathNet - CyrilB1531/lodestar GitHub Wiki
Converts a CsrMatrix to and from Math.NET Numerics' sparse matrix as a copy of the stored
values, so a caller already on Math.NET can hand a Lodestar vectorizer's output to it, or
the other way round, without densifying.
dotnet add package Lodestar.Extensions.MathNetusing Lodestar.Abstractions;
using Lodestar.Extensions.MathNet;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
Matrix<double> dense = DenseMatrix.OfRowArrays(
[0.0, 3.0, 0.0],
[0.0, 0.0, 0.0],
[4.0, 0.0, 5.0]);
CsrMatrix csr = MathNetInterop.ToCsrMatrix(dense);
int stored = csr.NonZeroCount; // 3A conversion: the values in equal the values out, which the tests assert both ways.
docs/equivalence.md maps each Python call to its C#
counterpart, with every deliberate divergence.
An interop package (decision 0003),
built for net10.0 and netstandard2.0:
-
Lodestar.Abstractions0.2.0 or later -
MathNet.Numerics5.0.0 or later