classiq 0.45.1__py3-none-any.whl → 0.46.1__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 (146) hide show
  1. classiq/__init__.py +0 -1
  2. classiq/_internals/__init__.py +20 -0
  3. classiq/_internals/authentication/authentication.py +11 -0
  4. classiq/analyzer/analyzer.py +12 -10
  5. classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +1 -1
  6. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +1 -1
  7. classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +1 -1
  8. classiq/applications/libraries/qmci_library.py +4 -9
  9. classiq/execution/execution_session.py +68 -7
  10. classiq/executor.py +14 -2
  11. classiq/interface/_version.py +1 -1
  12. classiq/interface/backend/backend_preferences.py +189 -0
  13. classiq/interface/backend/quantum_backend_providers.py +38 -0
  14. classiq/interface/debug_info/debug_info.py +22 -2
  15. classiq/interface/exceptions.py +16 -1
  16. classiq/interface/executor/execution_preferences.py +18 -0
  17. classiq/interface/generator/application_apis/chemistry_declarations.py +1 -177
  18. classiq/interface/generator/application_apis/combinatorial_optimization_declarations.py +0 -12
  19. classiq/interface/generator/application_apis/finance_declarations.py +8 -43
  20. classiq/interface/generator/application_apis/qsvm_declarations.py +0 -78
  21. classiq/interface/generator/builtin_api_builder.py +0 -3
  22. classiq/interface/generator/functions/__init__.py +0 -2
  23. classiq/interface/generator/functions/builtins/__init__.py +0 -15
  24. classiq/interface/generator/generated_circuit_data.py +2 -0
  25. classiq/interface/generator/hardware/hardware_data.py +37 -0
  26. classiq/interface/generator/model/constraints.py +18 -1
  27. classiq/interface/generator/model/preferences/preferences.py +53 -1
  28. classiq/interface/generator/model/quantum_register.py +1 -1
  29. classiq/interface/generator/quantum_program.py +10 -2
  30. classiq/interface/generator/transpiler_basis_gates.py +4 -0
  31. classiq/interface/generator/types/builtin_enum_declarations.py +136 -21
  32. classiq/interface/generator/types/enum_declaration.py +1 -3
  33. classiq/interface/generator/types/struct_declaration.py +1 -3
  34. classiq/interface/hardware.py +5 -0
  35. classiq/interface/ide/visual_model.py +1 -1
  36. classiq/interface/model/classical_parameter_declaration.py +6 -0
  37. classiq/interface/model/inplace_binary_operation.py +0 -14
  38. classiq/interface/model/model.py +1 -18
  39. classiq/interface/model/port_declaration.py +4 -2
  40. classiq/interface/model/quantum_function_declaration.py +19 -6
  41. classiq/interface/model/quantum_lambda_function.py +11 -1
  42. classiq/interface/model/quantum_variable_declaration.py +1 -1
  43. classiq/model_expansions/__init__.py +0 -0
  44. classiq/model_expansions/atomic_expression_functions_defs.py +250 -0
  45. classiq/model_expansions/capturing/__init__.py +0 -0
  46. classiq/model_expansions/capturing/captured_var_manager.py +50 -0
  47. classiq/model_expansions/capturing/mangling_utils.py +17 -0
  48. classiq/model_expansions/capturing/propagated_var_stack.py +180 -0
  49. classiq/model_expansions/closure.py +160 -0
  50. classiq/model_expansions/debug_flag.py +3 -0
  51. classiq/model_expansions/evaluators/__init__.py +0 -0
  52. classiq/model_expansions/evaluators/arg_type_match.py +160 -0
  53. classiq/model_expansions/evaluators/argument_types.py +42 -0
  54. classiq/model_expansions/evaluators/classical_expression.py +36 -0
  55. classiq/model_expansions/evaluators/control.py +144 -0
  56. classiq/model_expansions/evaluators/parameter_types.py +227 -0
  57. classiq/model_expansions/evaluators/quantum_type_utils.py +235 -0
  58. classiq/model_expansions/evaluators/type_type_match.py +90 -0
  59. classiq/model_expansions/expression_evaluator.py +125 -0
  60. classiq/model_expansions/expression_renamer.py +76 -0
  61. classiq/model_expansions/function_builder.py +192 -0
  62. classiq/model_expansions/generative_functions.py +101 -0
  63. classiq/model_expansions/interpreter.py +365 -0
  64. classiq/model_expansions/model_tables.py +105 -0
  65. classiq/model_expansions/quantum_operations/__init__.py +19 -0
  66. classiq/model_expansions/quantum_operations/bind.py +64 -0
  67. classiq/model_expansions/quantum_operations/classicalif.py +39 -0
  68. classiq/model_expansions/quantum_operations/control.py +235 -0
  69. classiq/model_expansions/quantum_operations/emitter.py +215 -0
  70. classiq/model_expansions/quantum_operations/expression_operation.py +218 -0
  71. classiq/model_expansions/quantum_operations/inplace_binary_operation.py +250 -0
  72. classiq/model_expansions/quantum_operations/invert.py +38 -0
  73. classiq/model_expansions/quantum_operations/power.py +74 -0
  74. classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +174 -0
  75. classiq/model_expansions/quantum_operations/quantum_function_call.py +15 -0
  76. classiq/model_expansions/quantum_operations/repeat.py +33 -0
  77. classiq/model_expansions/quantum_operations/variable_decleration.py +28 -0
  78. classiq/model_expansions/quantum_operations/within_apply.py +46 -0
  79. classiq/model_expansions/scope.py +226 -0
  80. classiq/model_expansions/scope_initialization.py +136 -0
  81. classiq/model_expansions/sympy_conversion/__init__.py +0 -0
  82. classiq/model_expansions/sympy_conversion/arithmetics.py +49 -0
  83. classiq/model_expansions/sympy_conversion/expression_to_sympy.py +150 -0
  84. classiq/model_expansions/sympy_conversion/sympy_to_python.py +113 -0
  85. classiq/model_expansions/utils/__init__.py +0 -0
  86. classiq/model_expansions/utils/counted_name_allocator.py +11 -0
  87. classiq/model_expansions/visitors/__init__.py +0 -0
  88. classiq/model_expansions/visitors/boolean_expression_transformers.py +214 -0
  89. classiq/model_expansions/visitors/variable_references.py +115 -0
  90. classiq/qmod/__init__.py +1 -3
  91. classiq/qmod/builtins/enums.py +33 -2
  92. classiq/qmod/builtins/functions/__init__.py +251 -0
  93. classiq/qmod/builtins/functions/amplitude_estimation.py +27 -0
  94. classiq/qmod/builtins/functions/arithmetic.py +68 -0
  95. classiq/qmod/builtins/functions/benchmarking.py +8 -0
  96. classiq/qmod/builtins/functions/chemistry.py +91 -0
  97. classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +105 -0
  98. classiq/qmod/builtins/functions/exponentiation.py +111 -0
  99. classiq/qmod/builtins/functions/finance.py +34 -0
  100. classiq/qmod/builtins/functions/grover.py +178 -0
  101. classiq/qmod/builtins/functions/hea.py +59 -0
  102. classiq/qmod/builtins/functions/linear_pauli_rotation.py +65 -0
  103. classiq/qmod/builtins/functions/modular_exponentiation.py +137 -0
  104. classiq/qmod/builtins/functions/operators.py +22 -0
  105. classiq/qmod/builtins/functions/qaoa_penalty.py +116 -0
  106. classiq/qmod/builtins/functions/qft.py +23 -0
  107. classiq/qmod/builtins/functions/qpe.py +39 -0
  108. classiq/qmod/builtins/functions/qsvm.py +24 -0
  109. classiq/qmod/builtins/functions/qsvt.py +136 -0
  110. classiq/qmod/builtins/functions/standard_gates.py +739 -0
  111. classiq/qmod/builtins/functions/state_preparation.py +357 -0
  112. classiq/qmod/builtins/functions/swap_test.py +25 -0
  113. classiq/qmod/builtins/structs.py +50 -28
  114. classiq/qmod/cparam.py +64 -0
  115. classiq/qmod/create_model_function.py +190 -0
  116. classiq/qmod/declaration_inferrer.py +52 -81
  117. classiq/qmod/expression_query.py +16 -0
  118. classiq/qmod/generative.py +48 -0
  119. classiq/qmod/model_state_container.py +1 -2
  120. classiq/qmod/native/pretty_printer.py +7 -11
  121. classiq/qmod/pretty_print/pretty_printer.py +7 -11
  122. classiq/qmod/python_classical_type.py +67 -0
  123. classiq/qmod/qfunc.py +19 -4
  124. classiq/qmod/qmod_parameter.py +15 -64
  125. classiq/qmod/qmod_variable.py +27 -45
  126. classiq/qmod/quantum_callable.py +1 -1
  127. classiq/qmod/quantum_expandable.py +10 -4
  128. classiq/qmod/quantum_function.py +22 -40
  129. classiq/qmod/semantics/error_manager.py +22 -10
  130. classiq/qmod/semantics/static_semantics_visitor.py +10 -12
  131. classiq/qmod/semantics/validation/types_validation.py +6 -7
  132. classiq/qmod/utilities.py +2 -2
  133. classiq/qmod/write_qmod.py +14 -0
  134. classiq/show.py +10 -0
  135. classiq/synthesis.py +46 -2
  136. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/METADATA +1 -1
  137. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/RECORD +138 -74
  138. classiq/interface/generator/functions/builtins/core_library/__init__.py +0 -16
  139. classiq/interface/generator/functions/builtins/core_library/atomic_quantum_functions.py +0 -710
  140. classiq/interface/generator/functions/builtins/core_library/exponentiation_functions.py +0 -105
  141. classiq/interface/generator/functions/builtins/open_lib_functions.py +0 -2489
  142. classiq/interface/generator/functions/builtins/quantum_operators.py +0 -24
  143. classiq/interface/generator/types/builtin_struct_declarations/__init__.py +0 -1
  144. classiq/interface/generator/types/builtin_struct_declarations/pauli_struct_declarations.py +0 -21
  145. classiq/qmod/builtins/functions.py +0 -1029
  146. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,739 @@
1
+ from typing import Literal
2
+
3
+ from classiq.qmod.qfunc import qfunc
4
+ from classiq.qmod.qmod_parameter import CReal
5
+ from classiq.qmod.qmod_variable import QArray, QBit
6
+
7
+
8
+ @qfunc(external=True)
9
+ def H(target: QBit) -> None:
10
+ """
11
+ [Qmod core-library function]
12
+
13
+ Performs the Hadamard gate on a qubit.
14
+
15
+ This operation is represented by the following matrix:
16
+
17
+ $$
18
+ H = \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 & 1 \\\\ 1 & -1 \\end{bmatrix}
19
+ $$
20
+
21
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate).
22
+
23
+ Args:
24
+ target: The qubit to apply the Hadamard gate to.
25
+
26
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
27
+ """
28
+ pass
29
+
30
+
31
+ @qfunc(external=True)
32
+ def X(target: QBit) -> None:
33
+ """
34
+ [Qmod core-library function]
35
+
36
+ Performs the Pauli-X gate on a qubit.
37
+
38
+ This operation is represented by the following matrix:
39
+
40
+ $$
41
+ X = \\begin{bmatrix} 0 & 1 \\\\ 1 & 0 \\end{bmatrix}
42
+ $$
43
+
44
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate).
45
+
46
+ Args:
47
+ target: The qubit to apply the Pauli-X gate to.
48
+
49
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
50
+ """
51
+ pass
52
+
53
+
54
+ @qfunc(external=True)
55
+ def Y(target: QBit) -> None:
56
+ """
57
+ [Qmod core-library function]
58
+
59
+ Performs the Pauli-Y gate on a qubit.
60
+
61
+ This operation is represented by the following matrix:
62
+
63
+ $$
64
+ Y = \\begin{bmatrix} 0 & -i \\\\ i & 0 \\end{bmatrix}
65
+ $$
66
+
67
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate).
68
+
69
+ Args:
70
+ target: The qubit to apply the Pauli-Y gate to.
71
+
72
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
73
+ """
74
+ pass
75
+
76
+
77
+ @qfunc(external=True)
78
+ def Z(target: QBit) -> None:
79
+ """
80
+ [Qmod core-library function]
81
+
82
+ Performs the Pauli-Z gate on a qubit.
83
+
84
+ This operation is represented by the following matrix:
85
+
86
+ $$
87
+ Z = \\begin{bmatrix} 1 & 0 \\\\ 0 & -1 \\end{bmatrix}
88
+ $$
89
+
90
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate).
91
+
92
+ Args:
93
+ target: The qubit to apply the Pauli-Z gate to.
94
+
95
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
96
+ """
97
+ pass
98
+
99
+
100
+ @qfunc(external=True)
101
+ def I(target: QBit) -> None:
102
+ """
103
+ [Qmod core-library function]
104
+
105
+ Performs the identity gate on a qubit.
106
+
107
+ This operation is represented by the following matrix:
108
+
109
+ $$
110
+ I = \\begin{bmatrix} 1 & 0 \\\\ 0 & 1 \\end{bmatrix}
111
+ $$
112
+
113
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/Quantum_logic_gate).
114
+
115
+ Args:
116
+ target: The qubit to apply the identity gate to.
117
+
118
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
119
+ """
120
+ pass
121
+
122
+
123
+ @qfunc(external=True)
124
+ def S(target: QBit) -> None:
125
+ """
126
+ [Qmod core-library function]
127
+
128
+ Performs the S gate on a qubit.
129
+
130
+ This operation is represented by the following matrix:
131
+
132
+ $$
133
+ S = \\begin{bmatrix} 1 & 0 \\\\ 0 & i \\end{bmatrix}
134
+ $$
135
+
136
+ Args:
137
+ target: The qubit to apply the S gate to.
138
+
139
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
140
+ """
141
+ pass
142
+
143
+
144
+ @qfunc(external=True)
145
+ def T(target: QBit) -> None:
146
+ """
147
+ [Qmod core-library function]
148
+
149
+ Performs the T gate on a qubit.
150
+
151
+ This operation is represented by the following matrix:
152
+
153
+ $$
154
+ T = \\begin{bmatrix} 1 & 0 \\\\ 0 & e^{i\\frac{\\pi}{4}} \\end{bmatrix}
155
+ $$
156
+
157
+ Args:
158
+ target: The qubit to apply the T gate to.
159
+
160
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
161
+ """
162
+ pass
163
+
164
+
165
+ @qfunc(external=True)
166
+ def SDG(target: QBit) -> None:
167
+ """
168
+ [Qmod core-library function]
169
+
170
+ Performs the S-dagger gate on a qubit.
171
+
172
+ This operation is represented by the following matrix:
173
+
174
+ $$
175
+ S^\\dagger = \\begin{bmatrix} 1 & 0 \\\\ 0 & -i \\end{bmatrix}
176
+ $$
177
+
178
+ Args:
179
+ target: The qubit to apply the S-dagger gate to.
180
+
181
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
182
+ """
183
+ pass
184
+
185
+
186
+ @qfunc(external=True)
187
+ def TDG(target: QBit) -> None:
188
+ """
189
+ [Qmod core-library function]
190
+
191
+ Performs the T-dagger gate on a qubit.
192
+
193
+ This operation is represented by the following matrix:
194
+
195
+ $$
196
+ T^\\dagger = \\begin{bmatrix} 1 & 0 \\\\ 0 & e^{-i\\frac{\\pi}{4}} \\end{bmatrix}
197
+ $$
198
+
199
+ Args:
200
+ target: The qubit to apply the T-dagger gate to.
201
+
202
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
203
+ """
204
+ pass
205
+
206
+
207
+ @qfunc(external=True)
208
+ def PHASE(theta: CReal, target: QBit) -> None:
209
+ """
210
+ [Qmod core-library function]
211
+
212
+ Performs the phase gate on a qubit.
213
+
214
+ This operation is represented by the following matrix:
215
+
216
+ $$
217
+ PHASE(\\theta) = \\begin{bmatrix} 1 & 0 \\\\ 0 & e^{i\\theta} \\end{bmatrix}
218
+ $$
219
+
220
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Relative_phase_gates).
221
+
222
+ Args:
223
+ theta: The phase angle in radians.
224
+ target: The qubit to apply the phase gate to.
225
+
226
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
227
+ """
228
+ pass
229
+
230
+
231
+ @qfunc(external=True)
232
+ def RX(theta: CReal, target: QBit) -> None:
233
+ """
234
+ [Qmod core-library function]
235
+
236
+ Performs the Pauli-X rotation gate on a qubit.
237
+
238
+ This operation is represented by the following matrix:
239
+
240
+ $$
241
+ R_X(\\theta) = e^{-i\\frac{\\theta}{2}X}
242
+ = \\begin{bmatrix} cos(\\frac{\\theta}{2}) & -i sin(\\frac{\\theta}{2}) \\\\ -i sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2}) \\end{bmatrix}
243
+ $$
244
+
245
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Rotation_operator_gates).
246
+
247
+ Args:
248
+ theta: The rotation angle in radians.
249
+ target: The qubit to apply the Pauli-X rotation gate to.
250
+
251
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
252
+ """
253
+ pass
254
+
255
+
256
+ @qfunc(external=True)
257
+ def RY(theta: CReal, target: QBit) -> None:
258
+ """
259
+ [Qmod core-library function]
260
+
261
+ Performs the Pauli-Y rotation gate on a qubit.
262
+
263
+ This operation is represented by the following matrix:
264
+
265
+ $$
266
+ R_Y(\\theta) = e^{-i\\frac{\\theta}{2}Y}
267
+ = \\begin{bmatrix} cos(\\frac{\\theta}{2}) & -sin(\\frac{\\theta}{2}) \\\\ -sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2}) \\end{bmatrix}
268
+ $$
269
+
270
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Rotation_operator_gates).
271
+
272
+ Args:
273
+ theta: The rotation angle in radians.
274
+ target: The qubit to apply the Pauli-Y rotation gate to.
275
+
276
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
277
+ """
278
+ pass
279
+
280
+
281
+ @qfunc(external=True)
282
+ def RZ(theta: CReal, target: QBit) -> None:
283
+ """
284
+ [Qmod core-library function]
285
+
286
+ Performs the Pauli-Z rotation gate on a qubit.
287
+
288
+ This operation is represented by the following matrix:
289
+
290
+ $$
291
+ R_Z(\\theta) = e^{-i\\frac{\\theta}{2}Z}
292
+ = \\begin{bmatrix} e^{-i\\frac{\\theta}{2}} & 0 \\\\ 0 & e^{i\\frac{\\theta}{2}} \\end{bmatrix}
293
+ $$
294
+
295
+ More information on quantum logic gates can be found on [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Rotation_operator_gates).
296
+
297
+ Args:
298
+ theta: The rotation angle in radians.
299
+ target: The qubit to apply the Pauli-Z rotation gate to.
300
+
301
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
302
+ """
303
+ pass
304
+
305
+
306
+ @qfunc(external=True)
307
+ def R(theta: CReal, phi: CReal, target: QBit) -> None:
308
+ """
309
+ [Qmod core-library function]
310
+
311
+ Performs a rotation of $\\theta$ around the $cos(\\phi)\\hat{x} + sin(\\phi)\\hat{y}$ axis on a qubit.
312
+
313
+ This operation is represented by the following matrix:
314
+
315
+ $$
316
+ R(\\theta, \\phi) = e^{-i \\frac{\\theta}{2} (cos(\\phi)X + sin(\\phi)Y)}
317
+ = \\begin{bmatrix} cos(\\frac{\\theta}{2}) & -i e^{-i\\phi} sin(\\frac{\\theta}{2}) \\\\ -i e^{i\\phi} sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2}) \\end{bmatrix}
318
+ $$
319
+
320
+ More information on this gate can be found in the [Qiskit documentation](https://docs.quantum.ibm.com/api/qiskit/qiskit.circuit.library.RGate).
321
+
322
+ Args:
323
+ theta: The rotation angle in radians.
324
+ phi: The phase angle in radians.
325
+ target: The qubit to apply the general single-qubit rotation gate to.
326
+
327
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
328
+ """
329
+ pass
330
+
331
+
332
+ @qfunc(external=True)
333
+ def RXX(theta: CReal, target: QArray[QBit, Literal[2]]) -> None:
334
+ """
335
+ [Qmod core-library function]
336
+
337
+ Performs the XX rotation gate on a pair of qubits.
338
+
339
+ This operation is represented by the following matrix:
340
+
341
+ $$
342
+ R_{XX}(\\theta) = e^{-i\\frac{\\theta}{2}X \\otimes X}
343
+ = \\begin{bmatrix} cos(\\frac{\\theta}{2}) & 0 & 0 & -i sin(\\frac{\\theta}{2}) \\\\ 0 & cos(\\frac{\\theta}{2}) & -i sin(\\frac{\\theta}{2}) & 0 \\\\ 0 & -i sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2}) & 0 \\\\ -i sin(\\frac{\\theta}{2}) & 0 & 0 & cos(\\frac{\\theta}{2}) \\end{bmatrix}
344
+ $$
345
+
346
+ For more information on quantum logic gates, see [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Two-qubit_interaction_gates).
347
+
348
+ Args:
349
+ theta: The rotation angle in radians.
350
+ target: The pair of qubits to apply the XX rotation gate to.
351
+
352
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
353
+ """
354
+ pass
355
+
356
+
357
+ @qfunc(external=True)
358
+ def RYY(theta: CReal, target: QArray[QBit, Literal[2]]) -> None:
359
+ """
360
+ [Qmod core-library function]
361
+
362
+ Performs the YY rotation gate on a pair of qubits.
363
+
364
+ This operation is represented by the following matrix:
365
+
366
+ $$
367
+ R_{YY}(\\theta) = e^{-i\\frac{\\theta}{2}Y \\otimes Y}
368
+ = \\begin{bmatrix} cos(\\frac{\\theta}{2}) & 0 & 0 & -sin(\\frac{\\theta}{2}) \\\\ 0 & cos(\\frac{\\theta}{2}) & sin(\\frac{\\theta}{2}) & 0 \\\\ 0 & sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2}) & 0 \\\\ -sin(\\frac{\\theta}{2}) & 0 & 0 & cos(\\frac{\\theta}{2}) \\end{bmatrix}
369
+ $$
370
+
371
+ For more information on quantum logic gates, see [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Two-qubit_interaction_gates).
372
+
373
+ Args:
374
+ theta: The rotation angle in radians.
375
+ target: The pair of qubits to apply the YY rotation gate to.
376
+
377
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
378
+ """
379
+ pass
380
+
381
+
382
+ @qfunc(external=True)
383
+ def RZZ(theta: CReal, target: QArray[QBit, Literal[2]]) -> None:
384
+ """
385
+ [Qmod core-library function]
386
+
387
+ Performs the ZZ rotation gate on a pair of qubits.
388
+
389
+ This operation is represented by the following matrix:
390
+
391
+ $$
392
+ R_{ZZ}(\\theta) = e^{-i\\frac{\\theta}{2}Z \\otimes Z}
393
+ = \\begin{bmatrix} e^{-i\\frac{\\theta}{2}} & 0 & 0 & 0 \\\\ 0 & e^{i\\frac{\\theta}{2}} & 0 & 0 \\\\ 0 & 0 & e^{i\\frac{\\theta}{2}} & 0 \\\\ 0 & 0 & 0 & e^{-i\\frac{\\theta}{2}} \\end{bmatrix}
394
+ $$
395
+
396
+ For more information on quantum logic gates, see [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Two-qubit_interaction_gates).
397
+
398
+ Args:
399
+ theta: The rotation angle in radians.
400
+ target: The pair of qubits to apply the ZZ rotation gate to.
401
+
402
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
403
+ """
404
+ pass
405
+
406
+
407
+ @qfunc(external=True)
408
+ def CH(control: QBit, target: QBit) -> None:
409
+ """
410
+ [Qmod core-library function]
411
+
412
+ Applies the Hadamard gate to the target qubit, conditioned on the control qubit.
413
+
414
+ This operation is represented by the following matrix:
415
+
416
+ $$
417
+ CH = \\frac{1}{\\sqrt{2}} \\begin{bmatrix}
418
+ 1 & 0 & 0 & 0 \\\\
419
+ 0 & 1 & 0 & 0 \\\\
420
+ 0 & 0 & 1 & 1 \\\\
421
+ 0 & 0 & 1 & -1
422
+ \\end{bmatrix}
423
+ $$
424
+
425
+ Args:
426
+ control: The control qubit.
427
+ target: The qubit to apply the Hadamard gate on.
428
+
429
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
430
+ """
431
+ pass
432
+
433
+
434
+ @qfunc(external=True)
435
+ def CX(control: QBit, target: QBit) -> None:
436
+ """
437
+ [Qmod core-library function]
438
+
439
+ Applies the Pauli-X gate to the target qubit, conditioned on the control qubit.
440
+
441
+ This operation is represented by the following matrix:
442
+
443
+ $$
444
+ CX = \\begin{bmatrix}
445
+ 1 & 0 & 0 & 0 \\\\
446
+ 0 & 1 & 0 & 0 \\\\
447
+ 0 & 0 & 0 & 1 \\\\
448
+ 0 & 0 & 1 & 0
449
+ \\end{bmatrix}
450
+ $$
451
+
452
+ Args:
453
+ control: The control qubit.
454
+ target: The qubit to apply the Pauli-X gate on.
455
+
456
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
457
+ """
458
+ pass
459
+
460
+
461
+ @qfunc(external=True)
462
+ def CY(control: QBit, target: QBit) -> None:
463
+ """
464
+ [Qmod core-library function]
465
+
466
+ Applies the Pauli-Y gate to the target qubit, conditioned on the control qubit.
467
+
468
+ This operation is represented by the following matrix:
469
+
470
+ $$
471
+ CY = \\begin{bmatrix}
472
+ 1 & 0 & 0 & 0 \\\\
473
+ 0 & 1 & 0 & 0 \\\\
474
+ 0 & 0 & 0 & -i \\\\
475
+ 0 & 0 & i & 0
476
+ \\end{bmatrix}
477
+ $$
478
+
479
+ Args:
480
+ control: The control qubit.
481
+ target: The qubit to apply the Pauli-Y gate on.
482
+
483
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
484
+ """
485
+ pass
486
+
487
+
488
+ @qfunc(external=True)
489
+ def CZ(control: QBit, target: QBit) -> None:
490
+ """
491
+ [Qmod core-library function]
492
+
493
+ Applies the Pauli-Z gate to the target qubit, conditioned on the control qubit.
494
+
495
+ This operation is represented by the following matrix:
496
+
497
+ $$
498
+ CZ = \\begin{bmatrix}
499
+ 1 & 0 & 0 & 0 \\\\
500
+ 0 & 1 & 0 & 0 \\\\
501
+ 0 & 0 & 1 & 0 \\\\
502
+ 0 & 0 & 0 & -1
503
+ \\end{bmatrix}
504
+ $$
505
+
506
+ Args:
507
+ control: The control qubit.
508
+ target: The qubit to apply the Pauli-Z gate on.
509
+
510
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
511
+ """
512
+ pass
513
+
514
+
515
+ @qfunc(external=True)
516
+ def CRX(theta: CReal, control: QBit, target: QBit) -> None:
517
+ """
518
+ [Qmod core-library function]
519
+
520
+ Applies the RX gate to the target qubit, conditioned on the control qubit.
521
+
522
+ This operation is represented by the following matrix:
523
+
524
+ $$
525
+ CRX = \\begin{bmatrix}
526
+ 1 & 0 & 0 & 0 \\\\
527
+ 0 & 1 & 0 & 0 \\\\
528
+ 0 & 0 & cos(\\frac{\\theta}{2}) & -i*sin(\\frac{\\theta}{2}) \\\\
529
+ 0 & 0 & -i*sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2})
530
+ \\end{bmatrix}
531
+ $$
532
+
533
+ Args:
534
+ theta: The rotation angle in radians.
535
+ control: The control qubit.
536
+ target: The qubit to apply the RX gate on.
537
+
538
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
539
+ """
540
+ pass
541
+
542
+
543
+ @qfunc(external=True)
544
+ def CRY(theta: CReal, control: QBit, target: QBit) -> None:
545
+ """
546
+ [Qmod core-library function]
547
+
548
+ Applies the RY gate to the target qubit, conditioned on the control qubit.
549
+
550
+ This operation is represented by the following matrix:
551
+
552
+ $$
553
+ CRY = \\begin{bmatrix}
554
+ 1 & 0 & 0 & 0 \\\\
555
+ 0 & 1 & 0 & 0 \\\\
556
+ 0 & 0 & cos(\\frac{\\theta}{2}) & -sin(\\frac{\\theta}{2}) \\\\
557
+ 0 & 0 & sin(\\frac{\\theta}{2}) & cos(\\frac{\\theta}{2})
558
+ \\end{bmatrix}
559
+ $$
560
+
561
+ Args:
562
+ theta (CReal): The rotation angle in radians.
563
+ control (QBit): The control qubit.
564
+ target (QBit): The qubit to apply the RY gate on.
565
+
566
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
567
+ """
568
+ pass
569
+
570
+
571
+ @qfunc(external=True)
572
+ def CRZ(theta: CReal, control: QBit, target: QBit) -> None:
573
+ """
574
+ [Qmod core-library function]
575
+
576
+ Applies the RZ gate to the target qubit, conditioned on the control qubit.
577
+
578
+ This operation is represented by the following matrix:
579
+
580
+ $$
581
+ CRZ = \\begin{bmatrix}
582
+ 1 & 0 & 0 & 0 \\\\
583
+ 0 & 1 & 0 & 0 \\\\
584
+ 0 & 0 & e^{-i\\frac{\\theta}{2}} & 0 \\\\
585
+ 0 & 0 & 0 & e^{i\\frac{\\theta}{2}}
586
+ \\end{bmatrix}
587
+ $$
588
+
589
+ Args:
590
+ theta (CReal): The rotation angle in radians.
591
+ control (QBit): The control qubit.
592
+ target (QBit): The qubit to apply the RZ gate on.
593
+
594
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
595
+ """
596
+ pass
597
+
598
+
599
+ @qfunc(external=True)
600
+ def CPHASE(theta: CReal, control: QBit, target: QBit) -> None:
601
+ """
602
+ [Qmod core-library function]
603
+
604
+ Applies the PHASE gate to the target qubit, conditioned on the control qubit.
605
+
606
+ This operation is represented by the following matrix:
607
+
608
+ $$
609
+ CPHASE = \\begin{bmatrix}
610
+ 1 & 0 & 0 & 0 \\\\
611
+ 0 & 1 & 0 & 0 \\\\
612
+ 0 & 0 & 1 & 0 \\\\
613
+ 0 & 0 & 0 & e^{i\\theta}
614
+ \\end{bmatrix}
615
+ $$
616
+
617
+ Args:
618
+ theta (CReal): The rotation angle in radians.
619
+ control (QBit): The control qubit.
620
+ target (QBit): The qubit to apply the PHASE gate on.
621
+
622
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
623
+ """
624
+ pass
625
+
626
+
627
+ @qfunc(external=True)
628
+ def SWAP(qbit0: QBit, qbit1: QBit) -> None:
629
+ """
630
+ [Qmod core-library function]
631
+
632
+ Swaps the states of two qubits.
633
+
634
+ This operation is represented by the following matrix:
635
+
636
+ $$
637
+ SWAP = \\begin{bmatrix}
638
+ 1 & 0 & 0 & 0 \\\\
639
+ 0 & 0 & 1 & 0 \\\\
640
+ 0 & 1 & 0 & 0 \\\\
641
+ 0 & 0 & 0 & 1
642
+ \\end{bmatrix}
643
+ $$
644
+
645
+ Args:
646
+ qbit0 (QBit): The first qubit.
647
+ qbit1 (QBit): The second qubit.
648
+
649
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
650
+ """
651
+ pass
652
+
653
+
654
+ @qfunc(external=True)
655
+ def IDENTITY(target: QArray[QBit]) -> None:
656
+ """
657
+ [Qmod core-library function]
658
+
659
+ Does nothing.
660
+
661
+ This operation is represented by the following matrix:
662
+
663
+ $$
664
+ IDENTITY = {\\begin{bmatrix}
665
+ 1 & 0 \\\\
666
+ 0 & 1
667
+ \\end{bmatrix}} ^{\\otimes n}
668
+ $$
669
+
670
+ Args:
671
+ target (QArray[QBit]): The qubits to apply the IDENTITY gate on.
672
+
673
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
674
+ """
675
+ pass
676
+
677
+
678
+ @qfunc(external=True)
679
+ def U(theta: CReal, phi: CReal, lam: CReal, gam: CReal, target: QBit) -> None:
680
+ """
681
+ [Qmod core-library function]
682
+
683
+ Performs a general single-qubit unitary gate that applies phase and rotation with three Euler angles on a qubit.
684
+
685
+ This operation is represented by the following matrix:
686
+
687
+ $$
688
+ U(\\theta, \\phi, \\lambda, \\gamma) = e^{i \\gamma}
689
+ \\begin{bmatrix}
690
+ cos(\\theta/2) & -e^{i(\\lambda)} sin(\\theta/2) \\\\
691
+ e^{i\\phi} sin(\\theta/2) & e^{i(\\phi + \\lambda)} cos(\\theta/2)
692
+ \\end{bmatrix}
693
+ $$
694
+
695
+ More information on this gate can be found on [Wikipedia](https://en.wikipedia.org/wiki/List_of_quantum_logic_gates#Other_named_gates).
696
+
697
+ Args:
698
+ theta (CReal): The first Euler angle in radians.
699
+ phi (CReal): The second Euler angle in radians.
700
+ lam (CReal): The third Euler angle in radians.
701
+ gam (CReal): The global phase angle in radians.
702
+ target (QBit): The qubit to apply the general single-qubit unitary gate to.
703
+
704
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
705
+ """
706
+ pass
707
+
708
+
709
+ @qfunc(external=True)
710
+ def CCX(control: QArray[QBit, Literal[2]], target: QBit) -> None:
711
+ """
712
+ [Qmod core-library function]
713
+
714
+ Applies the Pauli-X gate to the target qubit, conditioned on the two control qubits (Toffoli).
715
+
716
+ This operation is represented by the following matrix:
717
+
718
+ $$
719
+ CCX = \\begin{bmatrix}
720
+ 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\
721
+ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\\\
722
+ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\\\
723
+ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\\\
724
+ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\\\
725
+ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\\\
726
+ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\\\
727
+ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
728
+ \\end{bmatrix}
729
+ $$
730
+
731
+ More information can be found on [Wikipedia](https://en.wikipedia.org/wiki/Toffoli_gate).
732
+
733
+ Args:
734
+ control (QArray[QBit, Literal[2]]): The control qubits.
735
+ target (QBit): The qubit to apply the conditioned Pauli-X gate on.
736
+
737
+ Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
738
+ """
739
+ pass