Expand description
Canonical numerical error metrics shared across solver tests and benches.
This module is the single place where numerical-versus-reference error is measured. It defines a normalized relative error and a tolerance check so every benchmark and integration test reports accuracy on the same scale.
The metric is deliberately scale-free: dividing by the reference magnitude makes a $0.1%$ tolerance mean the same thing whether the reference is a portfolio value of order $1$ or an inventory spread of order $0.1$. An absolute floor prevents division by zero for references at or near zero, where a relative error is undefined.
Constants§
- DEFAULT_
ABS_ FLOOR - Smallest reference magnitude considered non-degenerate.
Functions§
- assert_
close - Asserts that
numericalmatchesreferencewithin an absolute or relative tolerance. - assert_
within - Asserts that
numericalis withintolerancerelative error ofreference. - percent_
error - Percentage relative error.
- relative_
error - Normalized relative error between a numerical value and a reference.
- relative_
error_ with_ floor - Normalized relative error with an explicit absolute floor.