Correlations

Correlations

Centralized implementation of correlation measures used in NewBestSub.

Features:

  • Single source of truth for both Pearson and Kendall τ-b.

  • Primitive DoubleArray implementations (no boxing) for hot paths.

  • Boxed Array implementations for legacy branches (e.g., Average mode).

  • Factory helpers to select by method token (Constants.CORRELATION_PEARSON, Constants.CORRELATION_KENDALL).

Design notes:

  • Pearson correlation uses allocation-free streaming accumulators.

  • Kendall τ-b is implemented in O(n²) with tie correction and no temporary pairs.

  • Boxed correlation paths exist for compatibility; internally, they may copy into primitive arrays.

Functions

Link copied to clipboard

Computes Pearson correlation on boxed arrays (Array<Double>).

Link copied to clipboard

Computes Pearson correlation on two primitive arrays.

Link copied to clipboard

Computes Kendall’s τ-b correlation on primitive arrays, with tie correction.

Link copied to clipboard

Returns a boxed correlation function for the given method token.

Link copied to clipboard

Returns a primitive correlation function for the given method token.