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.
Files changed (92) hide show
  1. divi/__init__.py +1 -2
  2. divi/backends/__init__.py +10 -0
  3. divi/backends/_backend_properties_conversion.py +227 -0
  4. divi/backends/_circuit_runner.py +70 -0
  5. divi/backends/_execution_result.py +70 -0
  6. divi/backends/_parallel_simulator.py +486 -0
  7. divi/backends/_qoro_service.py +663 -0
  8. divi/backends/_qpu_system.py +101 -0
  9. divi/backends/_results_processing.py +133 -0
  10. divi/circuits/__init__.py +13 -0
  11. divi/{exp/cirq → circuits/_cirq}/__init__.py +1 -2
  12. divi/circuits/_cirq/_parser.py +110 -0
  13. divi/circuits/_cirq/_qasm_export.py +78 -0
  14. divi/circuits/_core.py +391 -0
  15. divi/{qasm.py → circuits/_qasm_conversion.py} +73 -14
  16. divi/circuits/_qasm_validation.py +694 -0
  17. divi/qprog/__init__.py +27 -8
  18. divi/qprog/_expectation.py +181 -0
  19. divi/qprog/_hamiltonians.py +281 -0
  20. divi/qprog/algorithms/__init__.py +16 -0
  21. divi/qprog/algorithms/_ansatze.py +368 -0
  22. divi/qprog/algorithms/_custom_vqa.py +263 -0
  23. divi/qprog/algorithms/_pce.py +262 -0
  24. divi/qprog/algorithms/_qaoa.py +579 -0
  25. divi/qprog/algorithms/_vqe.py +262 -0
  26. divi/qprog/batch.py +387 -74
  27. divi/qprog/checkpointing.py +556 -0
  28. divi/qprog/exceptions.py +9 -0
  29. divi/qprog/optimizers.py +1014 -43
  30. divi/qprog/quantum_program.py +243 -412
  31. divi/qprog/typing.py +62 -0
  32. divi/qprog/variational_quantum_algorithm.py +1208 -0
  33. divi/qprog/workflows/__init__.py +10 -0
  34. divi/qprog/{_graph_partitioning.py → workflows/_graph_partitioning.py} +139 -95
  35. divi/qprog/workflows/_qubo_partitioning.py +221 -0
  36. divi/qprog/workflows/_vqe_sweep.py +560 -0
  37. divi/reporting/__init__.py +7 -0
  38. divi/reporting/_pbar.py +127 -0
  39. divi/reporting/_qlogger.py +68 -0
  40. divi/reporting/_reporter.py +155 -0
  41. {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info}/METADATA +43 -15
  42. qoro_divi-0.6.0.dist-info/RECORD +47 -0
  43. {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info}/WHEEL +1 -1
  44. qoro_divi-0.6.0.dist-info/licenses/LICENSES/.license-header +3 -0
  45. divi/_pbar.py +0 -73
  46. divi/circuits.py +0 -139
  47. divi/exp/cirq/_lexer.py +0 -126
  48. divi/exp/cirq/_parser.py +0 -889
  49. divi/exp/cirq/_qasm_export.py +0 -37
  50. divi/exp/cirq/_qasm_import.py +0 -35
  51. divi/exp/cirq/exception.py +0 -21
  52. divi/exp/scipy/_cobyla.py +0 -342
  53. divi/exp/scipy/pyprima/LICENCE.txt +0 -28
  54. divi/exp/scipy/pyprima/__init__.py +0 -263
  55. divi/exp/scipy/pyprima/cobyla/__init__.py +0 -0
  56. divi/exp/scipy/pyprima/cobyla/cobyla.py +0 -599
  57. divi/exp/scipy/pyprima/cobyla/cobylb.py +0 -849
  58. divi/exp/scipy/pyprima/cobyla/geometry.py +0 -240
  59. divi/exp/scipy/pyprima/cobyla/initialize.py +0 -269
  60. divi/exp/scipy/pyprima/cobyla/trustregion.py +0 -540
  61. divi/exp/scipy/pyprima/cobyla/update.py +0 -331
  62. divi/exp/scipy/pyprima/common/__init__.py +0 -0
  63. divi/exp/scipy/pyprima/common/_bounds.py +0 -41
  64. divi/exp/scipy/pyprima/common/_linear_constraints.py +0 -46
  65. divi/exp/scipy/pyprima/common/_nonlinear_constraints.py +0 -64
  66. divi/exp/scipy/pyprima/common/_project.py +0 -224
  67. divi/exp/scipy/pyprima/common/checkbreak.py +0 -107
  68. divi/exp/scipy/pyprima/common/consts.py +0 -48
  69. divi/exp/scipy/pyprima/common/evaluate.py +0 -101
  70. divi/exp/scipy/pyprima/common/history.py +0 -39
  71. divi/exp/scipy/pyprima/common/infos.py +0 -30
  72. divi/exp/scipy/pyprima/common/linalg.py +0 -452
  73. divi/exp/scipy/pyprima/common/message.py +0 -336
  74. divi/exp/scipy/pyprima/common/powalg.py +0 -131
  75. divi/exp/scipy/pyprima/common/preproc.py +0 -393
  76. divi/exp/scipy/pyprima/common/present.py +0 -5
  77. divi/exp/scipy/pyprima/common/ratio.py +0 -56
  78. divi/exp/scipy/pyprima/common/redrho.py +0 -49
  79. divi/exp/scipy/pyprima/common/selectx.py +0 -346
  80. divi/interfaces.py +0 -25
  81. divi/parallel_simulator.py +0 -258
  82. divi/qlogger.py +0 -119
  83. divi/qoro_service.py +0 -343
  84. divi/qprog/_mlae.py +0 -182
  85. divi/qprog/_qaoa.py +0 -440
  86. divi/qprog/_vqe.py +0 -275
  87. divi/qprog/_vqe_sweep.py +0 -144
  88. divi/utils.py +0 -116
  89. qoro_divi-0.2.0b1.dist-info/RECORD +0 -58
  90. /divi/{qem.py → circuits/qem.py} +0 -0
  91. {qoro_divi-0.2.0b1.dist-info → qoro_divi-0.6.0.dist-info/licenses}/LICENSE +0 -0
  92. {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()