qdk 1.28.2.dev0__cp310-abi3-win_amd64.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 (122) hide show
  1. qdk/__init__.py +64 -0
  2. qdk/_adaptive_bytecode.py +130 -0
  3. qdk/_adaptive_pass.py +1050 -0
  4. qdk/_device/__init__.py +8 -0
  5. qdk/_device/_atom/__init__.py +337 -0
  6. qdk/_device/_atom/_decomp.py +510 -0
  7. qdk/_device/_atom/_optimize.py +315 -0
  8. qdk/_device/_atom/_reorder.py +114 -0
  9. qdk/_device/_atom/_scheduler.py +938 -0
  10. qdk/_device/_atom/_trace.py +76 -0
  11. qdk/_device/_atom/_utils.py +92 -0
  12. qdk/_device/_atom/_validate.py +45 -0
  13. qdk/_device/_device.py +139 -0
  14. qdk/_fs.py +90 -0
  15. qdk/_http.py +30 -0
  16. qdk/_interpreter.py +1076 -0
  17. qdk/_ipython.py +63 -0
  18. qdk/_native.pyd +0 -0
  19. qdk/_native.pyi +1196 -0
  20. qdk/_types.py +337 -0
  21. qdk/applications/__init__.py +2 -0
  22. qdk/applications/magnets/__init__.py +14 -0
  23. qdk/applications/magnets/geometry/__init__.py +22 -0
  24. qdk/applications/magnets/geometry/complete.py +150 -0
  25. qdk/applications/magnets/geometry/lattice1d.py +123 -0
  26. qdk/applications/magnets/geometry/lattice2d.py +187 -0
  27. qdk/applications/magnets/models/__init__.py +12 -0
  28. qdk/applications/magnets/models/model.py +230 -0
  29. qdk/applications/magnets/trotter/__init__.py +22 -0
  30. qdk/applications/magnets/trotter/trotter.py +372 -0
  31. qdk/applications/magnets/utilities/__init__.py +26 -0
  32. qdk/applications/magnets/utilities/hypergraph.py +317 -0
  33. qdk/applications/magnets/utilities/pauli.py +270 -0
  34. qdk/azure/__init__.py +32 -0
  35. qdk/azure/argument_types.py +25 -0
  36. qdk/azure/cirq.py +23 -0
  37. qdk/azure/job.py +23 -0
  38. qdk/azure/qiskit.py +24 -0
  39. qdk/azure/target/__init__.py +25 -0
  40. qdk/azure/target/rigetti.py +25 -0
  41. qdk/cirq/__init__.py +33 -0
  42. qdk/cirq/_neutral_atom.py +172 -0
  43. qdk/cirq/_result.py +309 -0
  44. qdk/code/__init__.py +6 -0
  45. qdk/code/__init__.pyi +4 -0
  46. qdk/estimator/__init__.py +36 -0
  47. qdk/estimator/_estimator.py +1187 -0
  48. qdk/openqasm/__init__.py +20 -0
  49. qdk/openqasm/_circuit.py +113 -0
  50. qdk/openqasm/_compile.py +100 -0
  51. qdk/openqasm/_estimate.py +114 -0
  52. qdk/openqasm/_import.py +72 -0
  53. qdk/openqasm/_ipython.py +24 -0
  54. qdk/openqasm/_run.py +214 -0
  55. qdk/openqasm/_utils.py +40 -0
  56. qdk/qiskit/__init__.py +110 -0
  57. qdk/qiskit/backends/__init__.py +10 -0
  58. qdk/qiskit/backends/backend_base.py +614 -0
  59. qdk/qiskit/backends/compilation.py +36 -0
  60. qdk/qiskit/backends/errors.py +29 -0
  61. qdk/qiskit/backends/neutral_atom_backend.py +288 -0
  62. qdk/qiskit/backends/neutral_atom_target.py +44 -0
  63. qdk/qiskit/backends/qirtarget.py +191 -0
  64. qdk/qiskit/backends/qsharp_backend.py +233 -0
  65. qdk/qiskit/backends/re_backend.py +201 -0
  66. qdk/qiskit/execution/__init__.py +4 -0
  67. qdk/qiskit/execution/default.py +10 -0
  68. qdk/qiskit/jobs/__init__.py +5 -0
  69. qdk/qiskit/jobs/qsjob.py +194 -0
  70. qdk/qiskit/jobs/qsjobset.py +150 -0
  71. qdk/qiskit/passes/__init__.py +4 -0
  72. qdk/qiskit/passes/remove_delay.py +22 -0
  73. qdk/qre/__init__.py +86 -0
  74. qdk/qre/_application.py +172 -0
  75. qdk/qre/_architecture.py +244 -0
  76. qdk/qre/_enumeration.py +242 -0
  77. qdk/qre/_estimation.py +218 -0
  78. qdk/qre/_instruction.py +473 -0
  79. qdk/qre/_isa_enumeration.py +428 -0
  80. qdk/qre/_qre.py +36 -0
  81. qdk/qre/_qre.pyi +1691 -0
  82. qdk/qre/_results.py +418 -0
  83. qdk/qre/_trace.py +195 -0
  84. qdk/qre/application/__init__.py +14 -0
  85. qdk/qre/application/_cirq.py +58 -0
  86. qdk/qre/application/_openqasm.py +68 -0
  87. qdk/qre/application/_qir.py +42 -0
  88. qdk/qre/application/_qsharp.py +60 -0
  89. qdk/qre/instruction_ids.py +10 -0
  90. qdk/qre/instruction_ids.pyi +99 -0
  91. qdk/qre/interop/__init__.py +35 -0
  92. qdk/qre/interop/_cirq.py +822 -0
  93. qdk/qre/interop/_qir.py +136 -0
  94. qdk/qre/interop/_qsharp.py +155 -0
  95. qdk/qre/models/__init__.py +26 -0
  96. qdk/qre/models/factories/__init__.py +8 -0
  97. qdk/qre/models/factories/_litinski.py +395 -0
  98. qdk/qre/models/factories/_round_based.py +461 -0
  99. qdk/qre/models/factories/_utils.py +90 -0
  100. qdk/qre/models/qec/__init__.py +15 -0
  101. qdk/qre/models/qec/_surface_code.py +154 -0
  102. qdk/qre/models/qec/_surface_code_low_move.py +224 -0
  103. qdk/qre/models/qec/_three_aux.py +120 -0
  104. qdk/qre/models/qec/_yoked.py +243 -0
  105. qdk/qre/models/qubits/__init__.py +8 -0
  106. qdk/qre/models/qubits/_gate_based.py +139 -0
  107. qdk/qre/models/qubits/_msft.py +70 -0
  108. qdk/qre/models/qubits/_neutral_atoms.py +178 -0
  109. qdk/qre/property_keys.py +29 -0
  110. qdk/qre/property_keys.pyi +25 -0
  111. qdk/qsharp.py +21 -0
  112. qdk/simulation/__init__.py +51 -0
  113. qdk/simulation/_noisy_simulator.py +12 -0
  114. qdk/simulation/_noisy_simulator.pyi +242 -0
  115. qdk/simulation/_simulation.py +742 -0
  116. qdk/telemetry.py +310 -0
  117. qdk/telemetry_events.py +357 -0
  118. qdk/widgets.py +15 -0
  119. qdk-1.28.2.dev0.dist-info/METADATA +169 -0
  120. qdk-1.28.2.dev0.dist-info/RECORD +122 -0
  121. qdk-1.28.2.dev0.dist-info/WHEEL +4 -0
  122. qdk-1.28.2.dev0.dist-info/licenses/LICENSE.txt +21 -0
qdk/__init__.py ADDED
@@ -0,0 +1,64 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ """qdk bundling top-level package.
5
+
6
+ Provides a single import root ``qdk`` that exposes bundled quantum tooling as
7
+ submodules (``qdk.qsharp``, ``qdk.widgets``, etc.).
8
+
9
+ Optional extras install additional dependencies and submodules:
10
+
11
+ - ``azure`` — installs ``azure-quantum``, available as ``qdk.azure``.
12
+ - ``qiskit`` — installs ``qiskit`` and makes Qiskit interop functionality available as ``qdk.qiskit``.
13
+ - ``cirq`` — installs ``cirq-core`` + ``cirq-ionq`` and makes Cirq interop functionality available as ``qdk.cirq``.
14
+ - ``jupyter`` — installs ``qsharp-widgets`` + ``qsharp-jupyterlab``; exposes ``qdk.widgets``.
15
+
16
+ """
17
+
18
+ from .telemetry_events import on_qdk_import
19
+
20
+ on_qdk_import()
21
+
22
+ # Some common utilities are lifted to the qdk root.
23
+ from . import code
24
+ from ._native import Result, TargetProfile
25
+ from ._types import (
26
+ StateDump,
27
+ ShotResult,
28
+ PauliNoise,
29
+ DepolarizingNoise,
30
+ BitFlipNoise,
31
+ PhaseFlipNoise,
32
+ )
33
+ from ._interpreter import (
34
+ set_quantum_seed,
35
+ set_classical_seed,
36
+ dump_machine,
37
+ init,
38
+ )
39
+
40
+ # Register the %%qsharp cell magic when running inside IPython/Jupyter.
41
+ try:
42
+ if __IPYTHON__: # type: ignore
43
+ from ._ipython import register_magic
44
+
45
+ register_magic()
46
+ except NameError:
47
+ pass
48
+
49
+ # utilities lifted from qsharp
50
+ __all__ = [
51
+ "code",
52
+ "set_quantum_seed",
53
+ "set_classical_seed",
54
+ "dump_machine",
55
+ "init",
56
+ "Result",
57
+ "TargetProfile",
58
+ "StateDump",
59
+ "ShotResult",
60
+ "PauliNoise",
61
+ "DepolarizingNoise",
62
+ "BitFlipNoise",
63
+ "PhaseFlipNoise",
64
+ ]
@@ -0,0 +1,130 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ """Shared opcode constants for the Adaptive Profile QIR bytecode interpreter.
5
+
6
+ These constants define the bytecode encoding used by the Python AdaptiveProfilePass
7
+ (emitter) and the Rust GPU receiver. Values must stay in sync with the Rust
8
+ ``bytecode.rs`` module and the WGSL interpreter.
9
+
10
+ Opcode word layout::
11
+
12
+ bits [7:0] = primary opcode
13
+ bits [15:8] = sub-opcode / condition code
14
+ bits [23:16] = flags
15
+
16
+ Compose via bitwise OR: ``opcode | (sub << 8) | flag``
17
+ Example: ``OP_ICMP | (ICMP_SLE << 8) | FLAG_SRC1_IMM``
18
+ """
19
+
20
+ # ── Flags (pre-shifted to bit 16+) ──────────────────────────────────────────
21
+ FLAG_DST_IMM = 1 << 18 # dst field is an immediate value, not a register
22
+ FLAG_SRC0_IMM = 1 << 16 # src0 field is an immediate value, not a register
23
+ FLAG_SRC1_IMM = 1 << 17 # src1 field is an immediate value, not a register
24
+ FLAG_AUX0_IMM = 1 << 19 # aux0 field is an immediate value, not a register
25
+ FLAG_AUX1_IMM = 1 << 20 # aux1 field is an immediate value, not a register
26
+ FLAG_AUX2_IMM = 1 << 21 # aux2 field is an immediate value, not a register
27
+ FLAG_AUX3_IMM = 1 << 22 # aux3 field is an immediate value, not a register
28
+
29
+ FLAG_FLOAT = 1 << 23 # operation uses float semantics
30
+
31
+
32
+ # ── Control Flow ─────────────────────────────────────────────────────────────
33
+ OP_NOP = 0x00
34
+ OP_RET = 0x02
35
+ OP_JUMP = 0x04
36
+ OP_BRANCH = 0x05
37
+ OP_SWITCH = 0x06
38
+ OP_CALL = 0x07
39
+ OP_CALL_RETURN = 0x08
40
+
41
+ # ── Quantum ──────────────────────────────────────────────────────────────────
42
+ OP_QUANTUM_GATE = 0x10
43
+ OP_MEASURE = 0x11
44
+ OP_RESET = 0x12
45
+ OP_READ_RESULT = 0x13
46
+ OP_RECORD_OUTPUT = 0x14
47
+ OP_READ_LOSS = 0x15
48
+
49
+ # ── Integer Arithmetic ───────────────────────────────────────────────────────
50
+ OP_ADD = 0x20
51
+ OP_SUB = 0x21
52
+ OP_MUL = 0x22
53
+ OP_UDIV = 0x23
54
+ OP_SDIV = 0x24
55
+ OP_UREM = 0x25
56
+ OP_SREM = 0x26
57
+
58
+ # ── Bitwise / Shift ─────────────────────────────────────────────────────────
59
+ OP_AND = 0x28
60
+ OP_OR = 0x29
61
+ OP_XOR = 0x2A
62
+ OP_SHL = 0x2B
63
+ OP_LSHR = 0x2C
64
+ OP_ASHR = 0x2D
65
+
66
+ # ── Comparison ───────────────────────────────────────────────────────────────
67
+ OP_ICMP = 0x30
68
+ OP_FCMP = 0x31
69
+
70
+ # ── Float Arithmetic ─────────────────────────────────────────────────────────
71
+ OP_FADD = 0x38
72
+ OP_FSUB = 0x39
73
+ OP_FMUL = 0x3A
74
+ OP_FDIV = 0x3B
75
+
76
+ # ── Type Conversion ──────────────────────────────────────────────────────────
77
+ OP_ZEXT = 0x40
78
+ OP_SEXT = 0x41
79
+ OP_TRUNC = 0x42
80
+ OP_FPEXT = 0x43
81
+ OP_FPTRUNC = 0x44
82
+ OP_INTTOPTR = 0x45
83
+ OP_FPTOSI = 0x46
84
+ OP_SITOFP = 0x47
85
+
86
+ # ── SSA / Data Movement ─────────────────────────────────────────────────────
87
+ OP_PHI = 0x50
88
+ OP_SELECT = 0x51
89
+ OP_MOV = 0x52
90
+ OP_CONST = 0x53
91
+
92
+ # ── ICmp condition codes (sub-opcode, placed in bits[15:8] via << 8) ─────────
93
+ # Reference: https://llvm.org/docs/LangRef.html#icmp-instruction
94
+ ICMP_EQ = 0
95
+ ICMP_NE = 1
96
+ ICMP_SLT = 2
97
+ ICMP_SLE = 3
98
+ ICMP_SGT = 4
99
+ ICMP_SGE = 5
100
+ ICMP_ULT = 6
101
+ ICMP_ULE = 7
102
+ ICMP_UGT = 8
103
+ ICMP_UGE = 9
104
+
105
+ # ── FCmp condition codes ─────────────────────────────────────────────────────
106
+ # Reference: https://llvm.org/docs/LangRef.html#fcmp-instruction
107
+ FCMP_FALSE = 0
108
+ FCMP_OEQ = 1
109
+ FCMP_OGT = 2
110
+ FCMP_OGE = 3
111
+ FCMP_OLT = 4
112
+ FCMP_OLE = 5
113
+ FCMP_ONE = 6
114
+ FCMP_ORD = 7
115
+ FCMP_UNO = 8
116
+ FCMP_UEQ = 9
117
+ FCMP_UGT = 10
118
+ FCMP_UGE = 11
119
+ FCMP_ULT = 12
120
+ FCMP_ULE = 13
121
+ FCMP_UNE = 14
122
+ FCMP_TRUE = 15
123
+
124
+ # ── Register type tags ───────────────────────────────────────────────────────
125
+ REG_TYPE_BOOL = 0
126
+ REG_TYPE_I32 = 1
127
+ REG_TYPE_I64 = 2
128
+ REG_TYPE_F32 = 3
129
+ REG_TYPE_F64 = 4
130
+ REG_TYPE_PTR = 5