You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
produces constant part (empty string key) with coefficient a 0d numpy array (should be number, as for the rest of coefficients)
How can we reproduce the issue?
from qiskit_nature.second_q.operators import BosonicOp, PolynomialTensor
import numpy as np
data = {'': 1, '+': np.array([1,0])}
t = PolynomialTensor(data)
b = BosonicOp.from_polynomial_tensor(t)
print(b._data)
Output:
{'': array(1), '+_0': 1}
What should happen?
Output should be:
{'': 1, '+_0': 1}
Any suggestions?
In line 246 of bosonic_op.py (and equivalent lines for fermionic_op.py, spin_op.py, vibrational_op.py):
data[""] = tensor[key]
cast rhs to scalar, e.g. by applying sum method to 0d tensor:
data[""] = tensor[key].sum()
The text was updated successfully, but these errors were encountered:
Environment
What is happening?
from_polynomial_tensor
constructor forBosonicOp
FermionicOp
SpinOp
VibrationalOp
produces constant part (empty string key) with coefficient a 0d numpy array (should be number, as for the rest of coefficients)
How can we reproduce the issue?
Output:
What should happen?
Output should be:
Any suggestions?
In line 246 of
bosonic_op.py
(and equivalent lines forfermionic_op.py
,spin_op.py
,vibrational_op.py
):cast rhs to scalar, e.g. by applying sum method to 0d tensor:
The text was updated successfully, but these errors were encountered: