@@ -328,8 +328,8 @@ def circuit_from_quil(quil: Union[str, Program]) -> Circuit:
328
328
329
329
defined_gates , parameter_transformers = get_defined_gates (program )
330
330
331
- kraus_model : Dict [Tuple [QubitDesignator , ...], List [NDArray [np .complex_ ]]] = {}
332
- confusion_maps : Dict [int , NDArray [np .float_ ]] = {}
331
+ kraus_model : Dict [Tuple [QubitDesignator , ...], List [NDArray [np .complex128 ]]] = {}
332
+ confusion_maps : Dict [int , NDArray [np .float64 ]] = {}
333
333
334
334
# Interpret the Pragmas
335
335
for inst in program :
@@ -348,7 +348,7 @@ def circuit_from_quil(quil: Union[str, Program]) -> Circuit:
348
348
raise UndefinedQuilGate (f"{ gate_name } is not known." )
349
349
350
350
entries = np .fromstring (
351
- inst .freeform_string .strip ("()" ).replace ("i" , "j" ), dtype = np .complex_ , sep = " "
351
+ inst .freeform_string .strip ("()" ).replace ("i" , "j" ), dtype = np .complex128 , sep = " "
352
352
)
353
353
dim = int (np .sqrt (len (entries )))
354
354
kraus_gate_op = entries .reshape ((dim , dim ))
@@ -364,7 +364,7 @@ def circuit_from_quil(quil: Union[str, Program]) -> Circuit:
364
364
elif inst .command == "READOUT-POVM" :
365
365
qubit = qubit_index (inst .args [0 ])
366
366
entries = np .fromstring (
367
- inst .freeform_string .strip ("()" ).replace ("i" , "j" ), dtype = np .float_ , sep = " "
367
+ inst .freeform_string .strip ("()" ).replace ("i" , "j" ), dtype = np .float64 , sep = " "
368
368
)
369
369
confusion_matrix = entries .reshape ((2 , 2 )).T
370
370
@@ -408,7 +408,7 @@ def circuit_from_quil(quil: Union[str, Program]) -> Circuit:
408
408
)
409
409
quil_memory_reference = inst .classical_reg .out ()
410
410
if qubit in confusion_maps :
411
- cmap : Dict [Tuple [int , ...], NDArray [np .float_ ]] = {(qubit ,): confusion_maps [qubit ]}
411
+ cmap : Dict [Tuple [int , ...], NDArray [np .float64 ]] = {(qubit ,): confusion_maps [qubit ]}
412
412
"""
413
413
Argument "confusion_map" to "MeasurementGate" has incompatible type
414
414
" Dict[Tuple[int], ndarray[Any, dtype[floating[Any]]]]"
@@ -470,12 +470,14 @@ def get_defined_gates(program: Program) -> Tuple[Dict, Dict]:
470
470
p .name : a for p , a in zip (defgate .parameters , args )
471
471
}
472
472
else :
473
- defined_gates [defgate .name ] = MatrixGate (np .asarray (defgate .matrix , dtype = np .complex_ ))
473
+ defined_gates [defgate .name ] = MatrixGate (
474
+ np .asarray (defgate .matrix , dtype = np .complex128 )
475
+ )
474
476
return defined_gates , parameter_transformers
475
477
476
478
477
479
def kraus_noise_model_to_cirq (
478
- kraus_noise_model : Dict [Tuple [QubitDesignator , ...], List [NDArray [np .complex_ ]]],
480
+ kraus_noise_model : Dict [Tuple [QubitDesignator , ...], List [NDArray [np .complex128 ]]],
479
481
defined_gates : Optional [Dict [QubitDesignator , Gate ]] = None ,
480
482
) -> InsertionNoiseModel : # pragma: no cover
481
483
"""Construct a Cirq noise model from the provided Kraus operators.
@@ -527,7 +529,7 @@ def quil_expression_to_sympy(expression: ParameterDesignator):
527
529
ValueError: Connect convert unknown BinaryExp.
528
530
ValueError: Unrecognized expression.
529
531
"""
530
- if type (expression ) in {np .int_ , np .float_ , np .complex_ , int , float , complex }:
532
+ if type (expression ) in {np .int_ , np .float64 , np .complex128 , int , float , complex }:
531
533
return expression
532
534
elif isinstance (expression , Parameter ): # pragma: no cover
533
535
return sympy .Symbol (expression .name )
@@ -635,7 +637,7 @@ def num_qubits(self):
635
637
636
638
637
639
def remove_gate_from_kraus (
638
- kraus_ops : List [NDArray [np .complex_ ]], gate_matrix : NDArray [np .complex_ ]
640
+ kraus_ops : List [NDArray [np .complex128 ]], gate_matrix : NDArray [np .complex128 ]
639
641
): # pragma: no cover
640
642
"""Recover the kraus operators from a kraus composed with a gate.
641
643
This function is the reverse of append_kraus_to_gate.
0 commit comments