classiq 0.52.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 +23 -17
- 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 +11 -13
- 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 +25 -6
- 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 +3 -3
- classiq/execution/all_hardware_devices.py +1 -3
- classiq/execution/execution_session.py +57 -16
- classiq/execution/iqcc.py +1 -1
- classiq/execution/jobs.py +4 -4
- classiq/execution/qaoa.py +84 -0
- classiq/execution/qnn.py +3 -3
- classiq/executor.py +4 -4
- 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 +11 -7
- classiq/interface/execution/iqcc.py +1 -3
- 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 +35 -28
- 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/dotdict.py +18 -0
- 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 +33 -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/native_function_definition.py +10 -0
- 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 +164 -38
- 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/__init__.py +2 -0
- classiq/qmod/builtins/classical_execution_primitives.py +9 -9
- classiq/qmod/builtins/functions/__init__.py +75 -53
- 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 +18 -18
- 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 +53 -0
- 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 +19 -8
- 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_parameter.py +3 -1
- classiq/qmod/qmod_variable.py +11 -10
- classiq/qmod/quantum_expandable.py +32 -15
- classiq/qmod/quantum_function.py +34 -5
- 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/qmod/synthesize_separately.py +16 -0
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/METADATA +1 -1
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/RECORD +302 -295
- classiq/qmod/builtins/functions/qft.py +0 -23
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/WHEEL +0 -0
@@ -1,9 +1,8 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import
|
2
|
+
from typing import Annotated, Literal, Optional, Union
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
from pydantic import BaseModel, Field
|
6
|
-
from typing_extensions import Annotated
|
7
6
|
|
8
7
|
from classiq.interface.executor.estimation import OperatorsEstimation
|
9
8
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
@@ -63,4 +62,4 @@ class ExecutionJobDetails(VersionedModel):
|
|
63
62
|
|
64
63
|
|
65
64
|
class ExecutionJobsQueryResults(VersionedModel):
|
66
|
-
results:
|
65
|
+
results: list[ExecutionJobDetails]
|
@@ -1,7 +1,7 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Annotated, Any, Literal, Union
|
2
2
|
|
3
3
|
from pydantic import BaseModel, ConfigDict, Field
|
4
|
-
from typing_extensions import
|
4
|
+
from typing_extensions import TypeAlias
|
5
5
|
|
6
6
|
from classiq.interface.enum_utils import StrEnum
|
7
7
|
from classiq.interface.executor.iqae_result import IQAEResult
|
@@ -104,7 +104,7 @@ SavedResult = Annotated[
|
|
104
104
|
Field(..., discriminator="value_type"),
|
105
105
|
]
|
106
106
|
|
107
|
-
ResultsCollection: TypeAlias =
|
107
|
+
ResultsCollection: TypeAlias = list[SavedResult]
|
108
108
|
|
109
109
|
|
110
110
|
class ExecuteGeneratedCircuitResults(VersionedModel):
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from pydantic import BaseModel, Field
|
4
2
|
|
5
3
|
from classiq.interface.executor.result import ExecutionDetails
|
@@ -14,6 +12,6 @@ class IQAEIterationData(BaseModel):
|
|
14
12
|
|
15
13
|
class IQAEResult(VersionedModel, QmodPyObject):
|
16
14
|
estimation: float
|
17
|
-
confidence_interval:
|
18
|
-
iterations_data:
|
19
|
-
warnings:
|
15
|
+
confidence_interval: list[float] = Field(min_length=2, max_length=2)
|
16
|
+
iterations_data: list[IQAEIterationData]
|
17
|
+
warnings: list[str]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Optional
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
from pydantic import BaseModel
|
@@ -45,7 +45,7 @@ class OptimizerPreferences(BaseModel):
|
|
45
45
|
default=None,
|
46
46
|
description="The random seed used for the generation",
|
47
47
|
)
|
48
|
-
initial_point: Optional[
|
48
|
+
initial_point: Optional[list[float]] = pydantic.Field(
|
49
49
|
default=None,
|
50
50
|
description="Initial values for the ansatz parameters",
|
51
51
|
)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
from pathlib import Path
|
4
|
-
from typing import Any,
|
4
|
+
from typing import Any, Optional, Union
|
5
5
|
|
6
6
|
import pydantic
|
7
7
|
from pydantic import BaseModel, ConfigDict
|
@@ -16,12 +16,12 @@ from classiq.interface.generator.synthesis_metadata.synthesis_execution_data imp
|
|
16
16
|
ExecutionData,
|
17
17
|
)
|
18
18
|
|
19
|
-
Arguments =
|
20
|
-
MultipleArguments =
|
19
|
+
Arguments = dict[PydanticArgumentNameType, Any]
|
20
|
+
MultipleArguments = tuple[Arguments, ...]
|
21
21
|
CodeType = str
|
22
|
-
RegistersInitialization =
|
23
|
-
Qubits =
|
24
|
-
OutputQubitsMap =
|
22
|
+
RegistersInitialization = dict[str, RegisterInitialization]
|
23
|
+
Qubits = tuple[int, ...]
|
24
|
+
OutputQubitsMap = dict[str, Qubits]
|
25
25
|
|
26
26
|
|
27
27
|
class QuantumBaseCode(BaseModel):
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
import pydantic
|
4
2
|
from typing_extensions import Self
|
5
3
|
|
@@ -13,7 +11,7 @@ _NON_INTEGER_INITIALIZATION_ERROR_MSG: str = (
|
|
13
11
|
|
14
12
|
class RegisterInitialization(pydantic.BaseModel):
|
15
13
|
name: str
|
16
|
-
qubits:
|
14
|
+
qubits: list[int]
|
17
15
|
initial_condition: pydantic.NonNegativeInt
|
18
16
|
|
19
17
|
@pydantic.field_validator("initial_condition", mode="before")
|
@@ -25,7 +23,7 @@ class RegisterInitialization(pydantic.BaseModel):
|
|
25
23
|
|
26
24
|
@pydantic.model_validator(mode="after")
|
27
25
|
def _validate_register_initialization(self) -> Self:
|
28
|
-
qubits:
|
26
|
+
qubits: list[int] = self.qubits or []
|
29
27
|
initial_condition: int = self.initial_condition or 0
|
30
28
|
name: str = self.name or ""
|
31
29
|
|
@@ -1,16 +1,12 @@
|
|
1
1
|
import functools
|
2
2
|
import operator
|
3
3
|
from collections import defaultdict
|
4
|
+
from collections.abc import Iterator, Mapping
|
4
5
|
from typing import (
|
5
6
|
TYPE_CHECKING,
|
6
7
|
Any,
|
7
8
|
DefaultDict,
|
8
|
-
Dict,
|
9
|
-
Iterator,
|
10
|
-
List,
|
11
|
-
Mapping,
|
12
9
|
Optional,
|
13
|
-
Tuple,
|
14
10
|
Union,
|
15
11
|
)
|
16
12
|
|
@@ -24,6 +20,7 @@ from classiq.interface.generator.arith import number_utils
|
|
24
20
|
from classiq.interface.generator.complex_type import Complex
|
25
21
|
from classiq.interface.generator.functions.classical_type import QmodPyObject
|
26
22
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonNegIntTuple
|
23
|
+
from classiq.interface.helpers.dotdict import get_recursive_dotdict
|
27
24
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
28
25
|
|
29
26
|
_ILLEGAL_QUBIT_ERROR_MSG: str = "Illegal qubit index requested"
|
@@ -36,19 +33,29 @@ RegisterValue: TypeAlias = Union[float, int, list, dict]
|
|
36
33
|
MeasuredShots: TypeAlias = pydantic.NonNegativeInt
|
37
34
|
ParsedState: TypeAlias = Mapping[Name, RegisterValue]
|
38
35
|
ParsedStates: TypeAlias = Mapping[State, ParsedState]
|
39
|
-
Counts: TypeAlias =
|
40
|
-
StateVector: TypeAlias = Optional[
|
36
|
+
Counts: TypeAlias = dict[State, MeasuredShots]
|
37
|
+
StateVector: TypeAlias = Optional[dict[str, Complex]]
|
38
|
+
|
39
|
+
if TYPE_CHECKING:
|
40
|
+
DotAccessParsedState = Mapping[Name, Any]
|
41
|
+
else:
|
42
|
+
DotAccessParsedState = ParsedState
|
41
43
|
|
42
44
|
|
43
45
|
class SampledState(BaseModel):
|
44
|
-
state:
|
46
|
+
state: DotAccessParsedState
|
45
47
|
shots: MeasuredShots
|
46
48
|
|
47
49
|
def __repr__(self) -> str:
|
48
50
|
return f"{self.state}: {self.shots}"
|
49
51
|
|
52
|
+
@pydantic.field_validator("state", mode="after")
|
53
|
+
@classmethod
|
54
|
+
def _convert_state_to_dotdict(cls, state: ParsedState) -> DotAccessParsedState:
|
55
|
+
return {name: get_recursive_dotdict(value) for name, value in state.items()}
|
56
|
+
|
50
57
|
|
51
|
-
ParsedCounts: TypeAlias =
|
58
|
+
ParsedCounts: TypeAlias = list[SampledState]
|
52
59
|
|
53
60
|
|
54
61
|
class SimulatedState(BaseModel):
|
@@ -61,7 +68,7 @@ class SimulatedState(BaseModel):
|
|
61
68
|
|
62
69
|
|
63
70
|
SimulatedState.model_rebuild()
|
64
|
-
ParsedStateVector: TypeAlias =
|
71
|
+
ParsedStateVector: TypeAlias = list[SimulatedState]
|
65
72
|
|
66
73
|
|
67
74
|
class VaRResult(BaseModel):
|
@@ -70,10 +77,10 @@ class VaRResult(BaseModel):
|
|
70
77
|
|
71
78
|
|
72
79
|
class GroverSimulationResults(VersionedModel):
|
73
|
-
result:
|
80
|
+
result: dict[str, Any]
|
74
81
|
|
75
82
|
|
76
|
-
def _validate_qubit_indices(counts: Counts, indices:
|
83
|
+
def _validate_qubit_indices(counts: Counts, indices: tuple[int, ...]) -> None:
|
77
84
|
if not indices:
|
78
85
|
raise ClassiqError(_ILLEGAL_QUBIT_ERROR_MSG)
|
79
86
|
|
@@ -84,7 +91,7 @@ def _validate_qubit_indices(counts: Counts, indices: Tuple[int, ...]) -> None:
|
|
84
91
|
raise ClassiqError(_REPEATED_QUBIT_ERROR_MSG)
|
85
92
|
|
86
93
|
|
87
|
-
def _slice_str(s: str, indices:
|
94
|
+
def _slice_str(s: str, indices: tuple[int, ...]) -> str:
|
88
95
|
return "".join(s[i] for i in indices)
|
89
96
|
|
90
97
|
|
@@ -102,7 +109,7 @@ def get_sampled_state(
|
|
102
109
|
|
103
110
|
|
104
111
|
def reduce_parsed_states(
|
105
|
-
parsed_states: ParsedStates, outputs:
|
112
|
+
parsed_states: ParsedStates, outputs: tuple[Name, ...]
|
106
113
|
) -> ParsedStates:
|
107
114
|
return {
|
108
115
|
state: {
|
@@ -141,7 +148,7 @@ def prepare_parsed_state_vector(
|
|
141
148
|
|
142
149
|
|
143
150
|
class ExecutionDetails(BaseModel, QmodPyObject):
|
144
|
-
vendor_format_result:
|
151
|
+
vendor_format_result: dict[str, Any] = pydantic.Field(
|
145
152
|
..., description="Result in proprietary vendor format"
|
146
153
|
)
|
147
154
|
counts: Counts = pydantic.Field(
|
@@ -151,14 +158,14 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
151
158
|
True,
|
152
159
|
description="Is the qubit order of counts field such that the LSB is right?",
|
153
160
|
)
|
154
|
-
probabilities:
|
161
|
+
probabilities: dict[State, pydantic.NonNegativeFloat] = pydantic.Field(
|
155
162
|
default_factory=dict, description="Probabilities of each state"
|
156
163
|
)
|
157
164
|
parsed_states: ParsedStates = pydantic.Field(
|
158
165
|
default_factory=dict,
|
159
166
|
description="A mapping between the raw states of counts (bitstrings) to their parsed states (registers' values)",
|
160
167
|
)
|
161
|
-
histogram: Optional[
|
168
|
+
histogram: Optional[dict[State, pydantic.NonNegativeFloat]] = pydantic.Field(
|
162
169
|
None,
|
163
170
|
description="Histogram of probability per state (an alternative to counts)",
|
164
171
|
)
|
@@ -241,15 +248,15 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
241
248
|
return self.counts_of_qubits(*self.output_qubits_map[output_name])
|
242
249
|
|
243
250
|
def counts_of_multiple_outputs(
|
244
|
-
self, output_names:
|
245
|
-
) ->
|
251
|
+
self, output_names: tuple[Name, ...]
|
252
|
+
) -> dict[tuple[State, ...], pydantic.NonNegativeInt]:
|
246
253
|
if any(name not in self.output_qubits_map for name in output_names):
|
247
254
|
raise ClassiqError(_UNAVAILABLE_OUTPUT_ERROR_MSG)
|
248
255
|
|
249
|
-
output_regs:
|
256
|
+
output_regs: tuple[Qubits, ...] = tuple(
|
250
257
|
self.output_qubits_map[name] for name in output_names
|
251
258
|
)
|
252
|
-
reduced_counts: DefaultDict[
|
259
|
+
reduced_counts: DefaultDict[tuple[State, ...], int] = defaultdict(int)
|
253
260
|
for state_str, state_count in self.counts_by_qubit_order(
|
254
261
|
lsb_right=False
|
255
262
|
).items():
|
@@ -258,7 +265,7 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
258
265
|
return dict(reduced_counts)
|
259
266
|
|
260
267
|
def parsed_counts_of_outputs(
|
261
|
-
self, output_names: Union[Name,
|
268
|
+
self, output_names: Union[Name, tuple[Name, ...]]
|
262
269
|
) -> ParsedCounts:
|
263
270
|
if isinstance(output_names, Name):
|
264
271
|
output_names = (output_names,)
|
@@ -268,8 +275,8 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
268
275
|
reduced_parsed_states = reduce_parsed_states(self.parsed_states, output_names)
|
269
276
|
return get_parsed_counts(self.counts, reduced_parsed_states)
|
270
277
|
|
271
|
-
def register_output_from_qubits(self, qubits:
|
272
|
-
register_output:
|
278
|
+
def register_output_from_qubits(self, qubits: tuple[int, ...]) -> dict[float, int]:
|
279
|
+
register_output: dict[float, int] = {}
|
273
280
|
value_from_str_bin = functools.partial(
|
274
281
|
self._get_register_value_from_binary_string_results, register_qubits=qubits
|
275
282
|
)
|
@@ -285,7 +292,7 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
285
292
|
|
286
293
|
@staticmethod
|
287
294
|
def _get_register_value_from_binary_string_results(
|
288
|
-
binary_string: str, register_qubits:
|
295
|
+
binary_string: str, register_qubits: list[int]
|
289
296
|
) -> RegisterValue:
|
290
297
|
register_binary_string = "".join(
|
291
298
|
operator.itemgetter(*register_qubits)(binary_string)
|
@@ -294,7 +301,7 @@ class ExecutionDetails(BaseModel, QmodPyObject):
|
|
294
301
|
|
295
302
|
|
296
303
|
class MultipleExecutionDetails(VersionedModel):
|
297
|
-
details:
|
304
|
+
details: list[ExecutionDetails]
|
298
305
|
|
299
306
|
def __getitem__(self, index: int) -> ExecutionDetails:
|
300
307
|
return self.details[index]
|
@@ -303,7 +310,7 @@ class MultipleExecutionDetails(VersionedModel):
|
|
303
310
|
class EstimationMetadata(BaseModel, extra="allow"):
|
304
311
|
shots: Optional[pydantic.NonNegativeInt] = None
|
305
312
|
remapped_qubits: bool = False
|
306
|
-
input_qubit_map: Optional[
|
313
|
+
input_qubit_map: Optional[list[PydanticNonNegIntTuple]] = None
|
307
314
|
|
308
315
|
|
309
316
|
class EstimationResult(BaseModel, QmodPyObject):
|
@@ -317,7 +324,7 @@ class EstimationResult(BaseModel, QmodPyObject):
|
|
317
324
|
|
318
325
|
|
319
326
|
class EstimationResults(VersionedModel):
|
320
|
-
results:
|
327
|
+
results: list[EstimationResult]
|
321
328
|
|
322
329
|
def __len__(self) -> int:
|
323
330
|
return len(self.results)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import base64
|
2
2
|
import io
|
3
3
|
from datetime import datetime
|
4
|
-
from typing import
|
4
|
+
from typing import Optional
|
5
5
|
|
6
6
|
import pydantic
|
7
7
|
from PIL import Image
|
@@ -12,7 +12,7 @@ from classiq.interface.generator.complex_type import Complex
|
|
12
12
|
from classiq.interface.generator.functions.classical_type import QmodPyObject
|
13
13
|
from classiq.interface.helpers.custom_pydantic_types import PydanticProbabilityFloat
|
14
14
|
|
15
|
-
Solution =
|
15
|
+
Solution = tuple[int, ...]
|
16
16
|
|
17
17
|
|
18
18
|
class SolverResult(BaseModel):
|
@@ -34,13 +34,13 @@ class VQEIntermediateData(BaseModel):
|
|
34
34
|
iteration_number: pydantic.PositiveInt = pydantic.Field(
|
35
35
|
description="The iteration's number (evaluation count)"
|
36
36
|
)
|
37
|
-
parameters:
|
37
|
+
parameters: list[float] = pydantic.Field(
|
38
38
|
description="The optimizer parameters for the variational form"
|
39
39
|
)
|
40
40
|
mean_all_solutions: Optional[float] = pydantic.Field(
|
41
41
|
default=None, description="The mean score of all solutions in this iteration"
|
42
42
|
)
|
43
|
-
solutions:
|
43
|
+
solutions: list[SolutionData] = pydantic.Field(
|
44
44
|
description="Solutions found in this iteration, their score and"
|
45
45
|
"number of repetitions"
|
46
46
|
)
|
@@ -50,11 +50,11 @@ class VQEIntermediateData(BaseModel):
|
|
50
50
|
|
51
51
|
|
52
52
|
class VQESolverResult(SolverResult, QmodPyObject):
|
53
|
-
eigenstate:
|
54
|
-
reduced_probabilities: Optional[
|
53
|
+
eigenstate: dict[str, Complex]
|
54
|
+
reduced_probabilities: Optional[dict[str, float]] = None
|
55
55
|
optimized_circuit_sample_results: ExecutionDetails
|
56
|
-
intermediate_results:
|
57
|
-
optimal_parameters:
|
56
|
+
intermediate_results: list[VQEIntermediateData]
|
57
|
+
optimal_parameters: dict[str, float]
|
58
58
|
convergence_graph_str: str
|
59
59
|
num_solutions: Optional[int] = None
|
60
60
|
num_shots: int
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, Optional, Union
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
from pydantic import ConfigDict
|
@@ -52,7 +52,7 @@ class FinanceFunctionInput(pydantic.BaseModel):
|
|
52
52
|
|
53
53
|
@pydantic.model_validator(mode="before")
|
54
54
|
@classmethod
|
55
|
-
def _convert_f_if_str(cls, values: Any, info: ValidationInfo) ->
|
55
|
+
def _convert_f_if_str(cls, values: Any, info: ValidationInfo) -> dict[str, Any]:
|
56
56
|
if isinstance(values, dict):
|
57
57
|
f = values.get("f")
|
58
58
|
elif isinstance(values, FinanceFunctionInput):
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import math
|
2
|
-
from typing import
|
2
|
+
from typing import Literal, Optional
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
|
@@ -18,15 +18,15 @@ class GaussianModelInput(FinanceModelInput):
|
|
18
18
|
normal_max_value: float = pydantic.Field(
|
19
19
|
description="Min/max value to truncate the " "latent normal random variable Z"
|
20
20
|
)
|
21
|
-
default_probabilities:
|
21
|
+
default_probabilities: list[PydanticProbabilityFloat] = pydantic.Field(
|
22
22
|
description="default probabilities for each asset"
|
23
23
|
)
|
24
24
|
|
25
|
-
rhos:
|
25
|
+
rhos: list[pydantic.PositiveFloat] = pydantic.Field(
|
26
26
|
description="Sensitivities of default probability of assets "
|
27
27
|
"with respect to Z (1/sigma(Z))"
|
28
28
|
)
|
29
|
-
loss:
|
29
|
+
loss: list[int] = pydantic.Field(
|
30
30
|
description="List of ints signifying loss per asset"
|
31
31
|
)
|
32
32
|
min_loss: Optional[int] = pydantic.Field(
|
@@ -38,7 +38,7 @@ class GaussianModelInput(FinanceModelInput):
|
|
38
38
|
return len(self.rhos)
|
39
39
|
|
40
40
|
@property
|
41
|
-
def distribution_range(self) ->
|
41
|
+
def distribution_range(self) -> tuple[float, float]:
|
42
42
|
return 0, sum(self.loss)
|
43
43
|
|
44
44
|
@property
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Literal
|
1
|
+
from typing import Literal
|
2
2
|
|
3
3
|
import numpy as np
|
4
4
|
import pydantic
|
@@ -21,7 +21,7 @@ class LogNormalModelInput(FinanceModelInput):
|
|
21
21
|
)
|
22
22
|
|
23
23
|
@property
|
24
|
-
def distribution_range(self) ->
|
24
|
+
def distribution_range(self) -> tuple[float, float]:
|
25
25
|
mean = np.exp(self.mu + self.sigma**2 / 2)
|
26
26
|
variance = (np.exp(self.sigma**2) - 1) * np.exp(2 * self.mu + self.sigma**2)
|
27
27
|
stddev = np.sqrt(variance)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import abc
|
2
|
-
from typing import Tuple
|
3
2
|
|
4
3
|
from pydantic import ConfigDict
|
5
4
|
|
@@ -19,5 +18,5 @@ class FinanceModelInput(HashablePydanticBaseModel):
|
|
19
18
|
|
20
19
|
@property
|
21
20
|
@abc.abstractmethod
|
22
|
-
def distribution_range(self) ->
|
21
|
+
def distribution_range(self) -> tuple[float, float]:
|
23
22
|
pass
|
@@ -1,9 +1,7 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
import numpy as np
|
4
2
|
|
5
3
|
|
6
|
-
def get_rand_adjacency_matrix(num_vertices: int) ->
|
4
|
+
def get_rand_adjacency_matrix(num_vertices: int) -> list[list[bool]]:
|
7
5
|
adjacency_matrix = np.random.choice([0, 1], size=(num_vertices, num_vertices))
|
8
6
|
for i in range(num_vertices):
|
9
7
|
for j in range(num_vertices):
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Optional, Union
|
2
2
|
|
3
3
|
from pydantic import BaseModel
|
4
4
|
|
@@ -42,7 +42,7 @@ class EntanglingLayersArgs(CustomAnsatzArgs):
|
|
42
42
|
|
43
43
|
class RandomArgs(CustomAnsatzArgs):
|
44
44
|
gate_count: int = 100
|
45
|
-
gate_probabilities:
|
45
|
+
gate_probabilities: dict[str, float] = {"cx": 0.5, "u": 0.5}
|
46
46
|
random_seed: Optional[int] = None
|
47
47
|
|
48
48
|
|
@@ -52,11 +52,11 @@ class RandomTwoQubitGatesArgs(CustomAnsatzArgs):
|
|
52
52
|
|
53
53
|
|
54
54
|
class TwoLocalArgs(CustomAnsatzArgs):
|
55
|
-
rotation_blocks: Optional[Union[RotationBlocksType,
|
55
|
+
rotation_blocks: Optional[Union[RotationBlocksType, list[RotationBlocksType]]] = (
|
56
56
|
RotationBlocksType.ry
|
57
57
|
)
|
58
58
|
entanglement_blocks: Optional[
|
59
|
-
Union[EntanglementBlocksType,
|
59
|
+
Union[EntanglementBlocksType, list[EntanglementBlocksType]]
|
60
60
|
] = EntanglementBlocksType.cx
|
61
61
|
entanglement: EntanglementStructureType = EntanglementStructureType.full
|
62
62
|
reps: int = 3
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Union
|
2
2
|
|
3
3
|
from classiq.interface.generator.arith import number_utils
|
4
4
|
from classiq.interface.generator.arith.number_utils import (
|
@@ -45,7 +45,7 @@ def lower_bound(argument: RegisterOrConst) -> float:
|
|
45
45
|
return argument
|
46
46
|
|
47
47
|
|
48
|
-
def bounds(argument: RegisterOrConst) ->
|
48
|
+
def bounds(argument: RegisterOrConst) -> tuple[float, float]:
|
49
49
|
if isinstance(argument, RegisterArithmeticInfo):
|
50
50
|
return argument.bounds
|
51
51
|
return argument, argument
|
@@ -59,7 +59,7 @@ def limit_fraction_places(
|
|
59
59
|
return number_utils.limit_fraction_places(argument, machine_precision)
|
60
60
|
|
61
61
|
|
62
|
-
def arg_bounds_overlap(args:
|
62
|
+
def arg_bounds_overlap(args: tuple[RegisterOrConst, RegisterOrConst]) -> bool:
|
63
63
|
return (max(bounds(args[0])) - min(bounds(args[1]))) * (
|
64
64
|
min(bounds(args[0])) - max(bounds(args[1]))
|
65
65
|
) < 0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, Final, Optional
|
2
2
|
|
3
3
|
import networkx as nx
|
4
4
|
import pydantic
|
@@ -30,18 +30,18 @@ ARITHMETIC_EXPRESSION_GARBAGE_NAME: Final[str] = "expression_garbage"
|
|
30
30
|
|
31
31
|
class Arithmetic(ArithmeticExpressionABC):
|
32
32
|
target: Optional[RegisterArithmeticInfo] = None
|
33
|
-
inputs_to_save:
|
33
|
+
inputs_to_save: set[str] = pydantic.Field(default_factory=set)
|
34
34
|
|
35
35
|
@pydantic.field_validator("inputs_to_save")
|
36
36
|
@classmethod
|
37
37
|
def _validate_inputs_to_save(
|
38
|
-
cls, inputs_to_save:
|
39
|
-
) ->
|
38
|
+
cls, inputs_to_save: set[str], info: ValidationInfo
|
39
|
+
) -> set[str]:
|
40
40
|
assert all(reg in info.data.get("definitions", {}) for reg in inputs_to_save)
|
41
41
|
return inputs_to_save
|
42
42
|
|
43
43
|
@staticmethod
|
44
|
-
def _validate_expression_graph(graph: nx.DiGraph, values:
|
44
|
+
def _validate_expression_graph(graph: nx.DiGraph, values: dict[str, Any]) -> None:
|
45
45
|
target = values.get("target")
|
46
46
|
if target is None:
|
47
47
|
return
|
@@ -80,7 +80,7 @@ class Arithmetic(ArithmeticExpressionABC):
|
|
80
80
|
|
81
81
|
def get_arithmetic_params(
|
82
82
|
expr_str: str,
|
83
|
-
var_types:
|
83
|
+
var_types: dict[str, QuantumType],
|
84
84
|
machine_precision: int,
|
85
85
|
enable_target: bool = False,
|
86
86
|
) -> Arithmetic:
|
@@ -98,7 +98,7 @@ def get_arithmetic_params(
|
|
98
98
|
|
99
99
|
|
100
100
|
def compute_arithmetic_result_type(
|
101
|
-
expr_str: str, var_types:
|
101
|
+
expr_str: str, var_types: dict[str, QuantumType], machine_precision: int
|
102
102
|
) -> QuantumType:
|
103
103
|
arith_param = get_arithmetic_params(expr_str, var_types, machine_precision)
|
104
104
|
return register_info_to_quantum_type(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Callable
|
1
|
+
from typing import Callable
|
2
2
|
|
3
3
|
from typing_extensions import TypeAlias
|
4
4
|
|
@@ -6,15 +6,15 @@ from classiq.interface.exceptions import ClassiqArithmeticError
|
|
6
6
|
from classiq.interface.generator.arith import argument_utils
|
7
7
|
from classiq.interface.generator.arith.binary_ops import BOOLEAN_OP_WITH_FRACTIONS_ERROR
|
8
8
|
|
9
|
-
ArgTypeValidator: TypeAlias = Callable[[
|
9
|
+
ArgTypeValidator: TypeAlias = Callable[[list[argument_utils.RegisterOrConst]], None]
|
10
10
|
|
11
11
|
|
12
|
-
def _validate_bitwise_op_args(args:
|
12
|
+
def _validate_bitwise_op_args(args: list[argument_utils.RegisterOrConst]) -> None:
|
13
13
|
if any(argument_utils.fraction_places(arg) > 0 for arg in args):
|
14
14
|
raise ClassiqArithmeticError(BOOLEAN_OP_WITH_FRACTIONS_ERROR)
|
15
15
|
|
16
16
|
|
17
|
-
arg_type_validator_map:
|
17
|
+
arg_type_validator_map: dict[str, ArgTypeValidator] = dict(
|
18
18
|
BitXor=_validate_bitwise_op_args,
|
19
19
|
BitAnd=_validate_bitwise_op_args,
|
20
20
|
BitOr=_validate_bitwise_op_args,
|
@@ -23,7 +23,7 @@ arg_type_validator_map: Dict[str, ArgTypeValidator] = dict(
|
|
23
23
|
|
24
24
|
def validate_operation_arg_types(
|
25
25
|
operation: str,
|
26
|
-
arguments:
|
26
|
+
arguments: list[argument_utils.RegisterOrConst],
|
27
27
|
machine_precision: int,
|
28
28
|
) -> None:
|
29
29
|
if operation not in arg_type_validator_map:
|