classiq 0.93.0__py3-none-any.whl → 0.100.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 +21 -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/generation_request.py +35 -0
- 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 +10 -4
- classiq/interface/generator/types/builtin_enum_declarations.py +0 -145
- classiq/interface/generator/types/compilation_metadata.py +13 -2
- 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 +5 -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/bind_operation.py +3 -0
- 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 +40 -28
- 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 -40
- 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 +41 -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/encodings.py +182 -0
- 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 +137 -31
- 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 +48 -47
- 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 +23 -15
- 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.100.0.dist-info}/METADATA +2 -3
- {classiq-0.93.0.dist-info → classiq-0.100.0.dist-info}/RECORD +274 -300
- {classiq-0.93.0.dist-info → classiq-0.100.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.100.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -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",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
|
-
from classiq.qmod.qfunc import qfunc
|
|
3
|
+
from classiq.qmod.qfunc import qfunc, qperm
|
|
4
4
|
from classiq.qmod.qmod_parameter import CArray, CReal
|
|
5
|
-
from classiq.qmod.qmod_variable import Input, Output,
|
|
5
|
+
from classiq.qmod.qmod_variable import Input, Output, QArray, QBit
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
@
|
|
9
|
-
def free(in_:
|
|
8
|
+
@qperm(external=True)
|
|
9
|
+
def free(in_: Input[QArray[QBit]]) -> None:
|
|
10
10
|
"""
|
|
11
11
|
[Qmod core-library function]
|
|
12
12
|
|
|
@@ -21,6 +21,27 @@ def free(in_: Permutable[Input[QArray[QBit]]]) -> None:
|
|
|
21
21
|
pass
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
@qperm(external=True)
|
|
25
|
+
def drop(in_: Input[QArray[QBit]]) -> None:
|
|
26
|
+
"""
|
|
27
|
+
[Qmod core-library function]
|
|
28
|
+
|
|
29
|
+
Discards the qubits allocated to a quantum variable which may be in any state,
|
|
30
|
+
preventing their further use.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
in_: The quantum variable that will be dropped. Must be initialized before.
|
|
34
|
+
|
|
35
|
+
Note:
|
|
36
|
+
This operation can be used to bypass the restrictions on a local variable
|
|
37
|
+
that enable its uncomputation. The implication is that its qubits are left
|
|
38
|
+
dirty, possibly entangled with functional qubits, and never subsequently reused.
|
|
39
|
+
|
|
40
|
+
Functions which use `drop` cannot be inverted or used inside a _within_ block.
|
|
41
|
+
"""
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
24
45
|
@qfunc(external=True)
|
|
25
46
|
def prepare_state(
|
|
26
47
|
probabilities: CArray[CReal],
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
|
-
from classiq.qmod.qfunc import qfunc
|
|
3
|
+
from classiq.qmod.qfunc import qfunc, qperm
|
|
4
4
|
from classiq.qmod.qmod_parameter import CArray, CBool, CReal
|
|
5
5
|
from classiq.qmod.qmod_variable import (
|
|
6
6
|
Const,
|
|
7
7
|
Input,
|
|
8
8
|
Output,
|
|
9
|
-
Permutable,
|
|
10
9
|
QArray,
|
|
11
10
|
QBit,
|
|
12
11
|
QNum,
|
|
@@ -30,17 +29,15 @@ def unitary(
|
|
|
30
29
|
pass
|
|
31
30
|
|
|
32
31
|
|
|
33
|
-
@
|
|
32
|
+
@qperm(external=True)
|
|
34
33
|
def add(
|
|
35
34
|
left: Const[QNum],
|
|
36
35
|
right: Const[QNum],
|
|
37
|
-
result:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Literal["result_fraction_places"],
|
|
43
|
-
]
|
|
36
|
+
result: Output[
|
|
37
|
+
QNum[
|
|
38
|
+
Literal["result_size"],
|
|
39
|
+
Literal["result_is_signed"],
|
|
40
|
+
Literal["result_fraction_places"],
|
|
44
41
|
]
|
|
45
42
|
],
|
|
46
43
|
result_size: CReal,
|
|
@@ -50,17 +47,15 @@ def add(
|
|
|
50
47
|
pass
|
|
51
48
|
|
|
52
49
|
|
|
53
|
-
@
|
|
50
|
+
@qperm(external=True)
|
|
54
51
|
def add_inplace_right(
|
|
55
52
|
left: Const[QNum],
|
|
56
|
-
right:
|
|
57
|
-
result:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Literal["result_fraction_places"],
|
|
63
|
-
]
|
|
53
|
+
right: Input[QNum],
|
|
54
|
+
result: Output[
|
|
55
|
+
QNum[
|
|
56
|
+
Literal["result_size"],
|
|
57
|
+
Literal["result_is_signed"],
|
|
58
|
+
Literal["result_fraction_places"],
|
|
64
59
|
]
|
|
65
60
|
],
|
|
66
61
|
result_size: CReal,
|
|
@@ -70,21 +65,21 @@ def add_inplace_right(
|
|
|
70
65
|
pass
|
|
71
66
|
|
|
72
67
|
|
|
73
|
-
@
|
|
74
|
-
def modular_add(left: Const[QArray[QBit]], right:
|
|
68
|
+
@qperm(external=True)
|
|
69
|
+
def modular_add(left: Const[QArray[QBit]], right: QArray[QBit]) -> None:
|
|
75
70
|
pass
|
|
76
71
|
|
|
77
72
|
|
|
78
|
-
@
|
|
79
|
-
def modular_add_constant(left: CReal, right:
|
|
73
|
+
@qperm(external=True)
|
|
74
|
+
def modular_add_constant(left: CReal, right: QNum) -> None:
|
|
80
75
|
pass
|
|
81
76
|
|
|
82
77
|
|
|
83
|
-
@
|
|
84
|
-
def integer_xor(left: Const[QArray[QBit]], right:
|
|
78
|
+
@qperm(external=True)
|
|
79
|
+
def integer_xor(left: Const[QArray[QBit]], right: QArray[QBit]) -> None:
|
|
85
80
|
pass
|
|
86
81
|
|
|
87
82
|
|
|
88
|
-
@
|
|
89
|
-
def real_xor_constant(left: CReal, right:
|
|
83
|
+
@qperm(external=True)
|
|
84
|
+
def real_xor_constant(left: CReal, right: QNum) -> None:
|
|
90
85
|
pass
|
|
@@ -108,6 +108,55 @@ def multi_suzuki_trotter(
|
|
|
108
108
|
pass
|
|
109
109
|
|
|
110
110
|
|
|
111
|
+
@qfunc(external=True)
|
|
112
|
+
def unscheduled_suzuki_trotter(
|
|
113
|
+
hamiltonians: CArray[SparsePauliOp],
|
|
114
|
+
evolution_coefficients: CArray[CReal],
|
|
115
|
+
order: CInt,
|
|
116
|
+
repetitions: CInt,
|
|
117
|
+
qbv: QArray,
|
|
118
|
+
) -> None:
|
|
119
|
+
"""
|
|
120
|
+
[Qmod core-library function]
|
|
121
|
+
|
|
122
|
+
Applies the Suzuki-Trotter decomposition jointly to a sum of Hamiltonians
|
|
123
|
+
(represented as Pauli operators), each with its separate evolution coefficient,
|
|
124
|
+
approximating $\\exp{-iH_1t_1+H_2t_2+\\dots}$ with a specified order and number of
|
|
125
|
+
repetitions. Does not reorder the Pauli terms.
|
|
126
|
+
|
|
127
|
+
The Suzuki-Trotter decomposition is a method for approximating the exponential of a sum of operators by a product of exponentials of each operator.
|
|
128
|
+
The Suzuki-Trotter decomposition of a given order nullifies the error of the Taylor series expansion of the product of exponentials up to that order.
|
|
129
|
+
The error of a Suzuki-Trotter decomposition decreases as the order and number of repetitions increase.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
hamiltonians: The hamitonians to be exponentiated, in sparse representation.
|
|
133
|
+
evolution_coefficients: The hamiltonian coefficients (can be link-time).
|
|
134
|
+
order: The order of the Suzuki-Trotter decomposition.
|
|
135
|
+
repetitions: The number of repetitions of the Suzuki-Trotter decomposition.
|
|
136
|
+
qbv: The target quantum variable of the exponentiation.
|
|
137
|
+
"""
|
|
138
|
+
pass
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@qfunc(external=True)
|
|
142
|
+
def exponentiate(
|
|
143
|
+
hamiltonian: SparsePauliOp,
|
|
144
|
+
evolution_coefficient: CReal,
|
|
145
|
+
qbv: QArray[QBit],
|
|
146
|
+
) -> None:
|
|
147
|
+
"""
|
|
148
|
+
[Qmod core-library function]
|
|
149
|
+
|
|
150
|
+
Exponentiates a Pauli operator.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
hamiltonian: The Pauli operator to be exponentiated.
|
|
154
|
+
evolution_coefficient: A global coefficient multiplying the Pauli operator.
|
|
155
|
+
qbv: The target quantum variable of the exponentiation.
|
|
156
|
+
"""
|
|
157
|
+
pass
|
|
158
|
+
|
|
159
|
+
|
|
111
160
|
@qfunc(external=True)
|
|
112
161
|
def parametric_suzuki_trotter(
|
|
113
162
|
paulis: CArray[CArray[Pauli]],
|
|
@@ -169,10 +218,10 @@ def sparse_suzuki_trotter(
|
|
|
169
218
|
|
|
170
219
|
@qfunc(external=True)
|
|
171
220
|
def qdrift(
|
|
172
|
-
pauli_operator:
|
|
221
|
+
pauli_operator: SparsePauliOp, # FIXME: Rename to hamiltonian (CLS-4347)
|
|
173
222
|
evolution_coefficient: CReal,
|
|
174
223
|
num_qdrift: CInt,
|
|
175
|
-
qbv: QArray[QBit,
|
|
224
|
+
qbv: QArray[QBit], # FIXME: Add length expr (CLS-4347)
|
|
176
225
|
) -> None:
|
|
177
226
|
"""
|
|
178
227
|
[Qmod core-library function]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
|
-
from classiq.qmod.qfunc import qfunc
|
|
3
|
+
from classiq.qmod.qfunc import qfunc, qperm
|
|
4
4
|
from classiq.qmod.qmod_parameter import CReal
|
|
5
|
-
from classiq.qmod.qmod_variable import Const,
|
|
5
|
+
from classiq.qmod.qmod_variable import Const, QArray, QBit
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@qfunc(external=True)
|
|
@@ -24,8 +24,8 @@ def H(target: QBit) -> None:
|
|
|
24
24
|
pass
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
@
|
|
28
|
-
def X(target:
|
|
27
|
+
@qperm(external=True)
|
|
28
|
+
def X(target: QBit) -> None:
|
|
29
29
|
"""
|
|
30
30
|
[Qmod core-library function]
|
|
31
31
|
|
|
@@ -43,8 +43,8 @@ def X(target: Permutable[QBit]) -> None:
|
|
|
43
43
|
pass
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
@
|
|
47
|
-
def Y(target:
|
|
46
|
+
@qperm(external=True)
|
|
47
|
+
def Y(target: QBit) -> None:
|
|
48
48
|
"""
|
|
49
49
|
[Qmod core-library function]
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ def Y(target: Permutable[QBit]) -> None:
|
|
|
62
62
|
pass
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
@
|
|
65
|
+
@qperm(external=True)
|
|
66
66
|
def Z(target: Const[QBit]) -> None:
|
|
67
67
|
"""
|
|
68
68
|
[Qmod core-library function]
|
|
@@ -81,7 +81,7 @@ def Z(target: Const[QBit]) -> None:
|
|
|
81
81
|
pass
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
@
|
|
84
|
+
@qperm(external=True)
|
|
85
85
|
def I(target: Const[QBit]) -> None:
|
|
86
86
|
"""
|
|
87
87
|
[Qmod core-library function]
|
|
@@ -100,7 +100,7 @@ def I(target: Const[QBit]) -> None:
|
|
|
100
100
|
pass
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
@
|
|
103
|
+
@qperm(external=True)
|
|
104
104
|
def S(target: Const[QBit]) -> None:
|
|
105
105
|
"""
|
|
106
106
|
[Qmod core-library function]
|
|
@@ -119,7 +119,7 @@ def S(target: Const[QBit]) -> None:
|
|
|
119
119
|
pass
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
@
|
|
122
|
+
@qperm(external=True)
|
|
123
123
|
def T(target: Const[QBit]) -> None:
|
|
124
124
|
"""
|
|
125
125
|
[Qmod core-library function]
|
|
@@ -138,7 +138,7 @@ def T(target: Const[QBit]) -> None:
|
|
|
138
138
|
pass
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
@
|
|
141
|
+
@qperm(external=True)
|
|
142
142
|
def SDG(target: Const[QBit]) -> None:
|
|
143
143
|
"""
|
|
144
144
|
[Qmod core-library function]
|
|
@@ -157,7 +157,7 @@ def SDG(target: Const[QBit]) -> None:
|
|
|
157
157
|
pass
|
|
158
158
|
|
|
159
159
|
|
|
160
|
-
@
|
|
160
|
+
@qperm(external=True)
|
|
161
161
|
def TDG(target: Const[QBit]) -> None:
|
|
162
162
|
"""
|
|
163
163
|
[Qmod core-library function]
|
|
@@ -176,7 +176,7 @@ def TDG(target: Const[QBit]) -> None:
|
|
|
176
176
|
pass
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
@
|
|
179
|
+
@qperm(external=True)
|
|
180
180
|
def PHASE(theta: CReal, target: Const[QBit]) -> None:
|
|
181
181
|
"""
|
|
182
182
|
[Qmod core-library function]
|
|
@@ -238,7 +238,7 @@ def RY(theta: CReal, target: QBit) -> None:
|
|
|
238
238
|
pass
|
|
239
239
|
|
|
240
240
|
|
|
241
|
-
@
|
|
241
|
+
@qperm(external=True)
|
|
242
242
|
def RZ(theta: CReal, target: Const[QBit]) -> None:
|
|
243
243
|
"""
|
|
244
244
|
[Qmod core-library function]
|
|
@@ -323,7 +323,7 @@ def RYY(theta: CReal, target: QArray[QBit, Literal[2]]) -> None:
|
|
|
323
323
|
pass
|
|
324
324
|
|
|
325
325
|
|
|
326
|
-
@
|
|
326
|
+
@qperm(external=True)
|
|
327
327
|
def RZZ(theta: CReal, target: Const[QArray[QBit, Literal[2]]]) -> None:
|
|
328
328
|
"""
|
|
329
329
|
[Qmod core-library function]
|
|
@@ -369,8 +369,8 @@ def CH(ctrl: Const[QBit], target: QBit) -> None:
|
|
|
369
369
|
pass
|
|
370
370
|
|
|
371
371
|
|
|
372
|
-
@
|
|
373
|
-
def CX(ctrl: Const[QBit], target:
|
|
372
|
+
@qperm(external=True)
|
|
373
|
+
def CX(ctrl: Const[QBit], target: QBit) -> None:
|
|
374
374
|
"""
|
|
375
375
|
[Qmod core-library function]
|
|
376
376
|
|
|
@@ -394,8 +394,8 @@ def CX(ctrl: Const[QBit], target: Permutable[QBit]) -> None:
|
|
|
394
394
|
pass
|
|
395
395
|
|
|
396
396
|
|
|
397
|
-
@
|
|
398
|
-
def CY(ctrl: Const[QBit], target:
|
|
397
|
+
@qperm(external=True)
|
|
398
|
+
def CY(ctrl: Const[QBit], target: QBit) -> None:
|
|
399
399
|
"""
|
|
400
400
|
[Qmod core-library function]
|
|
401
401
|
|
|
@@ -419,7 +419,7 @@ def CY(ctrl: Const[QBit], target: Permutable[QBit]) -> None:
|
|
|
419
419
|
pass
|
|
420
420
|
|
|
421
421
|
|
|
422
|
-
@
|
|
422
|
+
@qperm(external=True)
|
|
423
423
|
def CZ(ctrl: Const[QBit], target: Const[QBit]) -> None:
|
|
424
424
|
"""
|
|
425
425
|
[Qmod core-library function]
|
|
@@ -496,7 +496,7 @@ def CRY(theta: CReal, ctrl: Const[QBit], target: QBit) -> None:
|
|
|
496
496
|
pass
|
|
497
497
|
|
|
498
498
|
|
|
499
|
-
@
|
|
499
|
+
@qperm(external=True)
|
|
500
500
|
def CRZ(theta: CReal, ctrl: Const[QBit], target: Const[QBit]) -> None:
|
|
501
501
|
"""
|
|
502
502
|
[Qmod core-library function]
|
|
@@ -522,7 +522,7 @@ def CRZ(theta: CReal, ctrl: Const[QBit], target: Const[QBit]) -> None:
|
|
|
522
522
|
pass
|
|
523
523
|
|
|
524
524
|
|
|
525
|
-
@
|
|
525
|
+
@qperm(external=True)
|
|
526
526
|
def CPHASE(theta: CReal, ctrl: Const[QBit], target: Const[QBit]) -> None:
|
|
527
527
|
"""
|
|
528
528
|
[Qmod core-library function]
|
|
@@ -548,8 +548,8 @@ def CPHASE(theta: CReal, ctrl: Const[QBit], target: Const[QBit]) -> None:
|
|
|
548
548
|
pass
|
|
549
549
|
|
|
550
550
|
|
|
551
|
-
@
|
|
552
|
-
def SWAP(qbit0:
|
|
551
|
+
@qperm(external=True)
|
|
552
|
+
def SWAP(qbit0: QBit, qbit1: QBit) -> None:
|
|
553
553
|
"""
|
|
554
554
|
[Qmod core-library function]
|
|
555
555
|
|
|
@@ -573,7 +573,7 @@ def SWAP(qbit0: Permutable[QBit], qbit1: Permutable[QBit]) -> None:
|
|
|
573
573
|
pass
|
|
574
574
|
|
|
575
575
|
|
|
576
|
-
@
|
|
576
|
+
@qperm(external=True)
|
|
577
577
|
def IDENTITY(target: Const[QArray[QBit]]) -> None:
|
|
578
578
|
"""
|
|
579
579
|
[Qmod core-library function]
|
|
@@ -622,8 +622,8 @@ def U(theta: CReal, phi: CReal, lam: CReal, gam: CReal, target: QBit) -> None:
|
|
|
622
622
|
pass
|
|
623
623
|
|
|
624
624
|
|
|
625
|
-
@
|
|
626
|
-
def CCX(ctrl: Const[QArray[QBit, Literal[2]]], target:
|
|
625
|
+
@qperm(external=True)
|
|
626
|
+
def CCX(ctrl: Const[QArray[QBit, Literal[2]]], target: QBit) -> None:
|
|
627
627
|
"""
|
|
628
628
|
[Qmod core-library function]
|
|
629
629
|
|
|
@@ -649,3 +649,22 @@ def CCX(ctrl: Const[QArray[QBit, Literal[2]]], target: Permutable[QBit]) -> None
|
|
|
649
649
|
target (QBit): The qubit to apply the conditioned Pauli-X gate on.
|
|
650
650
|
"""
|
|
651
651
|
pass
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
@qfunc(external=True)
|
|
655
|
+
def SX(target: QBit) -> None:
|
|
656
|
+
"""
|
|
657
|
+
[Qmod core-library function]
|
|
658
|
+
|
|
659
|
+
Performs the sqrt(X) gate on a qubit.
|
|
660
|
+
|
|
661
|
+
This operation is represented by the following matrix:
|
|
662
|
+
|
|
663
|
+
$$
|
|
664
|
+
SX = 1/\\sqrt2 \\begin{bmatrix}
|
|
665
|
+
1+i & i-1 \\\\
|
|
666
|
+
i-1 & 1+i \\\\
|
|
667
|
+
\\end{bmatrix}
|
|
668
|
+
$$
|
|
669
|
+
"""
|
|
670
|
+
pass
|