qoro-divi 0.2.0b1__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- divi/__init__.py +1 -2
- divi/backends/__init__.py +10 -0
- divi/backends/_backend_properties_conversion.py +227 -0
- divi/backends/_circuit_runner.py +70 -0
- divi/backends/_execution_result.py +70 -0
- divi/backends/_parallel_simulator.py +486 -0
- divi/backends/_qoro_service.py +663 -0
- divi/backends/_qpu_system.py +101 -0
- divi/backends/_results_processing.py +133 -0
- divi/circuits/__init__.py +13 -0
- divi/{exp/cirq → circuits/_cirq}/__init__.py +1 -2
- divi/circuits/_cirq/_parser.py +110 -0
- divi/circuits/_cirq/_qasm_export.py +78 -0
- divi/circuits/_core.py +391 -0
- divi/{qasm.py → circuits/_qasm_conversion.py} +73 -14
- divi/circuits/_qasm_validation.py +694 -0
- divi/qprog/__init__.py +27 -8
- divi/qprog/_expectation.py +181 -0
- divi/qprog/_hamiltonians.py +281 -0
- divi/qprog/algorithms/__init__.py +16 -0
- divi/qprog/algorithms/_ansatze.py +368 -0
- divi/qprog/algorithms/_custom_vqa.py +263 -0
- divi/qprog/algorithms/_pce.py +262 -0
- divi/qprog/algorithms/_qaoa.py +579 -0
- divi/qprog/algorithms/_vqe.py +262 -0
- divi/qprog/batch.py +387 -74
- divi/qprog/checkpointing.py +556 -0
- divi/qprog/exceptions.py +9 -0
- divi/qprog/optimizers.py +1014 -43
- divi/qprog/quantum_program.py +243 -412
- divi/qprog/typing.py +62 -0
- divi/qprog/variational_quantum_algorithm.py +1208 -0
- divi/qprog/workflows/__init__.py +10 -0
- divi/qprog/{_graph_partitioning.py → workflows/_graph_partitioning.py} +139 -95
- divi/qprog/workflows/_qubo_partitioning.py +221 -0
- divi/qprog/workflows/_vqe_sweep.py +560 -0
- divi/reporting/__init__.py +7 -0
- divi/reporting/_pbar.py +127 -0
- divi/reporting/_qlogger.py +68 -0
- divi/reporting/_reporter.py +155 -0
- {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info}/METADATA +43 -15
- qoro_divi-0.6.0.dist-info/RECORD +47 -0
- {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info}/WHEEL +1 -1
- qoro_divi-0.6.0.dist-info/licenses/LICENSES/.license-header +3 -0
- divi/_pbar.py +0 -73
- divi/circuits.py +0 -139
- divi/exp/cirq/_lexer.py +0 -126
- divi/exp/cirq/_parser.py +0 -889
- divi/exp/cirq/_qasm_export.py +0 -37
- divi/exp/cirq/_qasm_import.py +0 -35
- divi/exp/cirq/exception.py +0 -21
- divi/exp/scipy/_cobyla.py +0 -342
- divi/exp/scipy/pyprima/LICENCE.txt +0 -28
- divi/exp/scipy/pyprima/__init__.py +0 -263
- divi/exp/scipy/pyprima/cobyla/__init__.py +0 -0
- divi/exp/scipy/pyprima/cobyla/cobyla.py +0 -599
- divi/exp/scipy/pyprima/cobyla/cobylb.py +0 -849
- divi/exp/scipy/pyprima/cobyla/geometry.py +0 -240
- divi/exp/scipy/pyprima/cobyla/initialize.py +0 -269
- divi/exp/scipy/pyprima/cobyla/trustregion.py +0 -540
- divi/exp/scipy/pyprima/cobyla/update.py +0 -331
- divi/exp/scipy/pyprima/common/__init__.py +0 -0
- divi/exp/scipy/pyprima/common/_bounds.py +0 -41
- divi/exp/scipy/pyprima/common/_linear_constraints.py +0 -46
- divi/exp/scipy/pyprima/common/_nonlinear_constraints.py +0 -64
- divi/exp/scipy/pyprima/common/_project.py +0 -224
- divi/exp/scipy/pyprima/common/checkbreak.py +0 -107
- divi/exp/scipy/pyprima/common/consts.py +0 -48
- divi/exp/scipy/pyprima/common/evaluate.py +0 -101
- divi/exp/scipy/pyprima/common/history.py +0 -39
- divi/exp/scipy/pyprima/common/infos.py +0 -30
- divi/exp/scipy/pyprima/common/linalg.py +0 -452
- divi/exp/scipy/pyprima/common/message.py +0 -336
- divi/exp/scipy/pyprima/common/powalg.py +0 -131
- divi/exp/scipy/pyprima/common/preproc.py +0 -393
- divi/exp/scipy/pyprima/common/present.py +0 -5
- divi/exp/scipy/pyprima/common/ratio.py +0 -56
- divi/exp/scipy/pyprima/common/redrho.py +0 -49
- divi/exp/scipy/pyprima/common/selectx.py +0 -346
- divi/interfaces.py +0 -25
- divi/parallel_simulator.py +0 -258
- divi/qlogger.py +0 -119
- divi/qoro_service.py +0 -343
- divi/qprog/_mlae.py +0 -182
- divi/qprog/_qaoa.py +0 -440
- divi/qprog/_vqe.py +0 -275
- divi/qprog/_vqe_sweep.py +0 -144
- divi/utils.py +0 -116
- qoro_divi-0.2.0b1.dist-info/RECORD +0 -58
- /divi/{qem.py → circuits/qem.py} +0 -0
- {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info/licenses}/LICENSE +0 -0
- {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info/licenses}/LICENSES/Apache-2.0.txt +0 -0
divi/exp/cirq/_lexer.py
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# Copyright 2018 The Cirq Developers
|
|
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
|
-
# https://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.
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import re
|
|
18
|
-
|
|
19
|
-
import ply.lex as lex
|
|
20
|
-
|
|
21
|
-
from .exception import QasmException
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class QasmLexer:
|
|
25
|
-
def __init__(self):
|
|
26
|
-
self.lex = lex.lex(object=self, debug=False)
|
|
27
|
-
|
|
28
|
-
literals = "{}[]();,+/*-^="
|
|
29
|
-
|
|
30
|
-
reserved = {
|
|
31
|
-
"qubit": "QUBIT",
|
|
32
|
-
"qreg": "QREG",
|
|
33
|
-
"bit": "BIT",
|
|
34
|
-
"creg": "CREG",
|
|
35
|
-
"measure": "MEASURE",
|
|
36
|
-
"reset": "RESET",
|
|
37
|
-
"gate": "GATE",
|
|
38
|
-
"if": "IF",
|
|
39
|
-
"pi": "PI",
|
|
40
|
-
"input": "INPUT", # <-- Add this
|
|
41
|
-
"angle": "ANGLE", # <-- Add this
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
tokens = [
|
|
45
|
-
"FORMAT_SPEC",
|
|
46
|
-
"NUMBER",
|
|
47
|
-
"NATURAL_NUMBER",
|
|
48
|
-
"STDGATESINC",
|
|
49
|
-
"QELIBINC",
|
|
50
|
-
"ID",
|
|
51
|
-
"ARROW",
|
|
52
|
-
"EQ",
|
|
53
|
-
] + list(reserved.values())
|
|
54
|
-
|
|
55
|
-
def t_newline(self, t):
|
|
56
|
-
r"""\n+"""
|
|
57
|
-
t.lexer.lineno += len(t.value)
|
|
58
|
-
|
|
59
|
-
t_ignore = " \t"
|
|
60
|
-
|
|
61
|
-
# all numbers except NATURAL_NUMBERs:
|
|
62
|
-
# it's useful to have this separation to be able to handle indices
|
|
63
|
-
# separately. In case of the parameter expressions, we are "OR"-ing
|
|
64
|
-
# them together (see p_term in _parser.py)
|
|
65
|
-
def t_NUMBER(self, t):
|
|
66
|
-
r"""(
|
|
67
|
-
(
|
|
68
|
-
[0-9]+\.?|
|
|
69
|
-
[0-9]?\.[0-9]+
|
|
70
|
-
)
|
|
71
|
-
[eE][+-]?[0-9]+
|
|
72
|
-
)|
|
|
73
|
-
(
|
|
74
|
-
([0-9]+)?\.[0-9]+|
|
|
75
|
-
[0-9]+\.)"""
|
|
76
|
-
t.value = float(t.value)
|
|
77
|
-
return t
|
|
78
|
-
|
|
79
|
-
def t_NATURAL_NUMBER(self, t):
|
|
80
|
-
r"""\d+"""
|
|
81
|
-
t.value = int(t.value)
|
|
82
|
-
return t
|
|
83
|
-
|
|
84
|
-
def t_FORMAT_SPEC(self, t):
|
|
85
|
-
r"""OPENQASM(\s+)([^\s\t\;]*);"""
|
|
86
|
-
match = re.match(r"""OPENQASM(\s+)([^\s\t;]*);""", t.value)
|
|
87
|
-
t.value = match.groups()[1]
|
|
88
|
-
return t
|
|
89
|
-
|
|
90
|
-
def t_QELIBINC(self, t):
|
|
91
|
-
r"""include(\s+)"qelib1.inc";"""
|
|
92
|
-
return t
|
|
93
|
-
|
|
94
|
-
def t_STDGATESINC(self, t):
|
|
95
|
-
r"""include(\s+)"stdgates.inc";"""
|
|
96
|
-
return t
|
|
97
|
-
|
|
98
|
-
def t_ARROW(self, t):
|
|
99
|
-
"""->"""
|
|
100
|
-
return t
|
|
101
|
-
|
|
102
|
-
def t_EQ(self, t):
|
|
103
|
-
"""=="""
|
|
104
|
-
return t
|
|
105
|
-
|
|
106
|
-
def t_ID(self, t):
|
|
107
|
-
r"""[^\W\d_][\w_]*"""
|
|
108
|
-
# This regex matches any Unicode letter (not digit/underscore) at the start,
|
|
109
|
-
# followed by any number of Unicode word characters or underscores.
|
|
110
|
-
if t.value in QasmLexer.reserved:
|
|
111
|
-
t.type = QasmLexer.reserved[t.value]
|
|
112
|
-
return t
|
|
113
|
-
|
|
114
|
-
t_ID.__doc__ = r"[^\W\d_][\w_]*"
|
|
115
|
-
|
|
116
|
-
def t_COMMENT(self, t):
|
|
117
|
-
r"""//.*"""
|
|
118
|
-
|
|
119
|
-
def t_error(self, t):
|
|
120
|
-
raise QasmException(f"Illegal character '{t.value[0]}' at line {t.lineno}")
|
|
121
|
-
|
|
122
|
-
def input(self, qasm):
|
|
123
|
-
self.lex.input(qasm)
|
|
124
|
-
|
|
125
|
-
def token(self) -> lex.Token | None:
|
|
126
|
-
return self.lex.token()
|