classiq 0.53.0__py3-none-any.whl → 0.54.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 +1 -3
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +2 -1
- classiq/_internals/__init__.py +0 -20
- classiq/_internals/api_wrapper.py +8 -8
- classiq/_internals/async_utils.py +1 -3
- classiq/_internals/authentication/auth0.py +5 -5
- classiq/_internals/authentication/device.py +5 -4
- classiq/_internals/authentication/password_manager.py +3 -3
- classiq/_internals/authentication/token_manager.py +3 -2
- classiq/_internals/client.py +10 -12
- classiq/_internals/config.py +2 -2
- classiq/_internals/jobs.py +7 -6
- classiq/_internals/type_validation.py +9 -9
- classiq/analyzer/__init__.py +1 -3
- classiq/analyzer/analyzer.py +8 -7
- classiq/analyzer/analyzer_utilities.py +8 -8
- classiq/analyzer/rb.py +11 -11
- classiq/applications/__init__.py +1 -3
- classiq/applications/chemistry/__init__.py +1 -3
- classiq/applications/chemistry/ansatz_parameters.py +4 -4
- classiq/applications/chemistry/chemistry_model_constructor.py +10 -9
- classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +26 -9
- classiq/applications/combinatorial_helpers/encoding_mapping.py +10 -10
- classiq/applications/combinatorial_helpers/encoding_utils.py +4 -4
- classiq/applications/combinatorial_helpers/memory.py +5 -7
- classiq/applications/combinatorial_helpers/optimization_model.py +43 -24
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +4 -6
- classiq/applications/combinatorial_helpers/pyomo_utils.py +95 -24
- classiq/applications/combinatorial_helpers/sympy_utils.py +2 -2
- classiq/applications/combinatorial_helpers/transformations/encoding.py +8 -8
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +5 -5
- classiq/applications/combinatorial_helpers/transformations/ising_converter.py +7 -9
- classiq/applications/combinatorial_helpers/transformations/penalty.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/sign_seperation.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/slack_variables.py +1 -2
- classiq/applications/combinatorial_optimization/__init__.py +1 -3
- classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -2
- classiq/applications/combinatorial_optimization/examples/__init__.py +1 -3
- classiq/applications/finance/__init__.py +1 -3
- classiq/applications/grover/__init__.py +1 -3
- classiq/applications/grover/grover_model_constructor.py +7 -9
- classiq/applications/hamiltonian/pauli_decomposition.py +6 -6
- classiq/applications/qnn/__init__.py +1 -3
- classiq/applications/qnn/circuit_utils.py +5 -5
- classiq/applications/qnn/datasets/__init__.py +1 -3
- classiq/applications/qnn/datasets/dataset_base_classes.py +5 -4
- classiq/applications/qnn/datasets/dataset_parity.py +2 -2
- classiq/applications/qnn/gradients/simple_quantum_gradient.py +2 -1
- classiq/applications/qnn/qlayer.py +3 -3
- classiq/applications/qnn/torch_utils.py +2 -2
- classiq/applications/qnn/types.py +5 -5
- classiq/applications/qsvm/qsvm.py +1 -3
- classiq/applications/qsvm/qsvm_data_generation.py +3 -3
- classiq/applications/qsvm/qsvm_model_constructor.py +5 -5
- classiq/execution/__init__.py +1 -3
- classiq/execution/all_hardware_devices.py +1 -3
- classiq/execution/execution_session.py +16 -16
- classiq/execution/jobs.py +4 -4
- classiq/execution/qaoa.py +3 -3
- classiq/execution/qnn.py +3 -3
- classiq/executor.py +3 -3
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +9 -10
- classiq/interface/analyzer/cytoscape_graph.py +5 -5
- classiq/interface/analyzer/result.py +17 -17
- classiq/interface/applications/qsvm.py +6 -10
- classiq/interface/backend/backend_preferences.py +4 -3
- classiq/interface/backend/ionq/ionq_quantum_program.py +4 -5
- classiq/interface/backend/pydantic_backend.py +1 -2
- classiq/interface/chemistry/fermionic_operator.py +5 -5
- classiq/interface/chemistry/ground_state_problem.py +7 -8
- classiq/interface/chemistry/molecule.py +4 -4
- classiq/interface/chemistry/operator.py +11 -13
- classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -3
- classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -4
- classiq/interface/combinatorial_optimization/examples/knapsack.py +3 -3
- classiq/interface/combinatorial_optimization/examples/mht.py +2 -3
- classiq/interface/combinatorial_optimization/examples/portfolio_variations.py +2 -2
- classiq/interface/combinatorial_optimization/examples/set_cover.py +1 -2
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +5 -7
- classiq/interface/combinatorial_optimization/optimization_problem.py +2 -2
- classiq/interface/combinatorial_optimization/result.py +1 -3
- classiq/interface/debug_info/debug_info.py +8 -7
- classiq/interface/exceptions.py +8 -6
- classiq/interface/execution/jobs.py +2 -2
- classiq/interface/execution/primitives.py +3 -3
- classiq/interface/executor/aws_execution_cost.py +4 -4
- classiq/interface/executor/execution_request.py +2 -3
- classiq/interface/executor/execution_result.py +3 -3
- classiq/interface/executor/iqae_result.py +3 -5
- classiq/interface/executor/optimizer_preferences.py +2 -2
- classiq/interface/executor/quantum_code.py +6 -6
- classiq/interface/executor/register_initialization.py +2 -4
- classiq/interface/executor/result.py +23 -27
- classiq/interface/executor/vqe_result.py +8 -8
- classiq/interface/finance/function_input.py +2 -2
- classiq/interface/finance/gaussian_model_input.py +5 -5
- classiq/interface/finance/log_normal_model_input.py +2 -2
- classiq/interface/finance/model_input.py +1 -2
- classiq/interface/generator/adjacency.py +1 -3
- classiq/interface/generator/ansatz_library.py +4 -4
- classiq/interface/generator/application_apis/finance_declarations.py +1 -1
- classiq/interface/generator/arith/argument_utils.py +3 -3
- classiq/interface/generator/arith/arithmetic.py +7 -7
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +5 -5
- classiq/interface/generator/arith/arithmetic_expression_abc.py +11 -11
- classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -7
- classiq/interface/generator/arith/arithmetic_expression_validator.py +8 -8
- classiq/interface/generator/arith/arithmetic_operations.py +4 -3
- classiq/interface/generator/arith/arithmetic_param_getters.py +6 -6
- classiq/interface/generator/arith/arithmetic_result_builder.py +9 -9
- classiq/interface/generator/arith/ast_node_rewrite.py +2 -1
- classiq/interface/generator/arith/binary_ops.py +10 -13
- classiq/interface/generator/arith/extremum_operations.py +3 -2
- classiq/interface/generator/arith/logical_ops.py +7 -6
- classiq/interface/generator/arith/number_utils.py +4 -4
- classiq/interface/generator/arith/register_user_input.py +4 -4
- classiq/interface/generator/arith/unary_ops.py +2 -1
- classiq/interface/generator/builtin_api_builder.py +2 -1
- classiq/interface/generator/circuit_code/circuit_code.py +4 -4
- classiq/interface/generator/circuit_code/types_and_constants.py +3 -5
- classiq/interface/generator/complex_type.py +1 -2
- classiq/interface/generator/control_state.py +2 -2
- classiq/interface/generator/custom_ansatz.py +1 -3
- classiq/interface/generator/distance.py +3 -5
- classiq/interface/generator/excitations.py +3 -2
- classiq/interface/generator/expressions/enums/finance_functions.py +1 -3
- classiq/interface/generator/expressions/evaluated_expression.py +4 -3
- classiq/interface/generator/expressions/expression.py +4 -5
- classiq/interface/generator/expressions/expression_constants.py +4 -4
- classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_qstruct_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_sized_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_struct_instance.py +2 -1
- classiq/interface/generator/expressions/sympy_supported_expressions.py +11 -13
- classiq/interface/generator/finance.py +2 -2
- classiq/interface/generator/function_param_library.py +6 -6
- classiq/interface/generator/function_params.py +13 -19
- classiq/interface/generator/functions/classical_function_declaration.py +4 -3
- classiq/interface/generator/functions/classical_type.py +13 -13
- classiq/interface/generator/functions/concrete_types.py +1 -2
- classiq/interface/generator/functions/function_declaration.py +1 -1
- classiq/interface/generator/functions/qmod_python_interface.py +2 -1
- classiq/interface/generator/functions/type_name.py +3 -2
- classiq/interface/generator/generated_circuit_data.py +34 -22
- classiq/interface/generator/grover_diffuser.py +7 -7
- classiq/interface/generator/grover_operator.py +2 -2
- classiq/interface/generator/hardware/hardware_data.py +7 -6
- classiq/interface/generator/hardware_efficient_ansatz.py +8 -8
- classiq/interface/generator/identity.py +5 -6
- classiq/interface/generator/linear_pauli_rotations.py +6 -6
- classiq/interface/generator/mcu.py +2 -2
- classiq/interface/generator/mcx.py +6 -6
- classiq/interface/generator/model/__init__.py +1 -3
- classiq/interface/generator/model/constraints.py +2 -2
- classiq/interface/generator/model/model.py +5 -6
- classiq/interface/generator/model/preferences/preferences.py +7 -6
- classiq/interface/generator/model/quantum_register.py +6 -11
- classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
- classiq/interface/generator/oracles/custom_oracle.py +2 -2
- classiq/interface/generator/oracles/oracle_abc.py +6 -5
- classiq/interface/generator/partitioned_register.py +6 -5
- classiq/interface/generator/piecewise_linear_amplitude_loading.py +8 -7
- classiq/interface/generator/qpe.py +4 -4
- classiq/interface/generator/qsvm.py +3 -3
- classiq/interface/generator/quantum_function_call.py +24 -29
- classiq/interface/generator/quantum_program.py +9 -9
- classiq/interface/generator/register_role.py +2 -4
- classiq/interface/generator/slice_parsing_utils.py +4 -3
- classiq/interface/generator/standard_gates/standard_gates.py +3 -3
- classiq/interface/generator/state_preparation/bell_state_preparation.py +3 -3
- classiq/interface/generator/state_preparation/distributions.py +6 -5
- classiq/interface/generator/state_preparation/metrics.py +2 -4
- classiq/interface/generator/state_preparation/state_preparation.py +4 -4
- classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +3 -3
- classiq/interface/generator/transpiler_basis_gates.py +2 -2
- classiq/interface/generator/types/enum_declaration.py +2 -3
- classiq/interface/generator/types/qstruct_declaration.py +2 -1
- classiq/interface/generator/types/struct_declaration.py +3 -2
- classiq/interface/generator/ucc.py +2 -1
- classiq/interface/generator/unitary_gate.py +2 -2
- classiq/interface/generator/user_defined_function_params.py +1 -1
- classiq/interface/generator/validations/flow_graph.py +6 -5
- classiq/interface/generator/validations/validator_functions.py +3 -2
- classiq/interface/generator/visitor.py +9 -14
- classiq/interface/hardware.py +5 -6
- classiq/interface/helpers/custom_encoders.py +2 -2
- classiq/interface/helpers/custom_pydantic_types.py +8 -9
- classiq/interface/helpers/hashable_mixin.py +3 -2
- classiq/interface/helpers/hashable_pydantic_base_model.py +2 -1
- classiq/interface/helpers/pydantic_model_helpers.py +4 -3
- classiq/interface/helpers/validation_helpers.py +2 -2
- classiq/interface/ide/ide_data.py +11 -15
- classiq/interface/ide/visual_model.py +20 -22
- classiq/interface/jobs.py +2 -2
- classiq/interface/model/bind_operation.py +5 -4
- classiq/interface/model/classical_parameter_declaration.py +2 -2
- classiq/interface/model/handle_binding.py +3 -2
- classiq/interface/model/inplace_binary_operation.py +2 -1
- classiq/interface/model/model.py +12 -11
- classiq/interface/model/port_declaration.py +2 -2
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +3 -2
- classiq/interface/model/quantum_expressions/arithmetic_operation.py +3 -2
- classiq/interface/model/quantum_expressions/quantum_expression.py +8 -7
- classiq/interface/model/quantum_function_call.py +9 -14
- classiq/interface/model/quantum_function_declaration.py +10 -12
- classiq/interface/model/quantum_lambda_function.py +3 -16
- classiq/interface/model/quantum_statement.py +4 -3
- classiq/interface/model/quantum_type.py +5 -5
- classiq/interface/model/statement_block.py +2 -3
- classiq/interface/model/validation_handle.py +5 -4
- classiq/interface/server/global_versions.py +3 -3
- classiq/model_expansions/atomic_expression_functions_defs.py +3 -2
- classiq/model_expansions/call_to_model_converter.py +190 -0
- classiq/model_expansions/capturing/captured_var_manager.py +4 -6
- classiq/model_expansions/capturing/propagated_var_stack.py +7 -7
- classiq/model_expansions/closure.py +17 -9
- classiq/model_expansions/evaluators/arg_type_match.py +3 -2
- classiq/model_expansions/evaluators/argument_types.py +3 -3
- classiq/model_expansions/evaluators/control.py +3 -3
- classiq/model_expansions/evaluators/parameter_types.py +7 -7
- classiq/model_expansions/evaluators/quantum_type_utils.py +2 -1
- classiq/model_expansions/evaluators/type_type_match.py +1 -1
- classiq/model_expansions/expression_evaluator.py +10 -9
- classiq/model_expansions/expression_renamer.py +6 -6
- classiq/model_expansions/function_builder.py +19 -12
- classiq/model_expansions/generative_functions.py +3 -2
- classiq/model_expansions/interpreter.py +31 -19
- classiq/model_expansions/model_tables.py +14 -14
- classiq/model_expansions/quantum_operations/bind.py +2 -4
- classiq/model_expansions/quantum_operations/classicalif.py +1 -1
- classiq/model_expansions/quantum_operations/control.py +2 -4
- classiq/model_expansions/quantum_operations/emitter.py +10 -13
- classiq/model_expansions/quantum_operations/expression_operation.py +23 -16
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py +160 -35
- classiq/model_expansions/quantum_operations/phase.py +6 -6
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +25 -5
- classiq/model_expansions/quantum_operations/quantum_function_call.py +41 -2
- classiq/model_expansions/quantum_operations/repeat.py +1 -3
- classiq/model_expansions/scope.py +11 -10
- classiq/model_expansions/scope_initialization.py +6 -5
- classiq/model_expansions/sympy_conversion/expression_to_sympy.py +6 -6
- classiq/model_expansions/sympy_conversion/sympy_to_python.py +2 -2
- classiq/model_expansions/visitors/variable_references.py +5 -4
- classiq/qmod/builtins/classical_execution_primitives.py +9 -9
- classiq/qmod/builtins/functions/__init__.py +72 -55
- classiq/qmod/builtins/functions/amplitude_estimation.py +4 -1
- classiq/qmod/builtins/functions/arithmetic.py +14 -1
- classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +86 -6
- classiq/qmod/builtins/functions/grover.py +41 -45
- classiq/qmod/builtins/functions/hea.py +60 -4
- classiq/qmod/builtins/functions/linear_pauli_rotation.py +26 -4
- classiq/qmod/builtins/functions/modular_exponentiation.py +90 -29
- classiq/qmod/builtins/functions/operators.py +1 -1
- classiq/qmod/builtins/functions/qaoa_penalty.py +14 -5
- classiq/qmod/builtins/functions/qft_functions.py +57 -0
- classiq/qmod/builtins/functions/qpe.py +20 -4
- classiq/qmod/builtins/functions/qsvt.py +49 -4
- classiq/qmod/builtins/functions/standard_gates.py +4 -4
- classiq/qmod/builtins/functions/state_preparation.py +92 -10
- classiq/qmod/builtins/functions/swap_test.py +7 -1
- classiq/qmod/builtins/functions/utility_functions.py +43 -0
- classiq/qmod/builtins/functions/variational.py +18 -2
- classiq/qmod/builtins/operations.py +4 -5
- classiq/qmod/cfunc.py +2 -2
- classiq/qmod/classical_function.py +3 -7
- classiq/qmod/create_model_function.py +7 -6
- classiq/qmod/declaration_inferrer.py +7 -10
- classiq/qmod/expression_query.py +3 -3
- classiq/qmod/generative.py +2 -1
- classiq/qmod/model_state_container.py +5 -7
- classiq/qmod/native/__init__.py +1 -3
- classiq/qmod/native/expression_to_qmod.py +9 -8
- classiq/qmod/native/pretty_printer.py +6 -5
- classiq/qmod/pretty_print/__init__.py +1 -3
- classiq/qmod/pretty_print/expression_to_python.py +13 -12
- classiq/qmod/pretty_print/pretty_printer.py +13 -12
- classiq/qmod/python_classical_type.py +8 -4
- classiq/qmod/qfunc.py +4 -4
- classiq/qmod/qmod_variable.py +11 -10
- classiq/qmod/quantum_expandable.py +12 -15
- classiq/qmod/quantum_function.py +10 -3
- classiq/qmod/semantics/annotation.py +1 -1
- classiq/qmod/semantics/error_manager.py +8 -7
- classiq/qmod/semantics/static_semantics_visitor.py +19 -24
- classiq/qmod/semantics/validation/constants_validation.py +1 -1
- classiq/qmod/semantics/validation/func_call_validation.py +2 -2
- classiq/qmod/semantics/validation/main_validation.py +33 -0
- classiq/qmod/semantics/validation/types_validation.py +2 -1
- classiq/qmod/symbolic.py +5 -8
- classiq/qmod/symbolic_type.py +2 -2
- {classiq-0.53.0.dist-info → classiq-0.54.0.dist-info}/METADATA +1 -1
- {classiq-0.53.0.dist-info → classiq-0.54.0.dist-info}/RECORD +295 -292
- classiq/qmod/builtins/functions/qft.py +0 -23
- {classiq-0.53.0.dist-info → classiq-0.54.0.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import copy
|
2
2
|
from itertools import chain, product
|
3
|
-
from typing import Callable,
|
3
|
+
from typing import Callable, Union
|
4
4
|
|
5
5
|
import pyomo.environ as pyo
|
6
6
|
from pyomo.core.base import _GeneralVarData
|
@@ -61,7 +61,7 @@ class ModelEncoder:
|
|
61
61
|
self._encode_objective()
|
62
62
|
|
63
63
|
@property
|
64
|
-
def _shift_substitution_dict(self) ->
|
64
|
+
def _shift_substitution_dict(self) -> dict[int, pyo.Expression]:
|
65
65
|
variables = pyomo_utils.extract(self.encoded_model, pyo.Var)
|
66
66
|
return {id(var): var + var.lb for var in variables}
|
67
67
|
|
@@ -97,7 +97,7 @@ class ModelEncoder:
|
|
97
97
|
return vars_encoding_mapping
|
98
98
|
|
99
99
|
def _get_encoding_expr(
|
100
|
-
self, var_data: _GeneralVarData, encoding_vars:
|
100
|
+
self, var_data: _GeneralVarData, encoding_vars: list[_GeneralVarData]
|
101
101
|
) -> pyo.Expression:
|
102
102
|
if self.encoding_type == EncodingType.BINARY:
|
103
103
|
var_span = encoding_utils.get_var_span(var_data)
|
@@ -117,8 +117,8 @@ class ModelEncoder:
|
|
117
117
|
return encoding_expr
|
118
118
|
|
119
119
|
def _get_binary_coeffs(
|
120
|
-
self, encoding_vars:
|
121
|
-
) ->
|
120
|
+
self, encoding_vars: list[_GeneralVarData], var_span: int
|
121
|
+
) -> list[int]:
|
122
122
|
num_vars = len(encoding_vars)
|
123
123
|
if self.qsolver == QSolver.QAOAMixer:
|
124
124
|
return [2**idx for idx in range(num_vars)]
|
@@ -128,7 +128,7 @@ class ModelEncoder:
|
|
128
128
|
coeffs += [var_span - sum(coeffs)]
|
129
129
|
return coeffs
|
130
130
|
|
131
|
-
def _get_encoding_idxs(self, variable: pyo.Var) ->
|
131
|
+
def _get_encoding_idxs(self, variable: pyo.Var) -> list[tuple[int, int]]:
|
132
132
|
return list(
|
133
133
|
chain(
|
134
134
|
*[
|
@@ -155,7 +155,7 @@ class ModelEncoder:
|
|
155
155
|
)
|
156
156
|
|
157
157
|
def _add_rule_constraint(
|
158
|
-
self, constraint_name: str, idxs:
|
158
|
+
self, constraint_name: str, idxs: list[int], rule: Callable
|
159
159
|
) -> None:
|
160
160
|
encoding_constraint = pyo.Constraint(idxs, rule=rule)
|
161
161
|
|
@@ -172,7 +172,7 @@ class ModelEncoder:
|
|
172
172
|
def encode_expr(
|
173
173
|
self,
|
174
174
|
expr: pyo.Expression,
|
175
|
-
substitution_dict: Union[
|
175
|
+
substitution_dict: Union[dict[int, pyo.Expression], None] = None,
|
176
176
|
) -> pyo.Expression:
|
177
177
|
if substitution_dict is None:
|
178
178
|
substitution_dict = self.vars_encoding_mapping.substitution_dict
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import copy
|
2
|
-
from typing import
|
2
|
+
from typing import Union
|
3
3
|
|
4
4
|
from pyomo.core import ConcreteModel, Var
|
5
5
|
from pyomo.core.base.constraint import _GeneralConstraintData
|
@@ -74,14 +74,14 @@ def _change_fixing_constraints_to_fixed_value(model: ConcreteModel) -> None:
|
|
74
74
|
pyomo_utils.delete_component(model, constraint)
|
75
75
|
|
76
76
|
|
77
|
-
def _get_fixing_constraints(model: ConcreteModel) ->
|
77
|
+
def _get_fixing_constraints(model: ConcreteModel) -> list[_GeneralConstraintData]:
|
78
78
|
constraints = pyomo_utils.extract(model, _GeneralConstraintData)
|
79
79
|
return list(filter(_is_fixing_constraint, constraints))
|
80
80
|
|
81
81
|
|
82
82
|
def _get_var_and_value_from_fixing_constraint(
|
83
83
|
constraint: _GeneralConstraintData,
|
84
|
-
) ->
|
84
|
+
) -> tuple[_GeneralVarData, float]:
|
85
85
|
var = next(identify_variables(constraint.body))
|
86
86
|
|
87
87
|
if isinstance(constraint.body, _GeneralVarData):
|
@@ -110,8 +110,8 @@ def _remove_empty_constraints(model: ConcreteModel) -> None:
|
|
110
110
|
|
111
111
|
|
112
112
|
def add_fixed_variables_to_solution(
|
113
|
-
original_model: ConcreteModel, solution:
|
114
|
-
) ->
|
113
|
+
original_model: ConcreteModel, solution: list[int]
|
114
|
+
) -> list[int]:
|
115
115
|
variables = pyomo_utils.extract(original_model, Var)
|
116
116
|
solution_iter = iter(solution)
|
117
117
|
# var.value might be 0 as well
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
import pyomo
|
4
2
|
import sympy as sp
|
5
3
|
from pyomo.core.base import _GeneralVarData
|
@@ -20,8 +18,8 @@ PYOMO_PARSING_ERROR_MESAGE = "Parsing of this pyomo model is not supported."
|
|
20
18
|
|
21
19
|
def convert_pyomo_to_hamiltonian(
|
22
20
|
pyomo_expr: pyomo.core.Expression,
|
23
|
-
ordered_pyomo_vars:
|
24
|
-
qregs:
|
21
|
+
ordered_pyomo_vars: list[_GeneralVarData],
|
22
|
+
qregs: list[InternalQuantumReg],
|
25
23
|
) -> PauliOperator:
|
26
24
|
symbols_map = sympyify_vars(ordered_pyomo_vars)
|
27
25
|
sympy_expr = sympyify_expression(pyomo_expr, symbols_map)
|
@@ -41,7 +39,7 @@ def convert_pyomo_to_hamiltonian(
|
|
41
39
|
|
42
40
|
|
43
41
|
def _convert_ising_sympy_to_operator(
|
44
|
-
ising_expr: sp.Expr, ordered_sympy_vars:
|
42
|
+
ising_expr: sp.Expr, ordered_sympy_vars: list[sp.Symbol]
|
45
43
|
) -> custom_pydantic_types.PydanticPauliList:
|
46
44
|
pauli_op_list: custom_pydantic_types.PydanticPauliList = []
|
47
45
|
for expr_term in ising_expr.args:
|
@@ -87,7 +85,7 @@ def _to_ising_symbolic_objective_function(objective: sp.Expr) -> sp.Expr:
|
|
87
85
|
return sp.expand(objective_ising)
|
88
86
|
|
89
87
|
|
90
|
-
def _get_vars(expr_term: sp.AtomicExpr) ->
|
88
|
+
def _get_vars(expr_term: sp.AtomicExpr) -> list[sp.Symbol]:
|
91
89
|
if isinstance(expr_term, sp.Symbol):
|
92
90
|
return [expr_term]
|
93
91
|
else:
|
@@ -95,8 +93,8 @@ def _get_vars(expr_term: sp.AtomicExpr) -> List[sp.Symbol]:
|
|
95
93
|
|
96
94
|
|
97
95
|
def _find_sub_list_items(
|
98
|
-
long_list:
|
99
|
-
) ->
|
96
|
+
long_list: list[sp.Symbol], sub_list: list[sp.Symbol]
|
97
|
+
) -> list[bool]:
|
100
98
|
return [x in sub_list for x in long_list]
|
101
99
|
|
102
100
|
|
@@ -111,7 +109,7 @@ def _get_coeff_from_expr(expr: sp.Expr) -> float:
|
|
111
109
|
|
112
110
|
|
113
111
|
def _add_auxiliary_qubits_to_operator(
|
114
|
-
operator: custom_pydantic_types.PydanticPauliList, qregs:
|
112
|
+
operator: custom_pydantic_types.PydanticPauliList, qregs: list[InternalQuantumReg]
|
115
113
|
) -> custom_pydantic_types.PydanticPauliList:
|
116
114
|
# TODO: handle the case when the auxiliary are in the middle of the circuit
|
117
115
|
for qreg in qregs:
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import itertools
|
2
|
-
from typing import List
|
3
2
|
|
4
3
|
from pyomo.core.base.constraint import _GeneralConstraintData
|
5
4
|
from pyomo.core.expr.relational_expr import EqualityExpression
|
@@ -7,7 +6,7 @@ from pyomo.environ import Expression
|
|
7
6
|
|
8
7
|
|
9
8
|
def get_penalty_expression(
|
10
|
-
flat_constraints:
|
9
|
+
flat_constraints: list[_GeneralConstraintData],
|
11
10
|
) -> Expression:
|
12
11
|
return sum(
|
13
12
|
_convert_constraint_to_penalty_term(constraint)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
from itertools import filterfalse
|
2
|
-
from typing import List, Tuple
|
3
2
|
|
4
3
|
from sympy import (
|
5
4
|
Add,
|
@@ -43,7 +42,7 @@ def sign_separation(expr: Expr) -> LessThan:
|
|
43
42
|
return modified_expr
|
44
43
|
|
45
44
|
|
46
|
-
def _get_positive_and_negative_args(expr: Expr) ->
|
45
|
+
def _get_positive_and_negative_args(expr: Expr) -> tuple[list[Expr], list[Expr]]:
|
47
46
|
positive_args = []
|
48
47
|
negative_args = []
|
49
48
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import math
|
2
2
|
from functools import cached_property
|
3
3
|
from itertools import filterfalse
|
4
|
-
from typing import List
|
5
4
|
|
6
5
|
import pyomo.core as pyo
|
7
6
|
from pyomo.core.base.component import _ComponentBase
|
@@ -67,7 +66,7 @@ class ConstraintConvertor:
|
|
67
66
|
return max_upper - min_lower
|
68
67
|
|
69
68
|
@cached_property
|
70
|
-
def _slack_coeffs(self) ->
|
69
|
+
def _slack_coeffs(self) -> list[int]:
|
71
70
|
coeffs = [2**idx for idx in self.slack_var_idxs[:-1]]
|
72
71
|
coeffs += [self._bound_int - sum(coeffs)]
|
73
72
|
return coeffs
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from classiq.interface.combinatorial_optimization import examples
|
4
2
|
from classiq.interface.combinatorial_optimization.encoding_types import EncodingType
|
5
3
|
from classiq.interface.combinatorial_optimization.solver_types import QSolver
|
@@ -28,5 +26,5 @@ __all__ = [
|
|
28
26
|
]
|
29
27
|
|
30
28
|
|
31
|
-
def __dir__() ->
|
29
|
+
def __dir__() -> list[str]:
|
32
30
|
return __all__
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import dataclasses
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import
|
3
|
+
from typing import Optional
|
4
4
|
|
5
5
|
from classiq.interface.executor.optimizer_preferences import CostType, OptimizerType
|
6
6
|
|
@@ -20,4 +20,4 @@ class OptimizerConfig:
|
|
20
20
|
skip_compute_variance: bool = False
|
21
21
|
cost_type: CostType = CostType.CVAR
|
22
22
|
alpha_cvar: float = 1.0
|
23
|
-
initial_point: Optional[
|
23
|
+
initial_point: Optional[list[float]] = dataclasses.field(default=None)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from classiq.interface.combinatorial_optimization.examples.ascending_sequence import (
|
4
2
|
ascending_sequence,
|
5
3
|
)
|
@@ -47,5 +45,5 @@ __all__ = [
|
|
47
45
|
]
|
48
46
|
|
49
47
|
|
50
|
-
def __dir__() ->
|
48
|
+
def __dir__() -> list[str]:
|
51
49
|
return __all__
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List, Tuple
|
2
|
-
|
3
1
|
from classiq.interface.generator.expressions.expression import Expression
|
4
2
|
from classiq.interface.generator.functions.port_declaration import (
|
5
3
|
PortDeclarationDirection,
|
@@ -28,10 +26,10 @@ _PREDICATE_FUNCTION_NAME = "expr_predicate"
|
|
28
26
|
|
29
27
|
|
30
28
|
def _arithmetic_oracle_ios(
|
31
|
-
definitions:
|
32
|
-
) ->
|
29
|
+
definitions: list[tuple[str, RegisterUserInput]], handle_name: str
|
30
|
+
) -> list[HandleBinding]:
|
33
31
|
cursor = 0
|
34
|
-
ios:
|
32
|
+
ios: list[HandleBinding] = []
|
35
33
|
for _, reg in definitions:
|
36
34
|
ios.append(
|
37
35
|
SlicedHandleBinding(
|
@@ -46,7 +44,7 @@ def _arithmetic_oracle_ios(
|
|
46
44
|
|
47
45
|
def _construct_arithmetic_oracle(
|
48
46
|
predicate_function: str,
|
49
|
-
definitions:
|
47
|
+
definitions: list[tuple[str, RegisterUserInput]],
|
50
48
|
) -> QuantumFunctionCall:
|
51
49
|
predicate_var_binding = _arithmetic_oracle_ios(definitions, "state")
|
52
50
|
predicate_var_binding.append(HandleBinding(name="oracle"))
|
@@ -68,9 +66,9 @@ def _construct_arithmetic_oracle(
|
|
68
66
|
|
69
67
|
|
70
68
|
def grover_main_port_declarations(
|
71
|
-
definitions:
|
69
|
+
definitions: list[tuple[str, RegisterUserInput]],
|
72
70
|
direction: PortDeclarationDirection,
|
73
|
-
) ->
|
71
|
+
) -> list[PortDeclaration]:
|
74
72
|
return [
|
75
73
|
PortDeclaration(
|
76
74
|
name=name,
|
@@ -86,7 +84,7 @@ def grover_main_port_declarations(
|
|
86
84
|
|
87
85
|
|
88
86
|
def construct_grover_model(
|
89
|
-
definitions:
|
87
|
+
definitions: list[tuple[str, RegisterUserInput]],
|
90
88
|
expression: str,
|
91
89
|
num_reps: int = 1,
|
92
90
|
) -> SerializedModel:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Union
|
2
2
|
|
3
3
|
import numpy as np
|
4
4
|
from sympy import fwht
|
@@ -17,7 +17,7 @@ PAULI_MATRICES_DICT = {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
|
20
|
-
def _get_pauli_string(set_index: int, term_index: int, num_qubits: int) ->
|
20
|
+
def _get_pauli_string(set_index: int, term_index: int, num_qubits: int) -> list[Pauli]:
|
21
21
|
"""
|
22
22
|
The basis of 4^N Pauli strings on N qubits can be partitioned to 2^N sets, each contains 2^N Pauli strings.
|
23
23
|
In the k-th set we have Pauli strings of the form s_1s_2...s_N, where s_j is in {I,Z} if k_j is 0,
|
@@ -25,7 +25,7 @@ def _get_pauli_string(set_index: int, term_index: int, num_qubits: int) -> List[
|
|
25
25
|
"""
|
26
26
|
|
27
27
|
# returns the Pauli (I,Z) or (iY, X) appearing in the pauli_index position for a given set
|
28
|
-
def _get_paulis_for_set(set_index: int, pauli_index: int) ->
|
28
|
+
def _get_paulis_for_set(set_index: int, pauli_index: int) -> tuple[Pauli, Pauli]:
|
29
29
|
if (set_index >> pauli_index) & 1:
|
30
30
|
return Pauli.Y, Pauli.X
|
31
31
|
else:
|
@@ -63,7 +63,7 @@ def _get_signed_coefficient(
|
|
63
63
|
|
64
64
|
def matrix_to_hamiltonian(
|
65
65
|
mat: np.ndarray, tol: float = ATOL, is_hermitian: bool = True
|
66
|
-
) ->
|
66
|
+
) -> list[PauliTerm]:
|
67
67
|
"""
|
68
68
|
The decomposition per set is done by the Walsh-Hadamard transform,
|
69
69
|
since the transformation between {e_0,e_3} ({e_1,e_2}) to {I,Z} ({X,iY}) is the Hadamard matrix.
|
@@ -94,7 +94,7 @@ def matrix_to_hamiltonian(
|
|
94
94
|
|
95
95
|
|
96
96
|
# convert a single puali string of length N to 2**N X 2**N matrix
|
97
|
-
def pauli_string_to_mat(seq:
|
97
|
+
def pauli_string_to_mat(seq: list[Pauli]) -> np.ndarray:
|
98
98
|
real_matrix = PAULI_MATRICES_DICT[seq[0]]
|
99
99
|
for p in seq[1:]:
|
100
100
|
real_matrix = np.kron(real_matrix, PAULI_MATRICES_DICT[p])
|
@@ -102,7 +102,7 @@ def pauli_string_to_mat(seq: List[Pauli]) -> np.ndarray:
|
|
102
102
|
|
103
103
|
|
104
104
|
# return matrix from hamiltonian
|
105
|
-
def hamiltonian_to_matrix(hamiltonian:
|
105
|
+
def hamiltonian_to_matrix(hamiltonian: list[PauliTerm]) -> np.ndarray:
|
106
106
|
matrix = np.zeros(
|
107
107
|
[2 ** len(hamiltonian[0].pauli), 2 ** len(hamiltonian[0].pauli)],
|
108
108
|
dtype=np.complex_,
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# This file will be called first whenever any file from within this directory is imported.
|
2
2
|
# Thus, we'll test dependencies only here, once.
|
3
|
-
from typing import List
|
4
|
-
|
5
3
|
try:
|
6
4
|
import torch
|
7
5
|
except ImportError as exc:
|
@@ -13,5 +11,5 @@ from ..qnn.qlayer import QLayer
|
|
13
11
|
__all__ = ["datasets", "types", "QLayer"]
|
14
12
|
|
15
13
|
|
16
|
-
def __dir__() ->
|
14
|
+
def __dir__() -> list[str]:
|
17
15
|
return __all__
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import itertools
|
2
|
-
from collections.abc import Collection
|
3
|
-
from typing import
|
2
|
+
from collections.abc import Collection, Iterable
|
3
|
+
from typing import Union
|
4
4
|
|
5
5
|
from torch import Tensor
|
6
6
|
|
@@ -14,8 +14,8 @@ from classiq.applications.qnn.types import Arguments, Circuit
|
|
14
14
|
WEIGHT_INITIALS = ["weight_", "w_"]
|
15
15
|
INPUT_INITIALS = ["input_", "i_"]
|
16
16
|
|
17
|
-
Parameters =
|
18
|
-
ParametersTuple =
|
17
|
+
Parameters = list[str]
|
18
|
+
ParametersTuple = tuple[Parameters, Parameters]
|
19
19
|
|
20
20
|
|
21
21
|
def _is_name_valid(name: str) -> bool:
|
@@ -46,7 +46,7 @@ def validate_circuit(circuit: Circuit) -> bool:
|
|
46
46
|
return True
|
47
47
|
|
48
48
|
|
49
|
-
def _extract_by_prefix(lst: Parameters, prefix:
|
49
|
+
def _extract_by_prefix(lst: Parameters, prefix: list[str]) -> Parameters:
|
50
50
|
return [s for s in lst if any(s.startswith(p) for p in prefix)]
|
51
51
|
|
52
52
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from abc import ABC, abstractmethod
|
2
|
-
from
|
2
|
+
from collections.abc import Sequence
|
3
|
+
from typing import Literal, Optional, TypeVar, Union
|
3
4
|
|
4
5
|
from torch import Tensor, tensor
|
5
6
|
from torch.utils.data import Dataset
|
@@ -30,7 +31,7 @@ class MyDataset(Dataset, ABC):
|
|
30
31
|
def _get_data_and_label(self, index: int) -> DataAndLabel:
|
31
32
|
pass
|
32
33
|
|
33
|
-
def __getitem__(self, index: int) ->
|
34
|
+
def __getitem__(self, index: int) -> tuple[Tensor, Tensor]:
|
34
35
|
if index < 0 or index >= len(self):
|
35
36
|
raise ClassiqIndexError(f"{self.__class__.__name__} out of range")
|
36
37
|
|
@@ -54,7 +55,7 @@ class MySubsetDataset(MyDataset, ABC):
|
|
54
55
|
def __init__(
|
55
56
|
self,
|
56
57
|
n: int = 2,
|
57
|
-
subset: Union[
|
58
|
+
subset: Union[list[int], Literal["all"]] = "all",
|
58
59
|
transform: Optional[Transform] = None,
|
59
60
|
target_transform: Optional[Transform] = None,
|
60
61
|
) -> None:
|
@@ -74,5 +75,5 @@ class MySubsetDataset(MyDataset, ABC):
|
|
74
75
|
'Invalid subset - please enter a `list` of `int`, or the string "all"'
|
75
76
|
)
|
76
77
|
|
77
|
-
def _get_subset(self, coll: Sequence[T]) ->
|
78
|
+
def _get_subset(self, coll: Sequence[T]) -> list[T]:
|
78
79
|
return [coll[i] for i in self._subset]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Literal, Optional, Union
|
2
2
|
|
3
3
|
from classiq.applications.qnn.datasets.dataset_base_classes import MySubsetDataset
|
4
4
|
from classiq.applications.qnn.types import DataAndLabel, Transform
|
@@ -8,7 +8,7 @@ class DatasetSubsetParity(MySubsetDataset):
|
|
8
8
|
def __init__(
|
9
9
|
self,
|
10
10
|
n: int = 2,
|
11
|
-
subset: Union[
|
11
|
+
subset: Union[list[int], Literal["all"]] = "all",
|
12
12
|
add_readout_qubit: bool = True,
|
13
13
|
transform: Optional[Transform] = None,
|
14
14
|
target_transform: Optional[Transform] = None,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import functools
|
2
|
-
from typing import Any, Callable, Optional,
|
2
|
+
from typing import Any, Callable, Optional, Union
|
3
3
|
|
4
4
|
import torch
|
5
5
|
import torch.nn as nn
|
@@ -99,7 +99,7 @@ class QLayerFunction(torch.autograd.Function):
|
|
99
99
|
@staticmethod
|
100
100
|
def backward( # type: ignore[override]
|
101
101
|
ctx: Any, grad_output: Tensor
|
102
|
-
) ->
|
102
|
+
) -> tuple[Optional[Tensor], Optional[Tensor], None, None, None, None]:
|
103
103
|
"""
|
104
104
|
grad_output: Tensor
|
105
105
|
is of shape (ctx.batch_size, ctx.num_out_features)
|
@@ -176,7 +176,7 @@ class QLayer(nn.Module):
|
|
176
176
|
self._initialize_parameters()
|
177
177
|
|
178
178
|
def _initialize_parameters(self) -> None:
|
179
|
-
shape:
|
179
|
+
shape: tuple[int, ...] = (
|
180
180
|
(self.out_features, self.in_features)
|
181
181
|
if self.out_features > 1
|
182
182
|
else (self.in_features,)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from collections.abc import Sized
|
2
2
|
from functools import reduce
|
3
|
-
from typing import Optional
|
3
|
+
from typing import Optional
|
4
4
|
|
5
5
|
import torch
|
6
6
|
import torch.nn as nn
|
@@ -98,7 +98,7 @@ def iter_inputs_weights(
|
|
98
98
|
) -> Tensor:
|
99
99
|
if is_single_layer_circuit(weights):
|
100
100
|
iter_weights = torch.reshape(weights, (1, weights.shape[0]))
|
101
|
-
inputs_weights_shape:
|
101
|
+
inputs_weights_shape: tuple[int, ...] = (inputs.shape[0],)
|
102
102
|
else:
|
103
103
|
iter_weights = weights
|
104
104
|
inputs_weights_shape = (inputs.shape[0], weights.shape[0])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Callable,
|
1
|
+
from typing import Callable, Union
|
2
2
|
|
3
3
|
import torch
|
4
4
|
from torch import Tensor
|
@@ -8,8 +8,8 @@ from classiq.interface.executor.execution_result import ResultsCollection, Saved
|
|
8
8
|
from classiq import QuantumProgram
|
9
9
|
from classiq.synthesis import SerializedQuantumProgram
|
10
10
|
|
11
|
-
Arguments =
|
12
|
-
MultipleArguments =
|
11
|
+
Arguments = dict[str, float]
|
12
|
+
MultipleArguments = tuple[Arguments, ...]
|
13
13
|
|
14
14
|
Circuit = QuantumProgram
|
15
15
|
ExecuteFunction = Callable[
|
@@ -19,10 +19,10 @@ ExecuteFuncitonOnlyArguments = Callable[[MultipleArguments], ResultsCollection]
|
|
19
19
|
PostProcessFunction = Callable[[SavedResult], Tensor]
|
20
20
|
TensorToArgumentsCallable = Callable[[Tensor, Tensor], MultipleArguments]
|
21
21
|
|
22
|
-
Shape = Union[torch.Size,
|
22
|
+
Shape = Union[torch.Size, tuple[int, ...]]
|
23
23
|
|
24
24
|
GradientFunction = Callable[[Tensor, Tensor], Tensor]
|
25
25
|
SimulateFunction = Callable[[Tensor, Tensor], Tensor]
|
26
26
|
|
27
|
-
DataAndLabel =
|
27
|
+
DataAndLabel = tuple[list[int], Union[list[int], int]]
|
28
28
|
Transform = Callable[[Tensor], Tensor]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import logging
|
2
2
|
from collections import defaultdict
|
3
|
-
from typing import
|
3
|
+
from typing import Optional
|
4
4
|
|
5
5
|
import numpy as np
|
6
6
|
|
@@ -15,7 +15,7 @@ def generate_data(
|
|
15
15
|
range_max: float = 2 * np.pi,
|
16
16
|
std: float = 0.5,
|
17
17
|
sources: Optional[np.ndarray] = None,
|
18
|
-
) ->
|
18
|
+
) -> dict[int, np.ndarray]:
|
19
19
|
if sources is None:
|
20
20
|
sources = np.random.uniform(
|
21
21
|
range_min, range_max, (amount_of_sources, dimension)
|
@@ -36,7 +36,7 @@ def generate_data(
|
|
36
36
|
return results
|
37
37
|
|
38
38
|
|
39
|
-
def data_dict_to_data_and_labels(data_dict: dict) ->
|
39
|
+
def data_dict_to_data_and_labels(data_dict: dict) -> tuple[np.ndarray, np.ndarray]:
|
40
40
|
data = []
|
41
41
|
labels = []
|
42
42
|
for k, v in data_dict.items():
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any
|
1
|
+
from typing import Any
|
2
2
|
|
3
3
|
from classiq.interface.applications.qsvm import DataList, LabelsInt
|
4
4
|
from classiq.interface.exceptions import ClassiqValueError
|
@@ -22,19 +22,19 @@ _OUTPUT_VARIABLE_NAME = "qsvm_results"
|
|
22
22
|
|
23
23
|
def _bloch_sphere_feature_map_function_params(
|
24
24
|
bloch_feature_dimension: int,
|
25
|
-
) ->
|
25
|
+
) -> tuple[list[Expression], str]:
|
26
26
|
return [
|
27
27
|
Expression(expr=f"{bloch_feature_dimension}")
|
28
28
|
], f"ceiling({bloch_feature_dimension}/2)"
|
29
29
|
|
30
30
|
|
31
31
|
def _pauli_feature_map_function_params(
|
32
|
-
paulis:
|
32
|
+
paulis: list[list[Pauli]],
|
33
33
|
entanglement: QSVMFeatureMapEntanglement,
|
34
34
|
alpha: int,
|
35
35
|
reps: int,
|
36
36
|
feature_dimension: int,
|
37
|
-
) ->
|
37
|
+
) -> tuple[list[Expression], str]:
|
38
38
|
paulis_str = (
|
39
39
|
"["
|
40
40
|
+ ",".join(
|
@@ -61,7 +61,7 @@ def _pauli_feature_map_function_params(
|
|
61
61
|
|
62
62
|
def get_qsvm_qmain_body(
|
63
63
|
feature_map_function_name: str, **kwargs: Any
|
64
|
-
) ->
|
64
|
+
) -> list[QuantumFunctionCall]:
|
65
65
|
if feature_map_function_name == "bloch_sphere_feature_map":
|
66
66
|
params, size_expr = _bloch_sphere_feature_map_function_params(**kwargs)
|
67
67
|
elif feature_map_function_name == "pauli_feature_map":
|
classiq/execution/__init__.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from ..executor import * # noqa: F403
|
4
2
|
from ..executor import __all__ as _exec_all
|
5
3
|
from ..interface.backend.backend_preferences import * # noqa: F403
|
@@ -35,5 +33,5 @@ __all__ = (
|
|
35
33
|
)
|
36
34
|
|
37
35
|
|
38
|
-
def __dir__() ->
|
36
|
+
def __dir__() -> list[str]:
|
39
37
|
return __all__
|
@@ -1,12 +1,10 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from classiq.interface.hardware import HardwareInformation
|
4
2
|
|
5
3
|
from classiq._internals import async_utils
|
6
4
|
from classiq._internals.api_wrapper import ApiWrapper
|
7
5
|
|
8
6
|
|
9
|
-
def get_all_hardware_devices() ->
|
7
|
+
def get_all_hardware_devices() -> list[HardwareInformation]:
|
10
8
|
"""
|
11
9
|
Returns a list of all hardware devices known to Classiq.
|
12
10
|
"""
|