From 5c0ad12f0402b6815cac74eddb75d401f920f761 Mon Sep 17 00:00:00 2001 From: Yao Tang Date: Tue, 31 Oct 2023 12:42:31 +0000 Subject: [PATCH] Fix typing issues --- pytket/extensions/qulacs/backends/qulacs_backend.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pytket/extensions/qulacs/backends/qulacs_backend.py b/pytket/extensions/qulacs/backends/qulacs_backend.py index 3302c92..dfbc77c 100644 --- a/pytket/extensions/qulacs/backends/qulacs_backend.py +++ b/pytket/extensions/qulacs/backends/qulacs_backend.py @@ -15,7 +15,7 @@ """Methods to allow tket circuits to be ran on the Qulacs simulator """ -from typing import List, Optional, Sequence, Union, cast +from typing import List, Optional, Sequence, Union, Type, cast from logging import warning from random import Random from uuid import uuid4 @@ -126,6 +126,7 @@ def __init__( self._GATE_SET, ) self._result_type = result_type + self._sim: Type[Union[QuantumState, DensityMatrix, "QuantumStateGpu"]] if result_type == "state_vector": self._sim = QuantumState elif result_type == "density_matrix": @@ -211,9 +212,9 @@ def process_circuits( ) qulacs_circ.update_quantum_state(qulacs_state) if self._result_type == "state_vector": - state = qulacs_state.get_vector() + state = qulacs_state.get_vector() # type: ignore else: - state = qulacs_state.get_matrix() + state = qulacs_state.get_matrix() # type: ignore qubits = sorted(circuit.qubits, reverse=False) shots = None bits = None