Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- #277: The method `Pattern.print_pattern` is now deprecated.
- Moved all device interface functionalities to an external library and removed their implementation from this library.
- #261: Moved all device interface functionalities to an external library and removed their implementation from this library.

## [0.3.1] - 2025-04-21

Expand Down
7 changes: 4 additions & 3 deletions graphix/sim/base_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Literal

import numpy as np

Expand All @@ -22,6 +22,7 @@
from graphix import command
from graphix.fundamentals import Plane
from graphix.measurements import Measurement
from graphix.parameter import ExpressionOrFloat
from graphix.simulator import MeasureMethod


Expand Down Expand Up @@ -160,8 +161,8 @@ def _op_mat_from_result(vec: tuple[float, float, float], result: bool, symbolic:


def perform_measure(
qubit: int, plane: Plane, angle: float, state, rng, pr_calc: bool = True, symbolic: bool = False
) -> npt.NDArray:
qubit: int, plane: Plane, angle: ExpressionOrFloat, state, rng, pr_calc: bool = True, symbolic: bool = False
) -> Literal[0, 1]:
"""Perform measurement of a qubit."""
vec = plane.polar(angle)
if pr_calc:
Expand Down
2 changes: 1 addition & 1 deletion graphix/sim/statevec.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def tensor(self, other: Statevec) -> None:
total_num = len(self.dims()) + len(other.dims())
self.psi = np.kron(psi_self, psi_other).reshape((2,) * total_num)

def cnot(self, qubits):
def cnot(self, qubits) -> None:
"""Apply CNOT.

Parameters
Expand Down
Loading