classiq 0.53.0__py3-none-any.whl → 0.55.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/builtins/internal_operators.py +9 -1
- 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 +33 -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 +11 -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/compilation_metadata.py +5 -0
- 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 +22 -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/control.py +22 -1
- classiq/interface/model/handle_binding.py +3 -2
- classiq/interface/model/inplace_binary_operation.py +2 -1
- classiq/interface/model/model.py +16 -11
- classiq/interface/model/native_function_definition.py +1 -1
- 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 +4 -27
- 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 +7 -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/capturing/captured_var_manager.py +4 -6
- classiq/model_expansions/capturing/propagated_var_stack.py +7 -7
- classiq/model_expansions/closure.py +83 -12
- 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 +13 -12
- classiq/model_expansions/generative_functions.py +5 -4
- classiq/model_expansions/interpreter.py +20 -11
- 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 +81 -24
- classiq/model_expansions/quantum_operations/emitter.py +33 -20
- classiq/model_expansions/quantum_operations/expression_operation.py +47 -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 +28 -31
- classiq/model_expansions/quantum_operations/quantum_function_call.py +9 -0
- classiq/model_expansions/quantum_operations/repeat.py +1 -3
- classiq/model_expansions/quantum_operations/within_apply.py +0 -16
- classiq/model_expansions/scope.py +11 -10
- classiq/model_expansions/scope_initialization.py +5 -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 +117 -22
- classiq/qmod/cfunc.py +2 -2
- classiq/qmod/classical_function.py +3 -7
- classiq/qmod/create_model_function.py +16 -17
- 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 +10 -8
- classiq/qmod/native/__init__.py +1 -3
- classiq/qmod/native/expression_to_qmod.py +9 -8
- classiq/qmod/native/pretty_printer.py +12 -6
- 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 +38 -23
- 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 +35 -22
- 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 +1 -2
- {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/METADATA +1 -1
- {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/RECORD +300 -297
- classiq/qmod/builtins/functions/qft.py +0 -23
- {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/WHEEL +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Callable,
|
1
|
+
from typing import Callable, Optional
|
2
2
|
|
3
3
|
from classiq.interface.exceptions import ClassiqArithmeticError
|
4
4
|
from classiq.interface.generator.arith.argument_utils import (
|
@@ -39,7 +39,7 @@ from classiq.interface.generator.arith.unary_ops import BitwiseInvert, Negation
|
|
39
39
|
ParamsGetter = Callable[..., ArithmeticOperationParams] # Argument vary
|
40
40
|
|
41
41
|
_TARGET_ERROR_MESSAGE: str = "Target unavailable for the requested operation"
|
42
|
-
_OPERATIONS_ALLOWING_TARGET:
|
42
|
+
_OPERATIONS_ALLOWING_TARGET: frozenset = frozenset(
|
43
43
|
{"And", "Or", "Eq", "NotEq", "Lt", "Gt", "LtE", "GtE"}
|
44
44
|
)
|
45
45
|
|
@@ -55,7 +55,7 @@ def operation_allows_target(operation: str) -> bool:
|
|
55
55
|
def get_params(
|
56
56
|
*,
|
57
57
|
node_id: str,
|
58
|
-
args:
|
58
|
+
args: list[RegisterOrFloat],
|
59
59
|
machine_precision: int,
|
60
60
|
output_size: Optional[int] = None,
|
61
61
|
inplace_arg: Optional[str] = None,
|
@@ -330,7 +330,7 @@ def less_equal_params_getter(
|
|
330
330
|
|
331
331
|
|
332
332
|
def logical_and_params_getter(
|
333
|
-
*arg:
|
333
|
+
*arg: list[RegisterOrFloat],
|
334
334
|
machine_precision: int,
|
335
335
|
output_size: Optional[int] = None,
|
336
336
|
inplace_arg: Optional[str] = None,
|
@@ -340,7 +340,7 @@ def logical_and_params_getter(
|
|
340
340
|
|
341
341
|
|
342
342
|
def logical_or_params_getter(
|
343
|
-
*arg:
|
343
|
+
*arg: list[RegisterOrFloat],
|
344
344
|
machine_precision: int,
|
345
345
|
output_size: Optional[int] = None,
|
346
346
|
inplace_arg: Optional[str] = None,
|
@@ -434,7 +434,7 @@ def modulo_params_getter(
|
|
434
434
|
)
|
435
435
|
|
436
436
|
|
437
|
-
params_getter_map:
|
437
|
+
params_getter_map: dict[str, ParamsGetter] = dict(
|
438
438
|
BitOr=or_params_getter,
|
439
439
|
BitAnd=and_params_getter,
|
440
440
|
BitXor=xor_params_getter,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, Optional
|
2
2
|
|
3
3
|
import networkx as nx
|
4
4
|
|
@@ -8,7 +8,7 @@ from classiq.interface.generator.arith.argument_utils import RegisterOrConst
|
|
8
8
|
from classiq.interface.generator.arith.ast_node_rewrite import OUTPUT_SIZE
|
9
9
|
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
10
10
|
|
11
|
-
ArithmeticDefinitions =
|
11
|
+
ArithmeticDefinitions = dict[str, RegisterOrConst]
|
12
12
|
|
13
13
|
|
14
14
|
class ArithmeticResultBuilder:
|
@@ -43,10 +43,10 @@ class ArithmeticResultBuilder:
|
|
43
43
|
def _compute_inputs_data(
|
44
44
|
cls,
|
45
45
|
*,
|
46
|
-
inputs_node_set:
|
46
|
+
inputs_node_set: set[Any],
|
47
47
|
result_definitions: ArithmeticDefinitions,
|
48
48
|
machine_precision: int,
|
49
|
-
) ->
|
49
|
+
) -> dict[str, RegisterOrConst]:
|
50
50
|
return {
|
51
51
|
cls._convert_int_to_float_str(node): cls.convert_result_definition(
|
52
52
|
node, result_definitions.get(node), machine_precision
|
@@ -61,11 +61,11 @@ class ArithmeticResultBuilder:
|
|
61
61
|
graph: nx.DiGraph,
|
62
62
|
result_definitions: ArithmeticDefinitions,
|
63
63
|
machine_precision: int,
|
64
|
-
) ->
|
65
|
-
inputs_node_set:
|
64
|
+
) -> tuple[RegisterArithmeticInfo, Optional[RegisterArithmeticInfo]]:
|
65
|
+
inputs_node_set: set[str] = {
|
66
66
|
vertex for vertex, deg in graph.in_degree if deg == 0
|
67
67
|
}
|
68
|
-
node_results:
|
68
|
+
node_results: dict[str, RegisterOrConst] = cls._compute_inputs_data(
|
69
69
|
inputs_node_set=inputs_node_set,
|
70
70
|
result_definitions=result_definitions,
|
71
71
|
machine_precision=machine_precision,
|
@@ -91,11 +91,11 @@ class ArithmeticResultBuilder:
|
|
91
91
|
def _get_node_result_and_garbage(
|
92
92
|
cls,
|
93
93
|
graph: nx.DiGraph,
|
94
|
-
args:
|
94
|
+
args: list[RegisterOrConst],
|
95
95
|
node: str,
|
96
96
|
*,
|
97
97
|
machine_precision: int,
|
98
|
-
) ->
|
98
|
+
) -> tuple[RegisterArithmeticInfo, Optional[RegisterArithmeticInfo]]:
|
99
99
|
node_params = arithmetic_param_getters.get_params(
|
100
100
|
node_id=node,
|
101
101
|
args=args,
|
@@ -1,14 +1,11 @@
|
|
1
1
|
import math
|
2
|
+
from collections.abc import Iterable
|
2
3
|
from typing import (
|
3
4
|
Any,
|
4
5
|
ClassVar,
|
5
|
-
Dict,
|
6
6
|
Generic,
|
7
|
-
Iterable,
|
8
7
|
Literal,
|
9
8
|
Optional,
|
10
|
-
Tuple,
|
11
|
-
Type,
|
12
9
|
TypeVar,
|
13
10
|
Union,
|
14
11
|
)
|
@@ -65,7 +62,7 @@ class BinaryOpParams(
|
|
65
62
|
|
66
63
|
@pydantic.model_validator(mode="before")
|
67
64
|
@classmethod
|
68
|
-
def _clone_repeated_arg(cls, values: Any) ->
|
65
|
+
def _clone_repeated_arg(cls, values: Any) -> dict[str, Any]:
|
69
66
|
if isinstance(values, dict):
|
70
67
|
left_arg = values.get("left_arg")
|
71
68
|
right_arg = values.get("right_arg")
|
@@ -113,7 +110,7 @@ class InplacableBinaryOpParams(
|
|
113
110
|
|
114
111
|
@pydantic.model_validator(mode="before")
|
115
112
|
@classmethod
|
116
|
-
def _validate_inplace_arg(cls, values: Any) ->
|
113
|
+
def _validate_inplace_arg(cls, values: Any) -> dict[str, Any]:
|
117
114
|
if isinstance(values, dict):
|
118
115
|
left_arg = values.get("left_arg")
|
119
116
|
right_arg = values.get("right_arg")
|
@@ -168,7 +165,7 @@ class InplacableBinaryOpParams(
|
|
168
165
|
0, arg.fraction_places - self.result_register.fraction_places # type: ignore[attr-defined]
|
169
166
|
)
|
170
167
|
|
171
|
-
def _carried_arguments(self) ->
|
168
|
+
def _carried_arguments(self) -> tuple[Optional[LeftDataT], Optional[RightDataT]]:
|
172
169
|
if self.inplace_arg == ArgToInplace.RIGHT and isinstance(
|
173
170
|
self.left_arg, RegisterArithmeticInfo
|
174
171
|
):
|
@@ -366,7 +363,7 @@ class Subtractor(InplacableBinaryOpParams[RegisterOrConst, RegisterOrConst]):
|
|
366
363
|
)
|
367
364
|
|
368
365
|
def _get_output_size(
|
369
|
-
self, bounds:
|
366
|
+
self, bounds: tuple[float, float], fraction_places: int
|
370
367
|
) -> int:
|
371
368
|
if isinstance(self.right_arg, float) and self.effective_right_arg == 0:
|
372
369
|
assert isinstance(self.effective_left_arg, RegisterArithmeticInfo)
|
@@ -477,8 +474,8 @@ class Multiplier(BinaryOpWithFloatInputs):
|
|
477
474
|
|
478
475
|
@staticmethod
|
479
476
|
def _get_bounds(
|
480
|
-
args:
|
481
|
-
) ->
|
477
|
+
args: tuple[RegisterOrConst, RegisterOrConst], machine_precision: int
|
478
|
+
) -> tuple[float, float]:
|
482
479
|
extremal_values = [
|
483
480
|
left * right
|
484
481
|
for left in argument_utils.bounds(args[0])
|
@@ -524,7 +521,7 @@ class Multiplier(BinaryOpWithFloatInputs):
|
|
524
521
|
|
525
522
|
@staticmethod
|
526
523
|
def _get_output_size(
|
527
|
-
bounds:
|
524
|
+
bounds: tuple[float, float],
|
528
525
|
fraction_places: int,
|
529
526
|
left_arg: Union[RegisterArithmeticInfo, float],
|
530
527
|
right_arg: Union[RegisterArithmeticInfo, float],
|
@@ -603,7 +600,7 @@ class Power(BinaryOpParams[RegisterArithmeticInfo, pydantic.PositiveInt]):
|
|
603
600
|
* self.right_arg
|
604
601
|
)
|
605
602
|
|
606
|
-
def _get_result_bounds(self) ->
|
603
|
+
def _get_result_bounds(self) -> tuple[float, float]:
|
607
604
|
bounds = [
|
608
605
|
number_utils.limit_fraction_places(
|
609
606
|
bound, machine_precision=self.machine_precision
|
@@ -644,7 +641,7 @@ class Power(BinaryOpParams[RegisterArithmeticInfo, pydantic.PositiveInt]):
|
|
644
641
|
|
645
642
|
def _get_inner_action_garbage_size(
|
646
643
|
self,
|
647
|
-
action_type: Union[
|
644
|
+
action_type: Union[type["Power"], type[Multiplier]],
|
648
645
|
*,
|
649
646
|
arg: RegisterArithmeticInfo,
|
650
647
|
action_right_arg: RegisterOrConst,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import abc
|
2
|
-
from
|
2
|
+
from collections.abc import Iterable
|
3
|
+
from typing import Any
|
3
4
|
|
4
5
|
import pydantic
|
5
6
|
|
@@ -26,7 +27,7 @@ class Extremum(ArithmeticOperationParams):
|
|
26
27
|
|
27
28
|
@pydantic.model_validator(mode="before")
|
28
29
|
@classmethod
|
29
|
-
def _validate_one_is_register(cls, values: Any) ->
|
30
|
+
def _validate_one_is_register(cls, values: Any) -> dict[str, Any]:
|
30
31
|
if isinstance(values, dict):
|
31
32
|
left_arg = values.get("left_arg")
|
32
33
|
right_arg = values.get("right_arg")
|
@@ -1,4 +1,5 @@
|
|
1
|
-
from
|
1
|
+
from collections.abc import Iterable
|
2
|
+
from typing import Optional
|
2
3
|
|
3
4
|
import pydantic
|
4
5
|
from pydantic import ConfigDict
|
@@ -17,11 +18,11 @@ def get_arg_name(idx: int) -> str:
|
|
17
18
|
|
18
19
|
|
19
20
|
class LogicalOps(ArithmeticOperationParams):
|
20
|
-
args:
|
21
|
+
args: list[RegisterOrConst]
|
21
22
|
target: Optional[RegisterArithmeticInfo]
|
22
|
-
_should_invert_node_list:
|
23
|
+
_should_invert_node_list: list[str] = pydantic.PrivateAttr(default_factory=list)
|
23
24
|
|
24
|
-
def update_should_invert_node_list(self, invert_args:
|
25
|
+
def update_should_invert_node_list(self, invert_args: list[str]) -> None:
|
25
26
|
self._should_invert_node_list.extend(invert_args)
|
26
27
|
|
27
28
|
@pydantic.field_validator("output_size")
|
@@ -34,8 +35,8 @@ class LogicalOps(ArithmeticOperationParams):
|
|
34
35
|
@pydantic.field_validator("args")
|
35
36
|
@classmethod
|
36
37
|
def _validate_inputs_sizes(
|
37
|
-
cls, arguments:
|
38
|
-
) ->
|
38
|
+
cls, arguments: list[RegisterOrConst]
|
39
|
+
) -> list[RegisterOrConst]:
|
39
40
|
for arg_idx, arg in enumerate(arguments):
|
40
41
|
if isinstance(arg, RegisterArithmeticInfo) and not arg.is_boolean_register:
|
41
42
|
raise ClassiqValueError(
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Final,
|
1
|
+
from typing import Final, Union
|
2
2
|
|
3
3
|
MAXIMAL_MACHINE_PRECISION: Final[int] = 20
|
4
4
|
|
@@ -40,7 +40,7 @@ def _get_fraction_places(*, binary_value: str) -> int:
|
|
40
40
|
return fraction_places
|
41
41
|
|
42
42
|
|
43
|
-
def get_int_representation_and_fraction_places(float_value: float) ->
|
43
|
+
def get_int_representation_and_fraction_places(float_value: float) -> tuple[int, int]:
|
44
44
|
int_val = signed_int_to_unsigned(int(float_value * 2**MAXIMAL_MACHINE_PRECISION))
|
45
45
|
if int_val == 0:
|
46
46
|
return 0, 0
|
@@ -113,6 +113,6 @@ def limit_fraction_places(number: float, machine_precision: int) -> float:
|
|
113
113
|
|
114
114
|
|
115
115
|
def bounds_cut(
|
116
|
-
bounds1:
|
117
|
-
) ->
|
116
|
+
bounds1: tuple[float, float], bounds2: tuple[float, float]
|
117
|
+
) -> tuple[float, float]:
|
118
118
|
return max(min(bounds1), min(bounds2)), min(max(bounds1), max(bounds2))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, Optional
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
from pydantic import ConfigDict
|
@@ -24,7 +24,7 @@ class RegisterArithmeticInfo(HashablePydanticBaseModel):
|
|
24
24
|
|
25
25
|
@pydantic.model_validator(mode="before")
|
26
26
|
@classmethod
|
27
|
-
def _remove_name(cls, values: Any, info: ValidationInfo) ->
|
27
|
+
def _remove_name(cls, values: Any, info: ValidationInfo) -> dict[str, Any]:
|
28
28
|
if isinstance(values, dict):
|
29
29
|
values = values.copy()
|
30
30
|
elif hasattr(values, "__dict__"):
|
@@ -40,7 +40,7 @@ class RegisterArithmeticInfo(HashablePydanticBaseModel):
|
|
40
40
|
@staticmethod
|
41
41
|
def get_maximal_bounds(
|
42
42
|
*, size: int, is_signed: bool, fraction_places: int
|
43
|
-
) ->
|
43
|
+
) -> tuple[float, float]:
|
44
44
|
lb = 0 if not is_signed else -(2 ** (size - 1))
|
45
45
|
ub = 2**size - 1 if not is_signed else 2 ** (size - 1) - 1
|
46
46
|
fraction_factor = float(2**-fraction_places)
|
@@ -106,7 +106,7 @@ class RegisterUserInput(RegisterArithmeticInfo):
|
|
106
106
|
|
107
107
|
@pydantic.model_validator(mode="before")
|
108
108
|
@classmethod
|
109
|
-
def _remove_name(cls, values: Any, info: ValidationInfo) ->
|
109
|
+
def _remove_name(cls, values: Any, info: ValidationInfo) -> dict[str, Any]:
|
110
110
|
return values
|
111
111
|
|
112
112
|
def revalued(self, **kwargs: Any) -> "RegisterUserInput":
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Optional
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
@@ -15,14 +15,14 @@ from classiq.interface.generator.model.preferences.preferences import QuantumFor
|
|
15
15
|
|
16
16
|
|
17
17
|
class CircuitCodeInterface(pydantic.BaseModel):
|
18
|
-
outputs:
|
18
|
+
outputs: dict[QuantumFormat, Code]
|
19
19
|
qasm_version: QasmVersion
|
20
20
|
|
21
21
|
@pydantic.field_validator("outputs")
|
22
22
|
@classmethod
|
23
23
|
def reformat_long_string_output_formats(
|
24
|
-
cls, outputs:
|
25
|
-
) ->
|
24
|
+
cls, outputs: dict[QuantumFormat, str]
|
25
|
+
) -> dict[QuantumFormat, LongStr]:
|
26
26
|
return {key: LongStr(value) for key, value in outputs.items()}
|
27
27
|
|
28
28
|
@property
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import Dict, Tuple
|
2
|
-
|
3
1
|
from typing_extensions import TypeAlias
|
4
2
|
|
5
3
|
from classiq.interface.enum_utils import StrEnum
|
@@ -8,14 +6,14 @@ from classiq.interface.generator.model.preferences.preferences import QuantumFor
|
|
8
6
|
from classiq.interface.hardware import Provider
|
9
7
|
|
10
8
|
Code: TypeAlias = str
|
11
|
-
CodeAndSyntax: TypeAlias =
|
9
|
+
CodeAndSyntax: TypeAlias = tuple[Code, QuantumInstructionSet]
|
12
10
|
|
13
|
-
INSTRUCTION_SET_TO_FORMAT:
|
11
|
+
INSTRUCTION_SET_TO_FORMAT: dict[QuantumInstructionSet, QuantumFormat] = {
|
14
12
|
QuantumInstructionSet.QASM: QuantumFormat.QASM,
|
15
13
|
QuantumInstructionSet.QSHARP: QuantumFormat.QSHARP,
|
16
14
|
QuantumInstructionSet.IONQ: QuantumFormat.IONQ,
|
17
15
|
}
|
18
|
-
VENDOR_TO_INSTRUCTION_SET:
|
16
|
+
VENDOR_TO_INSTRUCTION_SET: dict[Provider, QuantumInstructionSet] = {
|
19
17
|
Provider.CLASSIQ: QuantumInstructionSet.QASM,
|
20
18
|
Provider.IONQ: QuantumInstructionSet.IONQ,
|
21
19
|
Provider.AZURE_QUANTUM: QuantumInstructionSet.QSHARP,
|
@@ -1,8 +1,7 @@
|
|
1
|
-
from typing import Union
|
1
|
+
from typing import Annotated, Union
|
2
2
|
|
3
3
|
from pydantic import PlainSerializer, PlainValidator
|
4
4
|
from pydantic.json_schema import WithJsonSchema
|
5
|
-
from typing_extensions import Annotated
|
6
5
|
|
7
6
|
|
8
7
|
def validate_complex(v: Union[complex, str]) -> complex:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from typing import Any
|
3
|
+
from typing import Any
|
4
4
|
|
5
5
|
import pydantic
|
6
6
|
from pydantic import BaseModel, ConfigDict
|
@@ -28,7 +28,7 @@ class ControlState(BaseModel):
|
|
28
28
|
|
29
29
|
@pydantic.model_validator(mode="before")
|
30
30
|
@classmethod
|
31
|
-
def _validate_control(cls, values: Any) ->
|
31
|
+
def _validate_control(cls, values: Any) -> dict[str, Any]:
|
32
32
|
if isinstance(values, dict):
|
33
33
|
num_ctrl_qubits: int = (
|
34
34
|
values.get("num_ctrl_qubits", _DEFAULT_NUM_CONTROL_QUBITS) or 0
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import Dict, Type
|
2
|
-
|
3
1
|
import pydantic
|
4
2
|
|
5
3
|
from classiq.interface.enum_utils import StrEnum
|
@@ -22,7 +20,7 @@ class CustomAnsatzType(StrEnum):
|
|
22
20
|
RandomTwoQubitGates = "RandomTwoQubitGates"
|
23
21
|
|
24
22
|
|
25
|
-
CUSTOM_ANSATZ_ARGS_MAPPING:
|
23
|
+
CUSTOM_ANSATZ_ARGS_MAPPING: dict[CustomAnsatzType, type[pydantic.BaseModel]] = {
|
26
24
|
CustomAnsatzType.TwoLocal: TwoLocalArgs,
|
27
25
|
CustomAnsatzType.SeparateU3: SeparateU3Args,
|
28
26
|
CustomAnsatzType.Hypercube: HypercubeArgs,
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
import numpy as np
|
4
2
|
|
5
3
|
# Taken and modified from quantum_tsp_tutorials repository of mstechly in github.
|
@@ -10,7 +8,7 @@ def _distance_between_points(point_1: np.ndarray, point_2: np.ndarray) -> float:
|
|
10
8
|
return float(np.linalg.norm(point_1 - point_2))
|
11
9
|
|
12
10
|
|
13
|
-
def get_distance_matrix(cities: np.ndarray) ->
|
11
|
+
def get_distance_matrix(cities: np.ndarray) -> list[list[float]]:
|
14
12
|
number_of_cities = len(cities)
|
15
13
|
matrix = np.zeros((number_of_cities, number_of_cities))
|
16
14
|
for i in range(number_of_cities):
|
@@ -20,14 +18,14 @@ def get_distance_matrix(cities: np.ndarray) -> List[List[float]]:
|
|
20
18
|
return matrix.tolist()
|
21
19
|
|
22
20
|
|
23
|
-
def get_rand_euclidean_distance_matrix(num_points: int) ->
|
21
|
+
def get_rand_euclidean_distance_matrix(num_points: int) -> list[list[float]]:
|
24
22
|
_points_array_dim = 2
|
25
23
|
points = np.random.rand(num_points, _points_array_dim)
|
26
24
|
distance_matrix = get_distance_matrix(points)
|
27
25
|
return distance_matrix
|
28
26
|
|
29
27
|
|
30
|
-
def get_rand_distance_matrix(num_points: int) ->
|
28
|
+
def get_rand_distance_matrix(num_points: int) -> list[list[float]]:
|
31
29
|
distance_matrix = np.random.rand(num_points, num_points)
|
32
30
|
distance_matrix *= 0.5
|
33
31
|
distance_matrix += distance_matrix.T
|
@@ -1,11 +1,9 @@
|
|
1
|
-
from typing import Dict
|
2
|
-
|
3
1
|
from classiq.interface.generator.types.builtin_enum_declarations import (
|
4
2
|
FinanceFunctionType,
|
5
3
|
)
|
6
4
|
|
7
5
|
|
8
|
-
def get_finance_function_dict() ->
|
6
|
+
def get_finance_function_dict() -> dict[str, "FinanceFunctionType"]:
|
9
7
|
return {
|
10
8
|
"var": FinanceFunctionType.VAR,
|
11
9
|
"expected shortfall": FinanceFunctionType.SHORTFALL,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import re
|
2
|
+
from collections.abc import Mapping
|
2
3
|
from dataclasses import dataclass
|
3
|
-
from typing import Any,
|
4
|
+
from typing import Any, Optional
|
4
5
|
|
5
6
|
from sympy import Expr
|
6
7
|
from typing_extensions import get_args
|
@@ -19,7 +20,7 @@ from classiq.interface.generator.expressions.handle_identifier import HandleIden
|
|
19
20
|
class EvaluatedExpression:
|
20
21
|
value: ExpressionValue
|
21
22
|
|
22
|
-
def is_constant(self, constant_type: Optional[
|
23
|
+
def is_constant(self, constant_type: Optional[type] = None) -> bool:
|
23
24
|
if self.value is None:
|
24
25
|
return False
|
25
26
|
|
@@ -28,7 +29,7 @@ class EvaluatedExpression:
|
|
28
29
|
get_args(RuntimeConstant) if constant_type is None else constant_type,
|
29
30
|
)
|
30
31
|
|
31
|
-
def as_constant_type(self, constant_type:
|
32
|
+
def as_constant_type(self, constant_type: type) -> Any:
|
32
33
|
if not self.is_constant():
|
33
34
|
raise ClassiqValueError(
|
34
35
|
f"Invalid access to expression {self.value!r} as {constant_type}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import ast
|
2
|
-
import
|
3
|
-
from typing import Any,
|
2
|
+
from collections.abc import Mapping
|
3
|
+
from typing import Any, Optional
|
4
4
|
|
5
5
|
import pydantic
|
6
6
|
from pydantic import ConfigDict, PrivateAttr
|
@@ -45,14 +45,13 @@ class Expression(HashableASTNode):
|
|
45
45
|
@pydantic.field_validator("expr")
|
46
46
|
@classmethod
|
47
47
|
def format_expression(cls, expr: str) -> str:
|
48
|
-
|
49
|
-
expr = ast.unparse(ast.parse(expr))
|
48
|
+
expr = ast.unparse(ast.parse(expr))
|
50
49
|
return expr
|
51
50
|
|
52
51
|
def is_evaluated(self) -> bool:
|
53
52
|
return self._evaluated_expr is not None
|
54
53
|
|
55
|
-
def as_constant(self, constant_type:
|
54
|
+
def as_constant(self, constant_type: type) -> Any:
|
56
55
|
return self.value.as_constant_type(constant_type)
|
57
56
|
|
58
57
|
def to_int_value(self) -> int:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import keyword
|
2
|
-
from typing import Final
|
2
|
+
from typing import Final
|
3
3
|
|
4
4
|
from classiq.interface.generator.arith.arithmetic_expression_parser import (
|
5
5
|
DEFAULT_SUPPORTED_FUNC_NAMES,
|
@@ -11,12 +11,12 @@ from classiq.interface.generator.function_params import NAME_REGEX
|
|
11
11
|
|
12
12
|
SUPPORTED_VAR_NAMES_REG = NAME_REGEX
|
13
13
|
|
14
|
-
SUPPORTED_FUNC_NAMES:
|
14
|
+
SUPPORTED_FUNC_NAMES: set[str] = (
|
15
15
|
{"or", "and"}
|
16
16
|
.union(DEFAULT_SUPPORTED_FUNC_NAMES)
|
17
17
|
.union(set(SYMPY_SUPPORTED_EXPRESSIONS))
|
18
18
|
)
|
19
19
|
BOOLEAN_LITERALS = {"True", "False"}
|
20
|
-
FORBIDDEN_LITERALS:
|
20
|
+
FORBIDDEN_LITERALS: set[str] = set(keyword.kwlist) - SUPPORTED_FUNC_NAMES
|
21
21
|
CPARAM_EXECUTION_SUFFIX: Final[str] = "_param"
|
22
|
-
RESERVED_EXPRESSIONS:
|
22
|
+
RESERVED_EXPRESSIONS: frozenset[str] = frozenset({"i"})
|
@@ -1,4 +1,5 @@
|
|
1
|
-
from
|
1
|
+
from collections.abc import Mapping
|
2
|
+
from typing import TYPE_CHECKING
|
2
3
|
|
3
4
|
from classiq.interface.generator.expressions.non_symbolic_expr import NonSymbolicExpr
|
4
5
|
from classiq.interface.generator.expressions.qmod_sized_proxy import QmodSizedProxy
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
BASIC_ARITHMETIC_OPERATORS: List[str] = ["+", "-", "*", "/", "%"]
|
4
|
-
MATHEMATICAL_FUNCTIONS: List[str] = [
|
1
|
+
BASIC_ARITHMETIC_OPERATORS: list[str] = ["+", "-", "*", "/", "%"]
|
2
|
+
MATHEMATICAL_FUNCTIONS: list[str] = [
|
5
3
|
"sin",
|
6
4
|
"cos",
|
7
5
|
"tan",
|
@@ -36,7 +34,7 @@ MATHEMATICAL_FUNCTIONS: List[str] = [
|
|
36
34
|
"Min",
|
37
35
|
"mod_inverse",
|
38
36
|
]
|
39
|
-
SPECIAL_FUNCTIONS:
|
37
|
+
SPECIAL_FUNCTIONS: list[str] = [
|
40
38
|
"erf",
|
41
39
|
"erfc",
|
42
40
|
"gamma",
|
@@ -57,8 +55,8 @@ SPECIAL_FUNCTIONS: List[str] = [
|
|
57
55
|
"euler",
|
58
56
|
"catalan",
|
59
57
|
]
|
60
|
-
PIECEWISE_FUNCTIONS:
|
61
|
-
NUMERIC_CONSTANTS:
|
58
|
+
PIECEWISE_FUNCTIONS: list[str] = ["Piecewise", "Heaviside"]
|
59
|
+
NUMERIC_CONSTANTS: list[str] = [
|
62
60
|
"pi",
|
63
61
|
"E",
|
64
62
|
"I",
|
@@ -66,11 +64,11 @@ NUMERIC_CONSTANTS: List[str] = [
|
|
66
64
|
"EulerGamma",
|
67
65
|
"Catalan",
|
68
66
|
]
|
69
|
-
BOOLEAN_CONSTANTS:
|
70
|
-
CONSTANTS:
|
67
|
+
BOOLEAN_CONSTANTS: list[str] = ["true", "false"]
|
68
|
+
CONSTANTS: list[str] = NUMERIC_CONSTANTS + BOOLEAN_CONSTANTS
|
71
69
|
|
72
|
-
DATA_TYPES:
|
73
|
-
LOGIC_OPERATORS:
|
70
|
+
DATA_TYPES: list[str] = ["Matrix"]
|
71
|
+
LOGIC_OPERATORS: list[str] = [
|
74
72
|
"And",
|
75
73
|
"Or",
|
76
74
|
"Not",
|
@@ -80,9 +78,9 @@ LOGIC_OPERATORS: List[str] = [
|
|
80
78
|
"Nand",
|
81
79
|
"Nor",
|
82
80
|
]
|
83
|
-
RELATIONAL_OPERATORS:
|
81
|
+
RELATIONAL_OPERATORS: list[str] = ["<", "<=", ">", ">=", "!=", "<>", "Eq", "Ne"]
|
84
82
|
|
85
|
-
SYMPY_SUPPORTED_EXPRESSIONS:
|
83
|
+
SYMPY_SUPPORTED_EXPRESSIONS: list[str] = (
|
86
84
|
BASIC_ARITHMETIC_OPERATORS
|
87
85
|
+ MATHEMATICAL_FUNCTIONS
|
88
86
|
+ SPECIAL_FUNCTIONS
|