Skip to content

Commit

Permalink
return state for both noisy and non noisy
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles MOUSSA committed Nov 15, 2024
1 parent c562187 commit 0ecbdfd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pyqtorch/hamiltonians/evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,8 @@ def Ht(t: torch.Tensor) -> torch.Tensor:
)

# Retrieve the last state of shape (2**n_qubits, batch_size)
state = sol.states[-1]

return state.reshape([2] * n_qubits + [batch_size])
# and reshape
state = sol.states[-1].reshape([2] * n_qubits + [batch_size])
else:
if not isinstance(state, DensityMatrix):
state = density_mat(state)
Expand All @@ -454,8 +453,9 @@ def Ht(t: torch.Tensor) -> torch.Tensor:
self.solver_type,
options={"use_sparse": self.use_sparse},
)
mesolve_state = sol.states[-1]
return mesolve_state
# Retrieve the last density matrix
state = sol.states[-1]
return state

def forward(
self,
Expand Down

0 comments on commit 0ecbdfd

Please sign in to comment.