graphix icon indicating copy to clipboard operation
graphix copied to clipboard

Add methods to `Statevec`

Open king-p3nguin opened this issue 1 year ago • 2 comments

The following methods may improve the utility of Statevec:

  • [ ] .inner(): calculate the inner product of two state vectors
    • return np.abs(np.dot(sv1.flatten().conjugate(), sv2.flatten()))
  • [ ] .equiv(): checks the equality of two state vectors up to the global phase
    • add atol and rtol to parameters to set precision
    • ignore_global_phase option to ignore the global phase, set True as default
  • [ ] .draw(): show state vector in latex format (in jupyter notebook) or text (in command line)
    • add format to parameter ("latex" or "text")
  • [ ] .to_dict(): convert Statevec to dict format

king-p3nguin avatar Nov 15 '23 17:11 king-p3nguin