diff --git a/docs/source/howitworks.rst b/docs/source/howitworks.rst index 649dee3d..1d2323cb 100644 --- a/docs/source/howitworks.rst +++ b/docs/source/howitworks.rst @@ -91,7 +91,10 @@ The boolean expressions are then being fed to the `qlasskit.compiler`` which tra to invertible circuits, introducing auxiliary qubits. In this step, the compiler will automatically uncompute auxiliary qubits in order to reduce the number of qubits needed and the circuit footprint. +For the compilation, two backends are supported: +- InternalCompiler +- Tweedledum.xag_synth Result diff --git a/qlasskit/compiler/__init__.py b/qlasskit/compiler/__init__.py index d0bedf01..df80be61 100644 --- a/qlasskit/compiler/__init__.py +++ b/qlasskit/compiler/__init__.py @@ -17,17 +17,14 @@ from .expqmap import ExpQMap # noqa: F401 from .compiler import Compiler, CompilerException, optimizer # noqa: F401 -from .multipass import MultipassCompiler -from .poccompiler2 import POCCompiler2 +from .internalcompiler import InternalCompiler from .poccompiler3 import POCCompiler3 from .tweedledumcompiler import TweedledumCompiler def to_quantum(name, args, returns, exprs, compiler="tw"): - if compiler == "multipass": - s = MultipassCompiler() - elif compiler == "poc2": - s = POCCompiler2() + if compiler == "int": + s = InternalCompiler() elif compiler == "poc3": s = POCCompiler3() elif compiler == "tw": diff --git a/qlasskit/compiler/poccompiler2.py b/qlasskit/compiler/internalcompiler.py similarity index 97% rename from qlasskit/compiler/poccompiler2.py rename to qlasskit/compiler/internalcompiler.py index c1873c4d..6e3e9a66 100644 --- a/qlasskit/compiler/poccompiler2.py +++ b/qlasskit/compiler/internalcompiler.py @@ -21,8 +21,8 @@ from . import Compiler, CompilerException, ExpQMap -class POCCompiler2(Compiler): - """POC2 compiler translating an expression list to quantum circuit""" +class InternalCompiler(Compiler): + """InternalCompiler translating an expression list to quantum circuit""" def compile(self, name, args: Args, returns: Arg, exprs: BoolExpList) -> QCircuit: qc = QCircuit(name=name) diff --git a/qlasskit/compiler/multipass.py b/qlasskit/compiler/multipass.py deleted file mode 100644 index 0a7d6ad7..00000000 --- a/qlasskit/compiler/multipass.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2023 Davide Gessa - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from . import Compiler - - -class MultipassCompiler(Compiler): - pass diff --git a/qlasskit/qcircuit.py b/qlasskit/qcircuit.py index f61b6484..75c630ba 100644 --- a/qlasskit/qcircuit.py +++ b/qlasskit/qcircuit.py @@ -331,7 +331,7 @@ def toffoli(q0, q1, q2): raise Exception("Not implemented yet") elif g == "mcx": raise Exception("Not implemented yet") - else: + elif g != "bar": raise Exception(f"not handled {g}") if ga: @@ -361,7 +361,7 @@ def __qiskit_export(self, mode: Literal["circuit", "gate"]): # noqa: C901 qc.fredkin(w[0], w[1], w[2]) elif g == "mcrx": qc.append(RXGate(p).control(len(w[0:-1])), w) - else: + elif g != "bar": raise Exception(f"not handled {g}") if mode == "gate":