toVectors
function toVectors(input, d?): Vectors;Defined in: core/vectors.ts:102
Normalise any supported input to Vectors.
Zero-copy for a DruidJS Matrix whose values is already a Float64Array, and
for an existing Vectors. number[][] is converted once, at the boundary —
boxed arrays are never used internally.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input | VectorInput | the data |
d? | number | required only when passing a bare Float64Array |
Returns
Section titled “Returns”Example
Section titled “Example”import { toVectors, analyze } from "@saehrimnir/sickle";
// Rarely needed: every entry point accepts number[][] or a Matrix directly.analyze(data, projection);
// The one case that does need it — a flat buffer carries no column count:const hd = toVectors(buffer, 8); // 8 columnsconst ld = toVectors(flat2d, 2);analyze(hd, ld);
// Idempotent and zero-copy for Vectors and for a DruidJS Matrix. A number[][]// is copied each time, so convert once if several measures share the points.const reusable = toVectors(projection);