Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up profiles #175

Merged
merged 9 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions pytket/qir/conversion/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)

from .module import tketqirModule
from .profileqirgenerator import AProfileQirGenerator
from .profileqirgenerator import AdaptiveProfileQirGenerator
from .pytketqirgenerator import PytketQirGenerator


Expand Down Expand Up @@ -75,7 +75,7 @@ def pytket_to_qir(
Use QIRProfile.ADAPTIVE for the adaptive profile, see:
https://github.com/qir-alliance/qir-spec/tree/main/specification/under_development/profiles/Adaptive_Profile.md
Use QIRProfile.ADAPTIVE_CREGSIZE for the adaptive profile with additional
truncation operation to assure that intergers matching the classical
truncation operation to assure that integers matching the classical
registers have no unexpected set bits, see:
https://github.com/qir-alliance/qir-spec/tree/main/specification/under_development/profiles/Adaptive_Profile.md
Use QIRProfile.PYTKET for QIR with additonal function for classical registers.
Expand Down Expand Up @@ -110,7 +110,7 @@ def pytket_to_qir(
wfh=wfh,
)
elif profile == QIRProfile.ADAPTIVE or profile == QIRProfile.ADAPTIVE_CREGSIZE:
qir_generator = AProfileQirGenerator( # type: ignore
qir_generator = AdaptiveProfileQirGenerator( # type: ignore
circuit=circ,
module=m,
wasm_int_type=int_type,
Expand Down
9 changes: 2 additions & 7 deletions pytket/qir/conversion/profileqirgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
This module contains all functionality to generate QIR files
from pytket circuits.
"""

from typing import Optional, cast

import pyqir
Expand All @@ -32,11 +27,11 @@

from .module import tketqirModule
from .qirgenerator import (
AbsQirGenerator,
AbstractQirGenerator,
)


class AProfileQirGenerator(AbsQirGenerator):
class AdaptiveProfileQirGenerator(AbstractQirGenerator):
"""Generate QIR from a pytket circuit."""

def __init__(
Expand Down
16 changes: 8 additions & 8 deletions pytket/qir/conversion/pytketqirgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
This module contains all functionality to generate QIR files
from pytket circuits.
"""

from typing import Optional, cast

import pyqir
Expand All @@ -32,12 +27,17 @@

from .module import tketqirModule
from .qirgenerator import (
AbsQirGenerator,
AbstractQirGenerator,
)


class PytketQirGenerator(AbsQirGenerator):
"""Generate QIR from a pytket circuit."""
class PytketQirGenerator(AbstractQirGenerator):
"""Generates QIR from a pytket circuit in line with the pytket profile.
This profiles uses the functions `get_creg_bit`, `set_creg_bit`,
cqc-melf marked this conversation as resolved.
Show resolved Hide resolved
`set_creg_to_int`, `create_creg`, `get_int_from_creg` and
`mz_to_creg_bit` for the handling of the classical registers.
The other aspects of the QIR file are identical to the adaptive profile.
"""

def __init__(
self,
Expand Down
10 changes: 3 additions & 7 deletions pytket/qir/conversion/qirgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
This module contains all functionality to generate QIR files
from pytket circuits.
"""

import abc
import math
from collections.abc import Sequence
Expand Down Expand Up @@ -112,8 +107,9 @@
}


class AbsQirGenerator:
"""Generate QIR from a pytket circuit."""
class AbstractQirGenerator:
"""Abstract Class for the QIR generation from a pytket circuit.
Implementing the not profile specific functionality"""
cqc-melf marked this conversation as resolved.
Show resolved Hide resolved

def __init__(
self,
Expand Down
Loading