UNPKG

@thi.ng/vectors

Version:

Optimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts

22 lines 619 B
import type { ReadonlyVec } from "./api.js"; /** * Computes the Pearson correlation coefficient between `a` and `b`. Returns * `undefined` if the denominator (see below) is zero. * * @remarks * ```text * sum(a' * b') / (mag(a') * mag(b')) * ``` * * ...where `a'` and `b'` are {@link center}'ed versions of given input vectors. * * References: * * - https://en.wikipedia.org/wiki/Correlation * - https://www.youtube.com/watch?v=2bcmklvrXTQ * * @param a - * @param b - */ export declare const correlation: (a: ReadonlyVec, b: ReadonlyVec) => number | undefined; //# sourceMappingURL=correlation.d.ts.map