Skip to content

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.

ParameterTypeDescription
inputVectorInputthe data
d?numberrequired only when passing a bare Float64Array

Vectors

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 columns
const 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);