Skip to content

Commit

Permalink
Merge pull request #44 from OpenQuantumDesign/rename
Browse files Browse the repository at this point in the history
[refactor] Rename to core
  • Loading branch information
benjimaclellan authored Oct 17, 2024
2 parents 6fd9b06 + 09f70a1 commit b9f879b
Show file tree
Hide file tree
Showing 50 changed files with 64 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
python -m pip install --upgrade pip
pip install git+ssh://[email protected]/OpenQuantumDesign/compiler_infrastructure
pip install .[test]
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/src" >> $GITHUB_ENV
- name: Run unittest
run: |
bash tests/test.sh
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ To get started you can run one of the example scripts provided. For example, to
```python
import matplotlib.pyplot as plt

from midstack.interface.analog.operator import *
from midstack.interface.analog.operations import *
from midstack.backend.metric import *
from midstack.backend.task import Task
from core.interface.analog.operator import *
from core.interface.analog.operations import *
from core.backend.metric import *
from core.backend.task import Task
from analog_sim.base import TaskArgsAnalogSimulator
from midstack.backend import QutipBackend
from core.backend import QutipBackend

X = PauliX()
Z = PauliZ()
Expand Down
1 change: 1 addition & 0 deletions src/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import interface, compiler, backend
File renamed without changes.
25 changes: 25 additions & 0 deletions src/core/backend/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023-2024 Open Quantum Design
#
# 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 abc import ABC, abstractmethod

########################################################################################


class BackendBase(ABC):
@abstractmethod
def run(self, task):
pass

pass
File renamed without changes.
8 changes: 4 additions & 4 deletions src/midstack/backend/task.py → src/core/backend/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

########################################################################################

from midstack.interface.analog.operation import AnalogCircuit
from midstack.interface.digital.circuit import DigitalCircuit
from midstack.interface.atomic.program import AtomicProgram
from midstack.backend.metric import Metric
from core.interface.analog.operation import AnalogCircuit
from core.interface.digital.circuit import DigitalCircuit
from core.interface.atomic.program import AtomicProgram
from core.backend.metric import Metric

from oqd_compiler_infrastructure import TypeReflectBaseModel

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
########################################################################################


from midstack.interface.analog import *
from core.interface.analog import *

########################################################################################

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

########################################################################################

from ..passes.analysis import analysis_term_index
from ....interface.math import MathNum, MathImag, MathAdd
from ....interface.analog import (
from core.compiler.analog.passes.analysis import analysis_term_index
from core.interface.math import MathNum, MathImag, MathAdd
from core.interface.analog import (
Operator,
OperatorAdd,
OperatorMul,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/core/interface/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import analog, atomic, digital, math
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from midstack.interface.analog.operator import OperatorSubtypes
from core.interface.analog.operator import OperatorSubtypes

from midstack.interface.analog.operator import (
from core.interface.analog.operator import (
Operator,
OperatorTerminal,
Pauli,
Expand All @@ -22,7 +22,7 @@
OperatorKron,
)

from midstack.interface.analog.operation import (
from core.interface.analog.operation import (
AnalogCircuit,
AnalogGate,
AnalogOperation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#%%
from oqd_compiler_infrastructure import VisitableBaseModel, TypeReflectBaseModel

from midstack.interface.analog.operator import Operator, OperatorSubtypes
from core.interface.analog.operator import Operator, OperatorSubtypes


__all__ = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from oqd_compiler_infrastructure import TypeReflectBaseModel
########################################################################################

from midstack.interface.math import *
from core.interface.math import *

########################################################################################

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def qasm(self):


if __name__ == "__main__":
from midstack.interface.digital.gate import H, CNOT
from core.interface.digital.gate import H, CNOT

qreg = QuantumRegister(id="q", reg=4)
creg = ClassicalRegister(id="c", reg=2)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/midstack/__init__.py

This file was deleted.

11 changes: 0 additions & 11 deletions src/midstack/backend/base.py

This file was deleted.

1 change: 0 additions & 1 deletion src/midstack/interface/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions tests/test_analog/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
########################################################################################


from midstack.interface.analog import *
from midstack.compiler.analog.analysis import TermIndex
from midstack.interface.math import *
from core.interface.analog import *
from core.compiler.analog.analysis import TermIndex
from core.interface.math import *

########################################################################################

Expand Down
6 changes: 3 additions & 3 deletions tests/test_analog/test_canonicalization_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

########################################################################################

from midstack.interface.analog import *
from midstack.compiler.analog.rewrite.canonicalize import *
from midstack.interface.math import *
from core.interface.analog import *
from core.compiler.analog.rewrite.canonicalize import *
from core.interface.math import *

########################################################################################

Expand Down
8 changes: 4 additions & 4 deletions tests/test_analog/test_canonicalization_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

########################################################################################

from midstack.interface.analog import *
from midstack.compiler.analog.verify.canonicalize import *
from midstack.compiler.analog.error import CanonicalFormError
from midstack.interface.math import *
from core.interface.analog import *
from core.compiler.analog.verify.canonicalize import *
from core.compiler.analog.error import CanonicalFormError
from core.interface.math import *

########################################################################################

Expand Down
4 changes: 2 additions & 2 deletions tests/test_analog/test_mathexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

########################################################################################

from midstack.compiler.math.rules import EvaluateMathExpr
from midstack.interface.math import *
from core.compiler.math.rules import EvaluateMathExpr
from core.interface.math import *

########################################################################################

Expand Down
8 changes: 4 additions & 4 deletions tests/test_analog/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

########################################################################################

from midstack.interface.analog import *
from midstack.interface.math import *
from midstack.compiler.analog.utils import PrintOperator
from midstack.compiler.analog.verify.operator import VerifyHilberSpaceDim
from core.interface.analog import *
from core.interface.math import *
from core.compiler.analog.utils import PrintOperator
from core.compiler.analog.verify.operator import VerifyHilberSpaceDim

########################################################################################

Expand Down

0 comments on commit b9f879b

Please sign in to comment.