package matrix

  1. Overview
  2. Docs

Module Matrix_charts.TransformSource

Data smoothing and transformation.

All transforms operate on (x, y) arrays, preserving x-values and smoothing y-values. The input array is not modified. Empty arrays produce empty output.

Sourceval ema : float -> (float * float) array -> (float * float) array

ema alpha data is the exponential moving average of data. alpha is the smoothing factor in [0, 1]; higher values weight recent observations more heavily.

Sourceval sma : int -> (float * float) array -> (float * float) array

sma window data is the simple moving average of data over window points. For indices before the window is full a partial average is used. Empty if window <= 0.

Sourceval gaussian : float -> (float * float) array -> (float * float) array

gaussian sigma data applies Gaussian kernel smoothing. sigma controls the smoothing width; the kernel radius is ceil(3 × sigma). Returns data unchanged if sigma <= 0.