unitaryfund / qrack

Comprehensive, GPU accelerated framework for developing universal virtual quantum processors
https://qrack.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
172 stars 38 forks source link

Generalize expectation value and variance to all model moments #1008

Open WrathfulSpatula opened 4 months ago

WrathfulSpatula commented 4 months ago

Methods that return expectation values or variance can be thought of as on a continuum of "model moments." Expectation value (mean) is "the first model moment"; variance (centered on mean) is "the second model moment"; besides the first model moment, for a general real "x", "the x model moment" is the x-th power of the per-dimension eigenvalue less the first model moment or mean, like $y _x= \sum_n (v_n - y_1)^x$.

Expectation value and variance methods should be generalized as instances of statistical "moment", in unified output methods. This entails QInterface implementation, shared library wrapping, and maintenance of existing ad hoc optimizations on expectation value and variance queries.