Skip to content

Commit 97aa541

Browse files
committed
Add copy method to Observable
1 parent 1c0bd64 commit 97aa541

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

koala/observable.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,9 @@ def __str__(self):
100100
for operator, qubits in self.operators
101101
)
102102
return f"Observable({operators_str})"
103+
104+
def copy(self):
105+
operators = []
106+
for tensor, qubits in self.operators:
107+
operators.append((tensor.copy(), qubits))
108+
return Observable(operators)

0 commit comments

Comments
 (0)