classiq 0.93.0__py3-none-any.whl → 0.99.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.
- classiq/__init__.py +11 -19
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +7 -7
- classiq/_analyzer_extras/interactive_hardware.py +19 -12
- classiq/_internals/api_wrapper.py +31 -142
- classiq/_internals/async_utils.py +4 -7
- classiq/_internals/authentication/auth0.py +41 -15
- classiq/_internals/authentication/authorization_code.py +9 -0
- classiq/_internals/authentication/authorization_flow.py +41 -0
- classiq/_internals/authentication/device.py +33 -52
- classiq/_internals/authentication/hybrid_flow.py +19 -0
- classiq/_internals/authentication/password_manager.py +13 -13
- classiq/_internals/authentication/token_manager.py +9 -9
- classiq/_internals/client.py +17 -44
- classiq/_internals/config.py +19 -5
- classiq/_internals/help.py +1 -2
- classiq/_internals/host_checker.py +3 -3
- classiq/_internals/jobs.py +14 -14
- classiq/_internals/type_validation.py +3 -3
- classiq/analyzer/analyzer.py +18 -18
- classiq/analyzer/rb.py +17 -8
- classiq/analyzer/show_interactive_hack.py +1 -1
- classiq/applications/__init__.py +2 -2
- classiq/applications/chemistry/__init__.py +0 -30
- classiq/applications/chemistry/op_utils.py +4 -4
- classiq/applications/chemistry/problems.py +3 -3
- classiq/applications/chemistry/ucc.py +1 -2
- classiq/applications/chemistry/z2_symmetries.py +4 -4
- classiq/applications/combinatorial_helpers/allowed_constraints.py +1 -3
- classiq/applications/combinatorial_helpers/arithmetic/arithmetic_expression.py +2 -1
- classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +2 -2
- classiq/applications/combinatorial_helpers/encoding_mapping.py +2 -3
- classiq/applications/combinatorial_helpers/encoding_utils.py +2 -2
- classiq/applications/combinatorial_helpers/optimization_model.py +3 -4
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +2 -2
- classiq/applications/combinatorial_helpers/pyomo_utils.py +8 -8
- classiq/applications/combinatorial_helpers/sympy_utils.py +1 -3
- classiq/applications/combinatorial_helpers/transformations/encoding.py +3 -3
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +1 -2
- classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -3
- classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +4 -6
- classiq/applications/combinatorial_optimization/combinatorial_problem.py +15 -10
- classiq/applications/hamiltonian/pauli_decomposition.py +6 -4
- classiq/applications/iqae/iqae.py +14 -11
- classiq/applications/qnn/datasets/dataset_base_classes.py +6 -6
- classiq/applications/qnn/datasets/dataset_parity.py +6 -6
- classiq/applications/qnn/gradients/simple_quantum_gradient.py +1 -1
- classiq/applications/qnn/qlayer.py +9 -8
- classiq/applications/qnn/torch_utils.py +5 -6
- classiq/applications/qnn/types.py +2 -1
- classiq/applications/qsp/__init__.py +20 -2
- classiq/applications/qsp/qsp.py +238 -10
- classiq/applications/qsvm/qsvm_data_generation.py +1 -2
- classiq/evaluators/classical_expression.py +0 -4
- classiq/evaluators/parameter_types.py +10 -8
- classiq/evaluators/qmod_annotated_expression.py +31 -26
- classiq/evaluators/qmod_expression_visitors/qmod_expression_evaluator.py +14 -14
- classiq/evaluators/qmod_expression_visitors/qmod_expression_simplifier.py +2 -1
- classiq/evaluators/qmod_expression_visitors/sympy_wrappers.py +8 -8
- classiq/evaluators/qmod_node_evaluators/binary_op_evaluation.py +4 -4
- classiq/evaluators/qmod_node_evaluators/classical_function_evaluation.py +14 -4
- classiq/evaluators/qmod_node_evaluators/list_evaluation.py +2 -2
- classiq/evaluators/qmod_node_evaluators/numeric_attrs_utils.py +3 -3
- classiq/evaluators/qmod_node_evaluators/subscript_evaluation.py +9 -9
- classiq/evaluators/qmod_node_evaluators/utils.py +6 -6
- classiq/evaluators/qmod_type_inference/classical_type_inference.py +9 -10
- classiq/evaluators/qmod_type_inference/quantum_type_inference.py +5 -5
- classiq/execution/__init__.py +0 -3
- classiq/execution/execution_session.py +28 -21
- classiq/execution/jobs.py +26 -26
- classiq/execution/qnn.py +1 -2
- classiq/execution/user_budgets.py +71 -37
- classiq/executor.py +1 -3
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +4 -4
- classiq/interface/analyzer/cytoscape_graph.py +3 -3
- classiq/interface/analyzer/result.py +4 -4
- classiq/interface/ast_node.py +3 -3
- classiq/interface/backend/backend_preferences.py +26 -50
- classiq/interface/backend/ionq/ionq_quantum_program.py +5 -5
- classiq/interface/backend/provider_config/__init__.py +0 -0
- classiq/interface/backend/provider_config/provider_config.py +8 -0
- classiq/interface/backend/provider_config/providers/__init__.py +0 -0
- classiq/interface/backend/provider_config/providers/alice_bob.py +47 -0
- classiq/interface/backend/provider_config/providers/aqt.py +16 -0
- classiq/interface/backend/provider_config/providers/azure.py +37 -0
- classiq/interface/backend/provider_config/providers/braket.py +39 -0
- classiq/interface/backend/provider_config/providers/ibm.py +26 -0
- classiq/interface/backend/provider_config/providers/ionq.py +22 -0
- classiq/interface/backend/quantum_backend_providers.py +20 -2
- classiq/interface/chemistry/ansatz_library.py +3 -5
- classiq/interface/chemistry/operator.py +3 -3
- classiq/interface/combinatorial_optimization/examples/knapsack.py +2 -4
- classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +1 -2
- classiq/interface/compression_utils.py +2 -3
- classiq/interface/debug_info/debug_info.py +8 -7
- classiq/interface/exceptions.py +6 -7
- classiq/interface/execution/primitives.py +6 -6
- classiq/interface/executor/estimate_cost.py +1 -1
- classiq/interface/executor/execution_preferences.py +3 -5
- classiq/interface/executor/execution_request.py +10 -10
- classiq/interface/executor/execution_result.py +1 -2
- classiq/interface/executor/quantum_code.py +8 -8
- classiq/interface/executor/result.py +28 -18
- classiq/interface/executor/user_budget.py +25 -17
- classiq/interface/executor/vqe_result.py +5 -6
- classiq/interface/generator/ansatz_library.py +6 -8
- classiq/interface/generator/application_apis/__init__.py +0 -3
- classiq/interface/generator/arith/arithmetic.py +2 -2
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +2 -3
- classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -5
- classiq/interface/generator/arith/arithmetic_expression_parser.py +11 -4
- classiq/interface/generator/arith/arithmetic_expression_validator.py +12 -15
- classiq/interface/generator/arith/arithmetic_operations.py +4 -6
- classiq/interface/generator/arith/arithmetic_param_getters.py +70 -107
- classiq/interface/generator/arith/arithmetic_result_builder.py +4 -4
- classiq/interface/generator/arith/ast_node_rewrite.py +8 -4
- classiq/interface/generator/arith/binary_ops.py +15 -40
- classiq/interface/generator/arith/logical_ops.py +2 -3
- classiq/interface/generator/arith/number_utils.py +2 -2
- classiq/interface/generator/arith/register_user_input.py +3 -3
- classiq/interface/generator/arith/unary_ops.py +2 -2
- classiq/interface/generator/circuit_code/circuit_code.py +8 -10
- classiq/interface/generator/circuit_code/types_and_constants.py +1 -1
- classiq/interface/generator/complex_type.py +2 -2
- classiq/interface/generator/copy.py +1 -3
- classiq/interface/generator/expressions/atomic_expression_functions.py +0 -5
- classiq/interface/generator/expressions/evaluated_expression.py +2 -3
- classiq/interface/generator/expressions/expression.py +2 -2
- classiq/interface/generator/expressions/proxies/classical/classical_array_proxy.py +4 -7
- classiq/interface/generator/function_param_list.py +0 -40
- classiq/interface/generator/function_params.py +5 -6
- classiq/interface/generator/functions/classical_function_declaration.py +2 -2
- classiq/interface/generator/functions/classical_type.py +3 -3
- classiq/interface/generator/functions/type_modifier.py +0 -15
- classiq/interface/generator/functions/type_name.py +2 -2
- classiq/interface/generator/generated_circuit_data.py +14 -18
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +2 -4
- classiq/interface/generator/hardware/hardware_data.py +8 -8
- classiq/interface/generator/hardware_efficient_ansatz.py +9 -9
- classiq/interface/generator/mcu.py +3 -3
- classiq/interface/generator/mcx.py +3 -3
- classiq/interface/generator/model/constraints.py +34 -5
- classiq/interface/generator/model/preferences/preferences.py +15 -21
- classiq/interface/generator/model/quantum_register.py +7 -10
- classiq/interface/generator/noise_properties.py +3 -7
- classiq/interface/generator/parameters.py +1 -1
- classiq/interface/generator/partitioned_register.py +1 -2
- classiq/interface/generator/preferences/qasm_to_qmod_params.py +11 -0
- classiq/interface/generator/quantum_function_call.py +9 -12
- classiq/interface/generator/quantum_program.py +10 -23
- classiq/interface/generator/range_types.py +3 -3
- classiq/interface/generator/slice_parsing_utils.py +4 -5
- classiq/interface/generator/standard_gates/standard_gates.py +2 -4
- classiq/interface/generator/synthesis_execution_parameter.py +1 -3
- classiq/interface/generator/synthesis_metadata/synthesis_duration.py +9 -0
- classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +2 -3
- classiq/interface/generator/transpiler_basis_gates.py +12 -4
- classiq/interface/generator/types/builtin_enum_declarations.py +0 -145
- classiq/interface/generator/types/compilation_metadata.py +12 -1
- classiq/interface/generator/types/enum_declaration.py +2 -1
- classiq/interface/generator/validations/flow_graph.py +3 -3
- classiq/interface/generator/visitor.py +10 -12
- classiq/interface/hardware.py +2 -3
- classiq/interface/helpers/classproperty.py +2 -2
- classiq/interface/helpers/custom_encoders.py +2 -1
- classiq/interface/helpers/custom_pydantic_types.py +1 -1
- classiq/interface/helpers/text_utils.py +1 -4
- classiq/interface/ide/visual_model.py +6 -5
- classiq/interface/interface_version.py +1 -1
- classiq/interface/jobs.py +3 -3
- classiq/interface/model/allocate.py +4 -4
- classiq/interface/model/block.py +6 -2
- classiq/interface/model/bounds.py +3 -3
- classiq/interface/model/classical_if.py +4 -0
- classiq/interface/model/control.py +8 -1
- classiq/interface/model/inplace_binary_operation.py +2 -2
- classiq/interface/model/invert.py +4 -0
- classiq/interface/model/model.py +4 -4
- classiq/interface/model/model_visitor.py +40 -1
- classiq/interface/model/parameter.py +1 -3
- classiq/interface/model/port_declaration.py +1 -1
- classiq/interface/model/power.py +4 -0
- classiq/interface/model/quantum_expressions/quantum_expression.py +1 -2
- classiq/interface/model/quantum_function_call.py +3 -6
- classiq/interface/model/quantum_function_declaration.py +1 -0
- classiq/interface/model/quantum_lambda_function.py +4 -4
- classiq/interface/model/quantum_statement.py +11 -4
- classiq/interface/model/quantum_type.py +14 -14
- classiq/interface/model/repeat.py +4 -0
- classiq/interface/model/skip_control.py +4 -0
- classiq/interface/model/validation_handle.py +2 -3
- classiq/interface/model/variable_declaration_statement.py +2 -2
- classiq/interface/model/within_apply_operation.py +4 -0
- classiq/interface/pretty_print/expression_to_qmod.py +3 -4
- classiq/interface/server/routes.py +0 -16
- classiq/interface/source_reference.py +3 -4
- classiq/model_expansions/arithmetic.py +11 -7
- classiq/model_expansions/arithmetic_compute_result_attrs.py +30 -27
- classiq/model_expansions/capturing/captured_vars.py +3 -3
- classiq/model_expansions/capturing/mangling_utils.py +1 -2
- classiq/model_expansions/closure.py +12 -11
- classiq/model_expansions/function_builder.py +14 -6
- classiq/model_expansions/generative_functions.py +7 -12
- classiq/model_expansions/interpreters/base_interpreter.py +3 -7
- classiq/model_expansions/interpreters/frontend_generative_interpreter.py +2 -1
- classiq/model_expansions/interpreters/generative_interpreter.py +5 -3
- classiq/model_expansions/quantum_operations/allocate.py +4 -4
- classiq/model_expansions/quantum_operations/assignment_result_processor.py +2 -4
- classiq/model_expansions/quantum_operations/call_emitter.py +31 -37
- classiq/model_expansions/quantum_operations/declarative_call_emitter.py +2 -2
- classiq/model_expansions/quantum_operations/emitter.py +3 -5
- classiq/model_expansions/quantum_operations/expression_evaluator.py +3 -3
- classiq/model_expansions/quantum_operations/skip_control_verifier.py +1 -2
- classiq/model_expansions/quantum_operations/variable_decleration.py +2 -2
- classiq/model_expansions/scope.py +7 -7
- classiq/model_expansions/scope_initialization.py +4 -0
- classiq/model_expansions/visitors/symbolic_param_inference.py +6 -6
- classiq/model_expansions/visitors/uncomputation_signature_inference.py +328 -0
- classiq/model_expansions/visitors/variable_references.py +15 -14
- classiq/open_library/functions/__init__.py +28 -11
- classiq/open_library/functions/amplitude_loading.py +81 -0
- classiq/open_library/functions/discrete_sine_cosine_transform.py +5 -5
- classiq/open_library/functions/grover.py +8 -10
- classiq/open_library/functions/lcu.py +47 -18
- classiq/open_library/functions/modular_exponentiation.py +93 -8
- classiq/open_library/functions/qsvt.py +66 -79
- classiq/open_library/functions/qsvt_temp.py +536 -0
- classiq/open_library/functions/state_preparation.py +130 -27
- classiq/qmod/__init__.py +6 -4
- classiq/qmod/builtins/classical_execution_primitives.py +4 -23
- classiq/qmod/builtins/classical_functions.py +1 -42
- classiq/qmod/builtins/enums.py +15 -153
- classiq/qmod/builtins/functions/__init__.py +9 -18
- classiq/qmod/builtins/functions/allocation.py +25 -4
- classiq/qmod/builtins/functions/arithmetic.py +22 -27
- classiq/qmod/builtins/functions/exponentiation.py +51 -2
- classiq/qmod/builtins/functions/mcx_func.py +7 -0
- classiq/qmod/builtins/functions/standard_gates.py +46 -27
- classiq/qmod/builtins/operations.py +165 -79
- classiq/qmod/builtins/structs.py +24 -91
- classiq/qmod/cfunc.py +3 -2
- classiq/qmod/classical_function.py +2 -1
- classiq/qmod/cparam.py +2 -8
- classiq/qmod/create_model_function.py +7 -7
- classiq/qmod/declaration_inferrer.py +33 -30
- classiq/qmod/expression_query.py +7 -4
- classiq/qmod/model_state_container.py +2 -2
- classiq/qmod/native/pretty_printer.py +25 -14
- classiq/qmod/pretty_print/expression_to_python.py +5 -3
- classiq/qmod/pretty_print/pretty_printer.py +39 -17
- classiq/qmod/python_classical_type.py +40 -13
- classiq/qmod/qfunc.py +124 -19
- classiq/qmod/qmod_constant.py +2 -2
- classiq/qmod/qmod_parameter.py +5 -2
- classiq/qmod/qmod_variable.py +47 -46
- classiq/qmod/quantum_callable.py +18 -13
- classiq/qmod/quantum_expandable.py +31 -26
- classiq/qmod/quantum_function.py +84 -36
- classiq/qmod/semantics/annotation/call_annotation.py +5 -5
- classiq/qmod/semantics/error_manager.py +12 -14
- classiq/qmod/semantics/lambdas.py +1 -2
- classiq/qmod/semantics/validation/types_validation.py +1 -2
- classiq/qmod/symbolic.py +2 -4
- classiq/qmod/utilities.py +13 -20
- classiq/qmod/write_qmod.py +3 -4
- classiq/quantum_program.py +1 -3
- classiq/synthesis.py +11 -7
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/METADATA +2 -3
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/RECORD +271 -299
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/WHEEL +1 -1
- classiq/applications/chemistry/ansatz_parameters.py +0 -29
- classiq/applications/chemistry/chemistry_execution_parameters.py +0 -16
- classiq/applications/chemistry/chemistry_model_constructor.py +0 -532
- classiq/applications/chemistry/ground_state_problem.py +0 -42
- classiq/applications/qsvm/__init__.py +0 -8
- classiq/applications/qsvm/qsvm.py +0 -11
- classiq/evaluators/qmod_expression_visitors/qmod_expression_bwc.py +0 -129
- classiq/execution/iqcc.py +0 -128
- classiq/interface/applications/qsvm.py +0 -117
- classiq/interface/chemistry/elements.py +0 -120
- classiq/interface/chemistry/fermionic_operator.py +0 -208
- classiq/interface/chemistry/ground_state_problem.py +0 -132
- classiq/interface/chemistry/ground_state_result.py +0 -8
- classiq/interface/chemistry/molecule.py +0 -71
- classiq/interface/execution/iqcc.py +0 -44
- classiq/interface/generator/application_apis/chemistry_declarations.py +0 -69
- classiq/interface/generator/application_apis/entangler_declarations.py +0 -29
- classiq/interface/generator/application_apis/qsvm_declarations.py +0 -6
- classiq/interface/generator/chemistry_function_params.py +0 -50
- classiq/interface/generator/entangler_params.py +0 -72
- classiq/interface/generator/entanglers.py +0 -14
- classiq/interface/generator/hamiltonian_evolution/qdrift.py +0 -27
- classiq/interface/generator/hartree_fock.py +0 -26
- classiq/interface/generator/hva.py +0 -22
- classiq/interface/generator/linear_pauli_rotations.py +0 -92
- classiq/interface/generator/qft.py +0 -37
- classiq/interface/generator/qsvm.py +0 -96
- classiq/interface/generator/state_preparation/__init__.py +0 -14
- classiq/interface/generator/state_preparation/bell_state_preparation.py +0 -27
- classiq/interface/generator/state_preparation/computational_basis_state_preparation.py +0 -28
- classiq/interface/generator/state_preparation/distributions.py +0 -53
- classiq/interface/generator/state_preparation/exponential_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/ghz_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/metrics.py +0 -41
- classiq/interface/generator/state_preparation/state_preparation.py +0 -113
- classiq/interface/generator/state_preparation/state_preparation_abc.py +0 -24
- classiq/interface/generator/state_preparation/uniform_distibution_state_preparation.py +0 -13
- classiq/interface/generator/state_preparation/w_state_preparation.py +0 -13
- classiq/interface/generator/ucc.py +0 -74
- classiq/interface/helpers/backward_compatibility.py +0 -9
- classiq/model_expansions/transformers/type_modifier_inference.py +0 -392
- classiq/open_library/functions/lookup_table.py +0 -58
- classiq/qmod/builtins/functions/chemistry.py +0 -123
- classiq/qmod/builtins/functions/qsvm.py +0 -24
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -17,19 +17,22 @@ from classiq.qmod.builtins.functions import (
|
|
|
17
17
|
RY,
|
|
18
18
|
H,
|
|
19
19
|
X,
|
|
20
|
+
free,
|
|
20
21
|
inplace_prepare_amplitudes,
|
|
21
22
|
)
|
|
22
23
|
from classiq.qmod.builtins.operations import (
|
|
23
24
|
allocate,
|
|
25
|
+
bind,
|
|
24
26
|
control,
|
|
25
27
|
if_,
|
|
26
28
|
inplace_add,
|
|
27
29
|
inplace_xor,
|
|
30
|
+
invert,
|
|
28
31
|
repeat,
|
|
29
32
|
within_apply,
|
|
30
33
|
)
|
|
31
34
|
from classiq.qmod.cparam import CArray, CInt, CReal
|
|
32
|
-
from classiq.qmod.qfunc import qfunc
|
|
35
|
+
from classiq.qmod.qfunc import qfunc, qperm
|
|
33
36
|
from classiq.qmod.qmod_variable import Output, QArray, QBit, QNum
|
|
34
37
|
from classiq.qmod.symbolic import (
|
|
35
38
|
acos,
|
|
@@ -248,7 +251,7 @@ def prepare_bell_state(
|
|
|
248
251
|
CX(qpair[0], qpair[1])
|
|
249
252
|
|
|
250
253
|
|
|
251
|
-
@
|
|
254
|
+
@qperm
|
|
252
255
|
def inplace_prepare_int(value: CInt, target: QNum) -> None:
|
|
253
256
|
"""
|
|
254
257
|
[Qmod Classiq-library function]
|
|
@@ -273,7 +276,7 @@ def inplace_prepare_int(value: CInt, target: QNum) -> None:
|
|
|
273
276
|
target ^= value
|
|
274
277
|
|
|
275
278
|
|
|
276
|
-
@
|
|
279
|
+
@qperm
|
|
277
280
|
def prepare_int(
|
|
278
281
|
value: CInt,
|
|
279
282
|
out: Output[QNum[Literal["floor(log(value, 2)) + 1"]]],
|
|
@@ -324,7 +327,7 @@ def _classical_hadamard_transform(arr: list[float]) -> np.ndarray:
|
|
|
324
327
|
return 1 / np.sqrt(len(arr)) * np.array(sympy.fwht(np.array(arr)))
|
|
325
328
|
|
|
326
329
|
|
|
327
|
-
@
|
|
330
|
+
@qperm
|
|
328
331
|
def apply_phase_table(
|
|
329
332
|
phases: list[float],
|
|
330
333
|
target: QArray[QBit, Literal["log(phases.len, 2)"]],
|
|
@@ -456,7 +459,7 @@ def prepare_dicke_state(k: int, qvar: QArray[QBit]) -> None:
|
|
|
456
459
|
prepare_dicke_state_unary_input(k, qvar)
|
|
457
460
|
|
|
458
461
|
|
|
459
|
-
@
|
|
462
|
+
@qperm
|
|
460
463
|
def prepare_basis_state(state: list[bool], arr: Output[QArray]) -> None:
|
|
461
464
|
"""
|
|
462
465
|
[Qmod Classiq-library function]
|
|
@@ -515,7 +518,7 @@ def prepare_linear_amplitudes(x: QArray) -> None:
|
|
|
515
518
|
hadamard_transform(x)
|
|
516
519
|
|
|
517
520
|
|
|
518
|
-
@
|
|
521
|
+
@qperm
|
|
519
522
|
def swap_states(a: int, b: int, target: QArray) -> None:
|
|
520
523
|
"""
|
|
521
524
|
Swap 2 computational basis states a and b, leave all other states untouched.
|
|
@@ -538,7 +541,7 @@ def swap_states(a: int, b: int, target: QArray) -> None:
|
|
|
538
541
|
if anchor < target.len - 1:
|
|
539
542
|
target_without_anchor.append(target[anchor + 1 : target.len])
|
|
540
543
|
|
|
541
|
-
@
|
|
544
|
+
@qperm
|
|
542
545
|
def _xor_if_equal(n: CInt, ctrl: QNum, target: QBit) -> None:
|
|
543
546
|
target ^= ctrl == n
|
|
544
547
|
|
|
@@ -564,6 +567,115 @@ def swap_states(a: int, b: int, target: QArray) -> None:
|
|
|
564
567
|
)
|
|
565
568
|
|
|
566
569
|
|
|
570
|
+
@qperm
|
|
571
|
+
def _controlled_xor(
|
|
572
|
+
target: QNum, target_value: CInt, ctrl: QNum, ctrl_value: CInt
|
|
573
|
+
) -> None:
|
|
574
|
+
control(ctrl == ctrl_value, lambda: inplace_xor(target_value, target))
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
@qperm
|
|
578
|
+
def _inplace_xor(i: CInt, target: QNum) -> None:
|
|
579
|
+
inplace_xor(i, target)
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
def _update_states(
|
|
583
|
+
states: list[int],
|
|
584
|
+
q: QArray,
|
|
585
|
+
assignment_indices: list[int],
|
|
586
|
+
assignment_value: int,
|
|
587
|
+
pivot_indices: list[int],
|
|
588
|
+
pivot_value: int,
|
|
589
|
+
) -> None:
|
|
590
|
+
_controlled_xor(
|
|
591
|
+
[q[i] for i in assignment_indices],
|
|
592
|
+
assignment_value,
|
|
593
|
+
[q[i] for i in pivot_indices],
|
|
594
|
+
pivot_value,
|
|
595
|
+
)
|
|
596
|
+
for j in range(len(states)):
|
|
597
|
+
s = states[j]
|
|
598
|
+
ctrl_bits = sum(((s >> i) & 1) << k for k, i in enumerate(pivot_indices))
|
|
599
|
+
if ctrl_bits == pivot_value:
|
|
600
|
+
for k, i in enumerate(assignment_indices):
|
|
601
|
+
if (assignment_value >> k) & 1:
|
|
602
|
+
s ^= 1 << i
|
|
603
|
+
|
|
604
|
+
states[j] = s
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
@qperm
|
|
608
|
+
def pack_amplitudes(states: list[int], target: QArray) -> None:
|
|
609
|
+
"""
|
|
610
|
+
[Qmod Classiq-library function]
|
|
611
|
+
|
|
612
|
+
Perform the inverse operation for sparse state preparation - for each given state in `states`,
|
|
613
|
+
move it to the first available computational basis state, according to the order in the array.
|
|
614
|
+
The function does not guarantee what happens to the other states which are not in the list.
|
|
615
|
+
|
|
616
|
+
Args:
|
|
617
|
+
states: A list of distinct computational basis indices to pack. The order of the list will
|
|
618
|
+
reflect the order of the packed states.
|
|
619
|
+
target: The quantum variable to act upon. Assumed to be larged enough to populate all given `states`,
|
|
620
|
+
and at least of size `2 * len(states)`.
|
|
621
|
+
"""
|
|
622
|
+
target_size = target.len
|
|
623
|
+
|
|
624
|
+
# handle the dense case by using an additional auxilliary qubit
|
|
625
|
+
if len(states) > 2 ** (target_size - 1):
|
|
626
|
+
# allocate a pivot
|
|
627
|
+
p = QBit()
|
|
628
|
+
p |= 0
|
|
629
|
+
temp_target: QArray = QArray("extended_target")
|
|
630
|
+
bind([target, p], temp_target)
|
|
631
|
+
# replace register to unify the different flows
|
|
632
|
+
target, temp_target = temp_target, target
|
|
633
|
+
|
|
634
|
+
for index, _ in enumerate(states):
|
|
635
|
+
state = states[
|
|
636
|
+
index
|
|
637
|
+
] # access this way because `states` is changing in each iteration
|
|
638
|
+
|
|
639
|
+
if state == index:
|
|
640
|
+
continue # nothing to do
|
|
641
|
+
|
|
642
|
+
if index == 0:
|
|
643
|
+
_inplace_xor(state, target)
|
|
644
|
+
states = [s ^ state for s in states]
|
|
645
|
+
continue
|
|
646
|
+
|
|
647
|
+
# if no pivot, create one:
|
|
648
|
+
if state < 2 ** index.bit_length():
|
|
649
|
+
pivot = index.bit_length()
|
|
650
|
+
_update_states(states, target, [pivot], 1, list(range(pivot)), state)
|
|
651
|
+
else:
|
|
652
|
+
pivot = state.bit_length() - 1
|
|
653
|
+
|
|
654
|
+
# use the pivot to update the quantum array
|
|
655
|
+
_update_states(
|
|
656
|
+
states,
|
|
657
|
+
target,
|
|
658
|
+
list(range(pivot)),
|
|
659
|
+
(state % (1 << pivot)) ^ index,
|
|
660
|
+
[pivot],
|
|
661
|
+
1,
|
|
662
|
+
)
|
|
663
|
+
|
|
664
|
+
# finally clean the pivot
|
|
665
|
+
if index == 2 ** (index.bit_length() - 1) and pivot < target_size:
|
|
666
|
+
# this specific case requires only a single ctrl qubit for the cleaning
|
|
667
|
+
# It won't work though if the auxilliary is used
|
|
668
|
+
_update_states(states, target, [pivot], 1, [index.bit_length() - 1], 1)
|
|
669
|
+
else:
|
|
670
|
+
_update_states(
|
|
671
|
+
states, target, [pivot], 1, list(range(index.bit_length())), index
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
if len(states) > 2 ** (target_size - 1):
|
|
675
|
+
bind(target, [temp_target, p])
|
|
676
|
+
free(p)
|
|
677
|
+
|
|
678
|
+
|
|
567
679
|
@qfunc
|
|
568
680
|
def inplace_prepare_sparse_amplitudes(
|
|
569
681
|
states: list[int], amplitudes: list[complex], target: QArray
|
|
@@ -596,32 +708,23 @@ def inplace_prepare_sparse_amplitudes(
|
|
|
596
708
|
dense_size = max(int(np.ceil(np.log2(len(states)))), 1)
|
|
597
709
|
dense_amplitudes = np.zeros(2**dense_size, dtype=complex)
|
|
598
710
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if state < len(dense_amplitudes):
|
|
711
|
+
if max(states) < 2**dense_size:
|
|
712
|
+
for i, state in enumerate(states):
|
|
602
713
|
dense_amplitudes[state] = amplitudes[i]
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
for i, state in enumerate(states):
|
|
608
|
-
if state < len(dense_amplitudes):
|
|
609
|
-
continue # already populated
|
|
610
|
-
while dense_amplitudes[free_index]:
|
|
611
|
-
free_index += 1 # index is not free
|
|
612
|
-
|
|
613
|
-
dense_amplitudes[free_index] = amplitudes[i]
|
|
614
|
-
swap_list.append((free_index, state))
|
|
615
|
-
free_index += 1
|
|
714
|
+
else:
|
|
715
|
+
dense_amplitudes = np.pad(
|
|
716
|
+
amplitudes, (0, 2**dense_size - len(amplitudes)), "constant"
|
|
717
|
+
)
|
|
616
718
|
|
|
617
719
|
inplace_prepare_complex_amplitudes(
|
|
618
720
|
np.abs(dense_amplitudes), np.angle(dense_amplitudes), target[0:dense_size]
|
|
619
721
|
)
|
|
620
722
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
723
|
+
if max(states) < 2**dense_size:
|
|
724
|
+
return
|
|
725
|
+
|
|
726
|
+
# Shuffle states to the desired position using the inverse operation of packing them
|
|
727
|
+
invert(lambda: pack_amplitudes(states, target))
|
|
625
728
|
|
|
626
729
|
|
|
627
730
|
@qfunc
|
classiq/qmod/__init__.py
CHANGED
|
@@ -4,11 +4,11 @@ from .cfunc import cfunc
|
|
|
4
4
|
from .classical_variable import measure
|
|
5
5
|
from .create_model_function import create_model
|
|
6
6
|
from .expression_query import get_expression_numeric_attributes
|
|
7
|
-
from .qfunc import qfunc
|
|
7
|
+
from .qfunc import qfunc, qperm
|
|
8
8
|
from .qmod_constant import QConstant
|
|
9
9
|
from .qmod_parameter import Array, CArray, CBool, CInt, CReal
|
|
10
|
-
from .qmod_variable import Const, Input, Output,
|
|
11
|
-
from .quantum_callable import QCallable, QCallableList
|
|
10
|
+
from .qmod_variable import Const, Input, Output, QArray, QBit, QNum, QStruct
|
|
11
|
+
from .quantum_callable import QCallable, QCallableList, QPerm, QPermList
|
|
12
12
|
from .write_qmod import write_qmod
|
|
13
13
|
|
|
14
14
|
__all__ = [
|
|
@@ -20,18 +20,20 @@ __all__ = [
|
|
|
20
20
|
"Input",
|
|
21
21
|
"Output",
|
|
22
22
|
"Const",
|
|
23
|
-
"Permutable",
|
|
24
23
|
"QArray",
|
|
25
24
|
"QBit",
|
|
26
25
|
"QNum",
|
|
27
26
|
"QCallable",
|
|
28
27
|
"QCallableList",
|
|
29
28
|
"QConstant",
|
|
29
|
+
"QPerm",
|
|
30
|
+
"QPermList",
|
|
30
31
|
"QStruct",
|
|
31
32
|
"cfunc",
|
|
32
33
|
"create_model",
|
|
33
34
|
"measure",
|
|
34
35
|
"get_expression_numeric_attributes",
|
|
35
36
|
"qfunc",
|
|
37
|
+
"qperm",
|
|
36
38
|
"write_qmod",
|
|
37
39
|
] + _builtins_all
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Final
|
|
1
|
+
from typing import Final
|
|
2
2
|
|
|
3
3
|
from classiq.interface.applications.iqae.iqae_result import IQAEResult
|
|
4
4
|
from classiq.interface.exceptions import ClassiqError
|
|
@@ -13,7 +13,6 @@ from classiq.interface.executor.result import (
|
|
|
13
13
|
from classiq.interface.executor.vqe_result import VQESolverResult
|
|
14
14
|
from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
|
|
15
15
|
|
|
16
|
-
from classiq.applications.qsvm.qsvm import Data, Labels
|
|
17
16
|
from classiq.qmod.builtins.enums import Optimizer
|
|
18
17
|
|
|
19
18
|
_CALL_IN_QFUNC_ERROR = (
|
|
@@ -32,7 +31,7 @@ def save(values_to_save: dict) -> None:
|
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
def sample( # type: ignore[return]
|
|
35
|
-
execution_params:
|
|
34
|
+
execution_params: ExecutionParams | None = None,
|
|
36
35
|
) -> ExecutionDetails:
|
|
37
36
|
_raise_error("sample")
|
|
38
37
|
|
|
@@ -44,7 +43,7 @@ def batch_sample( # type: ignore[return]
|
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
def estimate( # type: ignore[return]
|
|
47
|
-
hamiltonian: list[QmodPyStruct], execution_params:
|
|
46
|
+
hamiltonian: list[QmodPyStruct], execution_params: ExecutionParams | None = None
|
|
48
47
|
) -> EstimationResult:
|
|
49
48
|
_raise_error("estimate")
|
|
50
49
|
|
|
@@ -78,38 +77,20 @@ def qae_with_qpe_result_post_processing( # type: ignore[return]
|
|
|
78
77
|
_raise_error("qae_with_qpe_result_post_processing")
|
|
79
78
|
|
|
80
79
|
|
|
81
|
-
def qsvm_full_run( # type: ignore[return]
|
|
82
|
-
train_data: Data,
|
|
83
|
-
train_labels: Labels,
|
|
84
|
-
test_data: Data,
|
|
85
|
-
test_labels: Labels,
|
|
86
|
-
predict_data: Data,
|
|
87
|
-
) -> QmodPyStruct:
|
|
88
|
-
_raise_error("qsvm_full_run")
|
|
89
|
-
|
|
90
|
-
|
|
91
80
|
def iqae( # type: ignore[return]
|
|
92
81
|
epsilon: float,
|
|
93
82
|
alpha: float,
|
|
94
|
-
execution_params:
|
|
83
|
+
execution_params: ExecutionParams | None = None,
|
|
95
84
|
) -> IQAEResult:
|
|
96
85
|
_raise_error("iqae")
|
|
97
86
|
|
|
98
87
|
|
|
99
|
-
def molecule_ground_state_solution_post_process( # type: ignore[return]
|
|
100
|
-
problem: QmodPyStruct, vqe_result: VQESolverResult
|
|
101
|
-
) -> QmodPyStruct:
|
|
102
|
-
_raise_error("molecule_ground_state_solution_post_process")
|
|
103
|
-
|
|
104
|
-
|
|
105
88
|
__all__ = [
|
|
106
89
|
"batch_estimate",
|
|
107
90
|
"batch_sample",
|
|
108
91
|
"estimate",
|
|
109
92
|
"iqae",
|
|
110
|
-
"molecule_ground_state_solution_post_process",
|
|
111
93
|
"qae_with_qpe_result_post_processing",
|
|
112
|
-
"qsvm_full_run",
|
|
113
94
|
"sample",
|
|
114
95
|
"save",
|
|
115
96
|
"vqe",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This file was generated automatically - do not edit manually
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
from classiq.qmod.qmod_parameter import
|
|
4
|
+
from classiq.qmod.qmod_parameter import CInt, CReal
|
|
5
5
|
from classiq.qmod.symbolic import symbolic_function
|
|
6
6
|
|
|
7
7
|
from .structs import *
|
|
@@ -17,47 +17,6 @@ def qft_const_adder_phase(
|
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def fock_hamiltonian_problem_to_hamiltonian(
|
|
21
|
-
problem: FockHamiltonianProblem,
|
|
22
|
-
) -> CArray[PauliTerm]:
|
|
23
|
-
return symbolic_function(
|
|
24
|
-
problem, return_type=CArray[PauliTerm] # type:ignore[type-abstract]
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def molecule_problem_to_hamiltonian(
|
|
29
|
-
problem: MoleculeProblem,
|
|
30
|
-
) -> CArray[PauliTerm]:
|
|
31
|
-
return symbolic_function(
|
|
32
|
-
problem, return_type=CArray[PauliTerm] # type:ignore[type-abstract]
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def grid_entangler_graph(
|
|
37
|
-
num_qubits: CInt,
|
|
38
|
-
schmidt_rank: CInt,
|
|
39
|
-
grid_randomization: CBool,
|
|
40
|
-
) -> CArray[CArray[CInt]]:
|
|
41
|
-
return symbolic_function(
|
|
42
|
-
num_qubits,
|
|
43
|
-
schmidt_rank,
|
|
44
|
-
grid_randomization,
|
|
45
|
-
return_type=CArray[CArray[CInt]], # type:ignore[type-abstract]
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def hypercube_entangler_graph(
|
|
50
|
-
num_qubits: CInt,
|
|
51
|
-
) -> CArray[CArray[CInt]]:
|
|
52
|
-
return symbolic_function(
|
|
53
|
-
num_qubits, return_type=CArray[CArray[CInt]] # type:ignore[type-abstract]
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
20
|
__all__ = [
|
|
58
21
|
"qft_const_adder_phase",
|
|
59
|
-
"fock_hamiltonian_problem_to_hamiltonian",
|
|
60
|
-
"molecule_problem_to_hamiltonian",
|
|
61
|
-
"grid_entangler_graph",
|
|
62
|
-
"hypercube_entangler_graph",
|
|
63
22
|
]
|
classiq/qmod/builtins/enums.py
CHANGED
|
@@ -2,144 +2,12 @@ from enum import IntEnum
|
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from classiq.interface.generator.types.enum_declaration import EnumDeclaration
|
|
5
|
+
from classiq.interface.helpers.datastructures import LenList
|
|
5
6
|
|
|
6
7
|
if TYPE_CHECKING:
|
|
7
8
|
from classiq.qmod.builtins.structs import SparsePauliOp
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
class Element(IntEnum):
|
|
11
|
-
H = 0
|
|
12
|
-
He = 1
|
|
13
|
-
Li = 2
|
|
14
|
-
Be = 3
|
|
15
|
-
B = 4
|
|
16
|
-
C = 5
|
|
17
|
-
N = 6
|
|
18
|
-
O = 7 # noqa: E741
|
|
19
|
-
F = 8
|
|
20
|
-
Ne = 9
|
|
21
|
-
Na = 10
|
|
22
|
-
Mg = 11
|
|
23
|
-
Al = 12
|
|
24
|
-
Si = 13
|
|
25
|
-
P = 14
|
|
26
|
-
S = 15
|
|
27
|
-
Cl = 16
|
|
28
|
-
Ar = 17
|
|
29
|
-
K = 18
|
|
30
|
-
Ca = 19
|
|
31
|
-
Sc = 20
|
|
32
|
-
Ti = 21
|
|
33
|
-
V = 22
|
|
34
|
-
Cr = 23
|
|
35
|
-
Mn = 24
|
|
36
|
-
Fe = 25
|
|
37
|
-
Co = 26
|
|
38
|
-
Ni = 27
|
|
39
|
-
Cu = 28
|
|
40
|
-
Zn = 29
|
|
41
|
-
Ga = 30
|
|
42
|
-
Ge = 31
|
|
43
|
-
As = 32
|
|
44
|
-
Se = 33
|
|
45
|
-
Br = 34
|
|
46
|
-
Kr = 35
|
|
47
|
-
Rb = 36
|
|
48
|
-
Sr = 37
|
|
49
|
-
Y = 38
|
|
50
|
-
Zr = 39
|
|
51
|
-
Nb = 40
|
|
52
|
-
Mo = 41
|
|
53
|
-
Tc = 42
|
|
54
|
-
Ru = 43
|
|
55
|
-
Rh = 44
|
|
56
|
-
Pd = 45
|
|
57
|
-
Ag = 46
|
|
58
|
-
Cd = 47
|
|
59
|
-
In = 48
|
|
60
|
-
Sn = 49
|
|
61
|
-
Sb = 50
|
|
62
|
-
Te = 51
|
|
63
|
-
I = 52 # noqa: E741
|
|
64
|
-
Xe = 53
|
|
65
|
-
Cs = 54
|
|
66
|
-
Ba = 55
|
|
67
|
-
La = 56
|
|
68
|
-
Ce = 57
|
|
69
|
-
Pr = 58
|
|
70
|
-
Nd = 59
|
|
71
|
-
Pm = 60
|
|
72
|
-
Sm = 61
|
|
73
|
-
Eu = 62
|
|
74
|
-
Gd = 63
|
|
75
|
-
Tb = 64
|
|
76
|
-
Dy = 65
|
|
77
|
-
Ho = 66
|
|
78
|
-
Er = 67
|
|
79
|
-
Tm = 68
|
|
80
|
-
Yb = 69
|
|
81
|
-
Lu = 70
|
|
82
|
-
Hf = 71
|
|
83
|
-
Ta = 72
|
|
84
|
-
W = 73
|
|
85
|
-
Re = 74
|
|
86
|
-
Os = 75
|
|
87
|
-
Ir = 76
|
|
88
|
-
Pt = 77
|
|
89
|
-
Au = 78
|
|
90
|
-
Hg = 79
|
|
91
|
-
Tl = 80
|
|
92
|
-
Pb = 81
|
|
93
|
-
Bi = 82
|
|
94
|
-
Po = 83
|
|
95
|
-
At = 84
|
|
96
|
-
Rn = 85
|
|
97
|
-
Fr = 86
|
|
98
|
-
Ra = 87
|
|
99
|
-
Ac = 88
|
|
100
|
-
Th = 89
|
|
101
|
-
Pa = 90
|
|
102
|
-
U = 91
|
|
103
|
-
Np = 92
|
|
104
|
-
Pu = 93
|
|
105
|
-
Am = 94
|
|
106
|
-
Cm = 95
|
|
107
|
-
Bk = 96
|
|
108
|
-
Cf = 97
|
|
109
|
-
Es = 98
|
|
110
|
-
Fm = 99
|
|
111
|
-
Md = 100
|
|
112
|
-
No = 101
|
|
113
|
-
Lr = 102
|
|
114
|
-
Rf = 103
|
|
115
|
-
Db = 104
|
|
116
|
-
Sg = 105
|
|
117
|
-
Bh = 106
|
|
118
|
-
Hs = 107
|
|
119
|
-
Mt = 108
|
|
120
|
-
Ds = 109
|
|
121
|
-
Rg = 110
|
|
122
|
-
Cn = 111
|
|
123
|
-
Nh = 112
|
|
124
|
-
Fl = 113
|
|
125
|
-
Mc = 114
|
|
126
|
-
Lv = 115
|
|
127
|
-
Ts = 116
|
|
128
|
-
Og = 117
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
class FermionMapping(IntEnum):
|
|
132
|
-
JORDAN_WIGNER = 0
|
|
133
|
-
PARITY = 1
|
|
134
|
-
BRAVYI_KITAEV = 2
|
|
135
|
-
FAST_BRAVYI_KITAEV = 3
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class LadderOperator(IntEnum):
|
|
139
|
-
PLUS = 0
|
|
140
|
-
MINUS = 1
|
|
141
|
-
|
|
142
|
-
|
|
143
11
|
class Optimizer(IntEnum):
|
|
144
12
|
COBYLA = 1
|
|
145
13
|
SPSA = 2
|
|
@@ -195,26 +63,24 @@ class Pauli(IntEnum):
|
|
|
195
63
|
)
|
|
196
64
|
|
|
197
65
|
return SparsePauliOp(
|
|
198
|
-
terms=
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
66
|
+
terms=LenList(
|
|
67
|
+
[
|
|
68
|
+
SparsePauliTerm(
|
|
69
|
+
paulis=LenList(
|
|
70
|
+
[ # type:ignore[arg-type]
|
|
71
|
+
IndexedPauli(
|
|
72
|
+
pauli=self, index=index # type:ignore[arg-type]
|
|
73
|
+
)
|
|
74
|
+
]
|
|
75
|
+
),
|
|
76
|
+
coefficient=1.0, # type:ignore[arg-type]
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
),
|
|
206
80
|
num_qubits=index + 1,
|
|
207
81
|
)
|
|
208
82
|
|
|
209
83
|
|
|
210
|
-
class QSVMFeatureMapEntanglement(IntEnum):
|
|
211
|
-
FULL = 0
|
|
212
|
-
LINEAR = 1
|
|
213
|
-
CIRCULAR = 2
|
|
214
|
-
SCA = 3
|
|
215
|
-
PAIRWISE = 4
|
|
216
|
-
|
|
217
|
-
|
|
218
84
|
BUILTIN_ENUM_DECLARATIONS = {
|
|
219
85
|
enum_def.__name__: EnumDeclaration(
|
|
220
86
|
name=enum_def.__name__,
|
|
@@ -229,10 +95,6 @@ BUILTIN_ENUM_DECLARATIONS = {
|
|
|
229
95
|
}
|
|
230
96
|
|
|
231
97
|
__all__ = [
|
|
232
|
-
"Element",
|
|
233
|
-
"FermionMapping",
|
|
234
|
-
"LadderOperator",
|
|
235
98
|
"Optimizer",
|
|
236
99
|
"Pauli",
|
|
237
|
-
"QSVMFeatureMapEntanglement",
|
|
238
100
|
]
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
from .allocation import *
|
|
2
2
|
from .arithmetic import *
|
|
3
3
|
from .benchmarking import *
|
|
4
|
-
from .chemistry import *
|
|
5
4
|
from .exponentiation import *
|
|
5
|
+
from .mcx_func import mcx
|
|
6
6
|
from .mid_circuit_measurement import *
|
|
7
7
|
from .operators import *
|
|
8
|
-
from .qsvm import *
|
|
9
8
|
from .standard_gates import *
|
|
10
9
|
|
|
11
10
|
CORE_LIB_DECLS = [
|
|
12
11
|
func.func_decl
|
|
13
12
|
for func in (
|
|
14
|
-
molecule_ucc,
|
|
15
|
-
molecule_hva,
|
|
16
|
-
molecule_hartree_fock,
|
|
17
|
-
fock_hamiltonian_ucc,
|
|
18
|
-
fock_hamiltonian_hva,
|
|
19
|
-
fock_hamiltonian_hartree_fock,
|
|
20
|
-
pauli_feature_map,
|
|
21
|
-
bloch_sphere_feature_map,
|
|
22
13
|
H,
|
|
23
14
|
X,
|
|
24
15
|
Y,
|
|
@@ -60,6 +51,7 @@ CORE_LIB_DECLS = [
|
|
|
60
51
|
U,
|
|
61
52
|
CCX,
|
|
62
53
|
free,
|
|
54
|
+
drop,
|
|
63
55
|
randomized_benchmarking,
|
|
64
56
|
inplace_prepare_state,
|
|
65
57
|
inplace_prepare_state_approx,
|
|
@@ -68,12 +60,16 @@ CORE_LIB_DECLS = [
|
|
|
68
60
|
single_pauli_exponent,
|
|
69
61
|
commuting_paulis_exponent,
|
|
70
62
|
suzuki_trotter,
|
|
63
|
+
unscheduled_suzuki_trotter,
|
|
64
|
+
exponentiate,
|
|
71
65
|
multi_suzuki_trotter,
|
|
72
66
|
parametric_suzuki_trotter,
|
|
73
67
|
sparse_suzuki_trotter,
|
|
74
68
|
qdrift,
|
|
75
69
|
exponentiation_with_depth_constraint,
|
|
76
70
|
RESET,
|
|
71
|
+
mcx,
|
|
72
|
+
SX,
|
|
77
73
|
)
|
|
78
74
|
]
|
|
79
75
|
|
|
@@ -92,6 +88,7 @@ __all__ = [ # noqa: RUF022
|
|
|
92
88
|
"H",
|
|
93
89
|
"I",
|
|
94
90
|
"IDENTITY",
|
|
91
|
+
"mcx",
|
|
95
92
|
"PHASE",
|
|
96
93
|
"R",
|
|
97
94
|
"RX",
|
|
@@ -109,15 +106,13 @@ __all__ = [ # noqa: RUF022
|
|
|
109
106
|
"X",
|
|
110
107
|
"Y",
|
|
111
108
|
"Z",
|
|
109
|
+
"SX",
|
|
112
110
|
"add",
|
|
113
111
|
"add_inplace_right",
|
|
114
112
|
"apply",
|
|
115
|
-
"bloch_sphere_feature_map",
|
|
116
113
|
"exponentiation_with_depth_constraint",
|
|
117
|
-
"fock_hamiltonian_hartree_fock",
|
|
118
|
-
"fock_hamiltonian_hva",
|
|
119
|
-
"fock_hamiltonian_ucc",
|
|
120
114
|
"free",
|
|
115
|
+
"drop",
|
|
121
116
|
"inplace_prepare_amplitudes",
|
|
122
117
|
"inplace_prepare_amplitudes_approx",
|
|
123
118
|
"inplace_prepare_state",
|
|
@@ -125,12 +120,8 @@ __all__ = [ # noqa: RUF022
|
|
|
125
120
|
"integer_xor",
|
|
126
121
|
"modular_add",
|
|
127
122
|
"modular_add_constant",
|
|
128
|
-
"molecule_hartree_fock",
|
|
129
|
-
"molecule_hva",
|
|
130
|
-
"molecule_ucc",
|
|
131
123
|
"multi_suzuki_trotter",
|
|
132
124
|
"parametric_suzuki_trotter",
|
|
133
|
-
"pauli_feature_map",
|
|
134
125
|
"permute",
|
|
135
126
|
"prepare_amplitudes",
|
|
136
127
|
"prepare_amplitudes_approx",
|