Skip to content

Commit

Permalink
fix: add missing _check_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLiegiBastonLiegi committed Dec 19, 2024
1 parent eceb413 commit f80f402
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Binary file added doc/final_result.npy
Binary file not shown.
2 changes: 2 additions & 0 deletions src/qibo/hamiltonians/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def TFIM(nqubits, h: float = 0.0, dense: bool = True, backend=None):
"""
if nqubits < 2:
raise_error(ValueError, "Number of qubits must be larger than one.")
backend = _check_backend(backend)
if dense:
condition = lambda i, j: i in {j % nqubits, (j + 1) % nqubits}
ham = -_build_spin_model(nqubits, backend.matrices.Z, condition, backend)
Expand Down Expand Up @@ -447,6 +448,7 @@ def _build_spin_model(nqubits, matrix, condition, backend):
def _OneBodyPauli(nqubits, operator, dense: bool = True, backend=None):
"""Helper method for constructing non-interacting
:math:`X`, :math:`Y`, and :math:`Z` Hamiltonians."""
backend = _check_backend(backend)
if dense:
condition = lambda i, j: i == j % nqubits
ham = -_build_spin_model(
Expand Down

0 comments on commit f80f402

Please sign in to comment.