Skip to content

Commit

Permalink
Fix another error
Browse files Browse the repository at this point in the history
  • Loading branch information
ohuettenhofer committed Nov 12, 2024
1 parent 9ff305d commit bec8360
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/tequila/quantumchemistry/encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def map_state(self, state: list, *args, **kwargs) -> list:
fop = openfermion.FermionOperator(string, 1.0)
op = self(fop)
from tequila.wavefunction.qubit_wavefunction import QubitWaveFunction
wfn = QubitWaveFunction.from_basis_state(0, n_qubits=n_qubits)
wfn = QubitWaveFunction.from_basis_state(n_qubits, 0)
wfn = wfn.apply_qubitoperator(operator=op)
assert (len(wfn.keys()) == 1)
assert wfn.length() == 1
key = list(wfn.keys())[0].array
return key

Expand Down
2 changes: 1 addition & 1 deletion src/tequila/simulators/simulator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def simulate(self, variables, initial_state=0, *args, **kwargs) -> QubitWaveFunc
if isinstance(initial_state, BitString):
initial_state = initial_state.integer
if isinstance(initial_state, QubitWaveFunction):
if len(initial_state.keys()) != 1:
if initial_state.length() != 1:
raise TequilaException("only product states as initial states accepted")
initial_state = list(initial_state.keys())[0].integer

Expand Down
2 changes: 1 addition & 1 deletion src/tequila/simulators/simulator_qibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def simulate(self, variables, initial_state=0, *args, **kwargs) -> QubitWaveFunc
if isinstance(initial_state, BitString):
initial_state = initial_state.integer
if isinstance(initial_state, QubitWaveFunction):
if len(initial_state) != 1:
if initial_state.length() != 1:
return self.do_simulate(variables=variables,initial_state=initial_state, *args, **kwargs)
initial_state = list(initial_state.keys())[0].integer
if isinstance(initial_state,np.ndarray):
Expand Down

0 comments on commit bec8360

Please sign in to comment.