qiskit-community / qiskit-nature

Qiskit Nature is an open-source, quantum computing, framework for solving quantum mechanical natural science problems.
https://qiskit-community.github.io/qiskit-nature/
Apache License 2.0
306 stars 207 forks source link

Trying to `copy.copy` a `Tensor` leads to a `RecursionError` #1253

Closed mrossinek closed 1 year ago

mrossinek commented 1 year ago

Environment

What is happening?

Calling copy.copy on a Tensor results in a RecursionError.

How can we reproduce the issue?

import copy
import numpy as np
from qiskit_nature.second_q.operators import Tensor

t = Tensor(np.random.random((2, 2)))
s = copy.copy(t)

What should happen?

No error should occur.

Any suggestions?

No response