From f80f4028d59e810c604c7ae1632e19f6c208565f Mon Sep 17 00:00:00 2001 From: BrunoLiegiBastonLiegi Date: Thu, 19 Dec 2024 10:58:04 +0100 Subject: [PATCH] fix: add missing _check_backend --- doc/final_result.npy | Bin 0 -> 968 bytes src/qibo/hamiltonians/models.py | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 doc/final_result.npy diff --git a/doc/final_result.npy b/doc/final_result.npy new file mode 100644 index 0000000000000000000000000000000000000000..38783b6eba11d6d233fb4575f34db51b7e1606a3 GIT binary patch literal 968 zcmbtSOK;Oa5O$ih1=I3=ziP}Q2?UcMfvO6rNRc=YHAR+?Oi^U5olU*Mui0ILqBIhh zsN~F_ZI{Md{e`6Hcut3ne3*ldL;;~JoBXv zTEWueVSz%Wr_ErgTk)WJ2sIm)8@)=iBn{;_r8=xQOPZ$bZo=yP$03}t;cTNbTZUQUX3H>H z%%n^BzQFwFcFX7t7RfK)%JjtKbe{=Hxmz}fvoJ)OpM)Vvg=#q})@yo1u)LMIr@HT% zs$JSfMp=_~%J(S(uEY^kx{!HH9{U0p*C%-r9)VOR*AIzML~}>AKcW*iE^z+{O-w#btpar=@R|2%>stwoBo?dMR z*Mq{9(I(tbuH3ZY*20xHaQnC`nuI&vyldcGJioV#=gA0nCEW97aNmXvXBF}C>%r(d zD|n4Xkf4hXc79czWxVJA2bj5_F5`a2q@7ELhfWP~U|s@`^3t~T((1f|$9bKQL{fON z&{kL48a6abZBJ2K70dn3Yj~!_wQP8f;)0X1ER^*Ysd!G8Rp6&bcp;(fWkf>9v;F~M Cj}1rw literal 0 HcmV?d00001 diff --git a/src/qibo/hamiltonians/models.py b/src/qibo/hamiltonians/models.py index 8707412cd5..f013e1bde2 100644 --- a/src/qibo/hamiltonians/models.py +++ b/src/qibo/hamiltonians/models.py @@ -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) @@ -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(