@@ -194,10 +194,10 @@ def _json_dict_(self) -> Dict[str, Any]:
194
194
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
195
195
return (
196
196
self .num_qubits == other .num_qubits
197
- and np .isclose (self .p_i , other .p_i , atol = atol )
198
- and np .isclose (self .p_x , other .p_x , atol = atol )
199
- and np .isclose (self .p_y , other .p_y , atol = atol )
200
- and np .isclose (self .p_z , other .p_z , atol = atol )
197
+ and np .isclose (self .p_i , other .p_i , atol = atol ). item ()
198
+ and np .isclose (self .p_x , other .p_x , atol = atol ). item ()
199
+ and np .isclose (self .p_y , other .p_y , atol = atol ). item ()
200
+ and np .isclose (self .p_z , other .p_z , atol = atol ). item ()
201
201
)
202
202
203
203
@@ -356,7 +356,7 @@ def _json_dict_(self) -> Dict[str, Any]:
356
356
return protocols .obj_to_dict_helper (self , ['p' , 'n_qubits' ])
357
357
358
358
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
359
- return np .isclose (self .p , other .p , atol = atol ) and self .n_qubits == other .n_qubits
359
+ return np .isclose (self .p , other .p , atol = atol ). item () and self .n_qubits == other .n_qubits
360
360
361
361
362
362
def depolarize (p : float , n_qubits : int = 1 ) -> DepolarizingChannel :
@@ -498,8 +498,9 @@ def _json_dict_(self) -> Dict[str, Any]:
498
498
return protocols .obj_to_dict_helper (self , ['p' , 'gamma' ])
499
499
500
500
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
501
- return np .isclose (self .gamma , other .gamma , atol = atol ) and np .isclose (
502
- self .p , other .p , atol = atol
501
+ return (
502
+ np .isclose (self .gamma , other .gamma , atol = atol ).item ()
503
+ and np .isclose (self .p , other .p , atol = atol ).item ()
503
504
)
504
505
505
506
@@ -628,7 +629,7 @@ def _json_dict_(self) -> Dict[str, Any]:
628
629
return protocols .obj_to_dict_helper (self , ['gamma' ])
629
630
630
631
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
631
- return np .isclose (self .gamma , other .gamma , atol = atol )
632
+ return np .isclose (self .gamma , other .gamma , atol = atol ). item ()
632
633
633
634
634
635
def amplitude_damp (gamma : float ) -> AmplitudeDampingChannel :
@@ -863,7 +864,7 @@ def _json_dict_(self) -> Dict[str, Any]:
863
864
return protocols .obj_to_dict_helper (self , ['gamma' ])
864
865
865
866
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
866
- return np .isclose (self ._gamma , other ._gamma , atol = atol )
867
+ return np .isclose (self ._gamma , other ._gamma , atol = atol ). item ()
867
868
868
869
869
870
def phase_damp (gamma : float ) -> PhaseDampingChannel :
@@ -973,7 +974,7 @@ def _json_dict_(self) -> Dict[str, Any]:
973
974
return protocols .obj_to_dict_helper (self , ['p' ])
974
975
975
976
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
976
- return np .isclose (self .p , other .p , atol = atol )
977
+ return np .isclose (self .p , other .p , atol = atol ). item ()
977
978
978
979
979
980
def _phase_flip_Z () -> common_gates .ZPowGate :
@@ -1129,7 +1130,7 @@ def _json_dict_(self) -> Dict[str, Any]:
1129
1130
return protocols .obj_to_dict_helper (self , ['p' ])
1130
1131
1131
1132
def _approx_eq_ (self , other : Any , atol : float ) -> bool :
1132
- return np .isclose (self ._p , other ._p , atol = atol )
1133
+ return np .isclose (self ._p , other ._p , atol = atol ). item ()
1133
1134
1134
1135
1135
1136
def _bit_flip (p : float ) -> BitFlipChannel :
0 commit comments