graphix
graphix copied to clipboard
Add methods to `Statevec`
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()))
- return
- [ ]
.equiv()
: checks the equality of two state vectors up to the global phase- add
atol
andrtol
to parameters to set precision -
ignore_global_phase
option to ignore the global phase, setTrue
as default
- add
- [ ]
.draw()
: show state vector in latex format (in jupyter notebook) or text (in command line)- add
format
to parameter ("latex"
or"text"
)
- add
- [ ]
.to_dict()
: convertStatevec
todict
format