Coverage for /home/runner/work/tket/tket/pytket/pytket/circuit/named_types.py: 100%
20 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-14 11:30 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-14 11:30 +0000
1# Copyright Quantinuum
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
15"""Named types for convenience"""
16from collections.abc import Sequence
17from typing import Union
19from sympy import Expr
21from pytket._tket.circuit import Op
22from pytket._tket.unit_id import Bit, Qubit, UnitID
24ParamType = Union[float, Expr]
25"""Type used for circuit parameters that can either
26 be a floating point number or symbolic"""
27PhasePolynomialDict = dict[tuple[bool, ...], ParamType]
28"""Dict type used to define a phase polynomial.
29A dict that maps Bitstrings(tuples) to ParamType"""
30PhasePolynomialSequence = Sequence[tuple[Sequence[bool], ParamType]]
31"""Sequence type used to define a phase polynomial.
32 A sequence of Bitstring(sequence) - ParamType pairs"""
33BitstringToOpMap = dict[tuple[bool, ...], Op]
34BitstringToOpList = Sequence[tuple[Sequence[bool], Op]]
35BitstringToTensoredOpMap = dict[tuple[bool, ...], Sequence[Op]]
36BitstringToTensoredOpList = Sequence[tuple[Sequence[bool], Sequence[Op]]]
37PermutationMap = dict[tuple[bool, ...], Sequence[bool]]
38PermutationList = Sequence[tuple[Sequence[bool], Sequence[bool]]]
39UnitIdType = Union[UnitID, Qubit, Bit]
40UnitIdMap = dict[UnitIdType, UnitIdType]
41RenameUnitsMap = UnitIdMap