qognitive / fast-pauli

Python/C++ library for optimized operations on Pauli matrices and Pauli strings
https://qognitive-fast-pauli.readthedocs-hosted.com/en/latest/
BSD 2-Clause "Simplified" License
10 stars 0 forks source link

[FEATURE]: Add ability to deep copy fast-pauli objects #81

Open stand-by opened 3 weeks ago

stand-by commented 3 weeks ago

Summary/Motivation

Add new method .clone() to make a deep copy of our c++ bindings fp.Pauli fp.PauliString fp.PauliOp fp.SummedPauliOp

Details of the Feature

op = fp.PauliOp(["XYZ", "ZYX"])
op2 = op.clone()
op2.coeffs[0] = 2.0
op2.coeffs[1] = 3.0
assert all(op2.coeffs != op.coeffs)