From 6e396adaa68f45c859142f20851e023d63e8bd3f Mon Sep 17 00:00:00 2001 From: Oscar Puente <156957451+orpuente-MS@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:34:55 -0700 Subject: [PATCH 1/2] Fix `sample_instrument` type hint. --- pip/qsharp/noisy_simulator/_noisy_simulator.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pip/qsharp/noisy_simulator/_noisy_simulator.pyi b/pip/qsharp/noisy_simulator/_noisy_simulator.pyi index 8ee29813ae..83be39f34b 100644 --- a/pip/qsharp/noisy_simulator/_noisy_simulator.pyi +++ b/pip/qsharp/noisy_simulator/_noisy_simulator.pyi @@ -127,7 +127,7 @@ class DensityMatrixSimulator: """ ... - def sample_instrument(self, instrument: Instrument, qubits: List[int]): + def sample_instrument(self, instrument: Instrument, qubits: List[int]) -> int: """ Performs selective evolution under the given instrument. Returns the index of the observed outcome. @@ -210,7 +210,7 @@ class StateVectorSimulator: """ ... - def sample_instrument(self, instrument: Instrument, qubits: List[int]): + def sample_instrument(self, instrument: Instrument, qubits: List[int]) -> int: """ Performs selective evolution under the given instrument. Returns the index of the observed outcome. From 22e5d693b0dd37991bacab6a5dc36179adf52119 Mon Sep 17 00:00:00 2001 From: Oscar Puente <156957451+orpuente-MS@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:20:01 -0700 Subject: [PATCH 2/2] Fix `get_state` and `set_state` type hints. --- pip/qsharp/noisy_simulator/_noisy_simulator.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pip/qsharp/noisy_simulator/_noisy_simulator.pyi b/pip/qsharp/noisy_simulator/_noisy_simulator.pyi index 83be39f34b..12473cec91 100644 --- a/pip/qsharp/noisy_simulator/_noisy_simulator.pyi +++ b/pip/qsharp/noisy_simulator/_noisy_simulator.pyi @@ -142,7 +142,7 @@ class DensityMatrixSimulator: """ ... - def set_state(self) -> None: + def set_state(self, state: DensityMatrix) -> None: """ Set state of the quantum system to another `DensityMatrix` of the same dimensions. @@ -218,14 +218,14 @@ class StateVectorSimulator: Use this method to perform measurements on the quantum system. """ - def get_state(self) -> Optional[DensityMatrix]: + def get_state(self) -> Optional[StateVector]: """ Returns the `StateVector` if the simulator is in a valid state, otherwise returns None. """ ... - def set_state(self) -> None: + def set_state(self, state: StateVector) -> None: """ Set state of the quantum system to another `StateVector` of the same dimensions.