SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
79 stars 19 forks source link

Numerically stable accumulation of intensity variance #214

Closed ddahlbom closed 8 months ago

ddahlbom commented 8 months ago

Replace running calculation of variance with running calculation of M=(n-1)*σ², where n is the number of samples.

The modifications reproduce previous results when M is divided by n-1. Note that there is currently no interface for retrieving this data. Any future interface will need to divide by n-1 to recover the variance.

kbarros commented 8 months ago

Overall looks good to me, but maybe one test got weakened. Eventually we might want to consider merging with an OnlineStatistics structure, but that's not available yet.

ddahlbom commented 8 months ago

Sorry, the weakened test was an oversight. It is fixed.