-
Notifications
You must be signed in to change notification settings - Fork 0
Fuzzy scorematrix toarray
Development build. This page describes
main, not a released package. The latest published Lodestar.Fuzzy is 0.5.0 — read its documentation.
Home › Fuzzy › Fuzzy matching
The whole matrix, row-major.
public double[] ToArray()Returns — a copy of every score, cell [row, column] at row * Columns + column.
Example — the flat layout, and where a cell sits in it.
using Lodestar.Fuzzy;
string[] queries = ["new york", "boston"];
string[] choices = ["new york mets", "boston red sox", "atlanta braves"];
ScoreMatrix scores = Process.Cdist(queries, choices);
double[] flat = scores.ToArray();
int cells = flat.Length; // => 6
double atOneOne = Math.Round(flat[(1 * scores.Columns) + 1], 4); // => 60Remarks — a copy, on purpose. The matrix is immutable and hands out no reference to its own
storage; a caller who wants to read without copying takes Row, which is a
span over it.
Row-major is the layout every bulk member in this repository takes — Lodestar.Preprocessing's
transformers, Lodestar.Cluster's fits — so this array goes straight into one of them without a
transpose.
Applies to — net10.0, netstandard2.0.
See also — ScoreMatrix, ScoreMatrix.Row.