Std

class cubie.outputhandling.summarymetrics.std.Std(precision)[source]

Bases: SummaryMetric

Summary metric that calculates the standard deviation of a variable.

Notes

The metric uses three buffer slots: one for the shift value (first sample), one for the sum of shifted values, and one for the sum of squares of shifted values. The standard deviation is calculated using a numerically stable shifted-data algorithm to avoid catastrophic cancellation.

__init__(precision) None[source]

Initialise the Std summary metric with fixed buffer sizes.

build() MetricFuncCache[source]

Generate CUDA device functions for standard deviation calculation.

Returns:

Cache containing the device update and save callbacks.

Return type:

MetricFuncCache

Notes

The update callback accumulates both sum and sum of squares while the save callback computes the standard deviation and clears the buffer.