classiq 0.93.0__py3-none-any.whl → 0.99.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/__init__.py +11 -19
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +7 -7
- classiq/_analyzer_extras/interactive_hardware.py +19 -12
- classiq/_internals/api_wrapper.py +31 -142
- classiq/_internals/async_utils.py +4 -7
- classiq/_internals/authentication/auth0.py +41 -15
- classiq/_internals/authentication/authorization_code.py +9 -0
- classiq/_internals/authentication/authorization_flow.py +41 -0
- classiq/_internals/authentication/device.py +33 -52
- classiq/_internals/authentication/hybrid_flow.py +19 -0
- classiq/_internals/authentication/password_manager.py +13 -13
- classiq/_internals/authentication/token_manager.py +9 -9
- classiq/_internals/client.py +17 -44
- classiq/_internals/config.py +19 -5
- classiq/_internals/help.py +1 -2
- classiq/_internals/host_checker.py +3 -3
- classiq/_internals/jobs.py +14 -14
- classiq/_internals/type_validation.py +3 -3
- classiq/analyzer/analyzer.py +18 -18
- classiq/analyzer/rb.py +17 -8
- classiq/analyzer/show_interactive_hack.py +1 -1
- classiq/applications/__init__.py +2 -2
- classiq/applications/chemistry/__init__.py +0 -30
- classiq/applications/chemistry/op_utils.py +4 -4
- classiq/applications/chemistry/problems.py +3 -3
- classiq/applications/chemistry/ucc.py +1 -2
- classiq/applications/chemistry/z2_symmetries.py +4 -4
- classiq/applications/combinatorial_helpers/allowed_constraints.py +1 -3
- classiq/applications/combinatorial_helpers/arithmetic/arithmetic_expression.py +2 -1
- classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +2 -2
- classiq/applications/combinatorial_helpers/encoding_mapping.py +2 -3
- classiq/applications/combinatorial_helpers/encoding_utils.py +2 -2
- classiq/applications/combinatorial_helpers/optimization_model.py +3 -4
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +2 -2
- classiq/applications/combinatorial_helpers/pyomo_utils.py +8 -8
- classiq/applications/combinatorial_helpers/sympy_utils.py +1 -3
- classiq/applications/combinatorial_helpers/transformations/encoding.py +3 -3
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +1 -2
- classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -3
- classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +4 -6
- classiq/applications/combinatorial_optimization/combinatorial_problem.py +15 -10
- classiq/applications/hamiltonian/pauli_decomposition.py +6 -4
- classiq/applications/iqae/iqae.py +14 -11
- classiq/applications/qnn/datasets/dataset_base_classes.py +6 -6
- classiq/applications/qnn/datasets/dataset_parity.py +6 -6
- classiq/applications/qnn/gradients/simple_quantum_gradient.py +1 -1
- classiq/applications/qnn/qlayer.py +9 -8
- classiq/applications/qnn/torch_utils.py +5 -6
- classiq/applications/qnn/types.py +2 -1
- classiq/applications/qsp/__init__.py +20 -2
- classiq/applications/qsp/qsp.py +238 -10
- classiq/applications/qsvm/qsvm_data_generation.py +1 -2
- classiq/evaluators/classical_expression.py +0 -4
- classiq/evaluators/parameter_types.py +10 -8
- classiq/evaluators/qmod_annotated_expression.py +31 -26
- classiq/evaluators/qmod_expression_visitors/qmod_expression_evaluator.py +14 -14
- classiq/evaluators/qmod_expression_visitors/qmod_expression_simplifier.py +2 -1
- classiq/evaluators/qmod_expression_visitors/sympy_wrappers.py +8 -8
- classiq/evaluators/qmod_node_evaluators/binary_op_evaluation.py +4 -4
- classiq/evaluators/qmod_node_evaluators/classical_function_evaluation.py +14 -4
- classiq/evaluators/qmod_node_evaluators/list_evaluation.py +2 -2
- classiq/evaluators/qmod_node_evaluators/numeric_attrs_utils.py +3 -3
- classiq/evaluators/qmod_node_evaluators/subscript_evaluation.py +9 -9
- classiq/evaluators/qmod_node_evaluators/utils.py +6 -6
- classiq/evaluators/qmod_type_inference/classical_type_inference.py +9 -10
- classiq/evaluators/qmod_type_inference/quantum_type_inference.py +5 -5
- classiq/execution/__init__.py +0 -3
- classiq/execution/execution_session.py +28 -21
- classiq/execution/jobs.py +26 -26
- classiq/execution/qnn.py +1 -2
- classiq/execution/user_budgets.py +71 -37
- classiq/executor.py +1 -3
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +4 -4
- classiq/interface/analyzer/cytoscape_graph.py +3 -3
- classiq/interface/analyzer/result.py +4 -4
- classiq/interface/ast_node.py +3 -3
- classiq/interface/backend/backend_preferences.py +26 -50
- classiq/interface/backend/ionq/ionq_quantum_program.py +5 -5
- classiq/interface/backend/provider_config/__init__.py +0 -0
- classiq/interface/backend/provider_config/provider_config.py +8 -0
- classiq/interface/backend/provider_config/providers/__init__.py +0 -0
- classiq/interface/backend/provider_config/providers/alice_bob.py +47 -0
- classiq/interface/backend/provider_config/providers/aqt.py +16 -0
- classiq/interface/backend/provider_config/providers/azure.py +37 -0
- classiq/interface/backend/provider_config/providers/braket.py +39 -0
- classiq/interface/backend/provider_config/providers/ibm.py +26 -0
- classiq/interface/backend/provider_config/providers/ionq.py +22 -0
- classiq/interface/backend/quantum_backend_providers.py +20 -2
- classiq/interface/chemistry/ansatz_library.py +3 -5
- classiq/interface/chemistry/operator.py +3 -3
- classiq/interface/combinatorial_optimization/examples/knapsack.py +2 -4
- classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +1 -2
- classiq/interface/compression_utils.py +2 -3
- classiq/interface/debug_info/debug_info.py +8 -7
- classiq/interface/exceptions.py +6 -7
- classiq/interface/execution/primitives.py +6 -6
- classiq/interface/executor/estimate_cost.py +1 -1
- classiq/interface/executor/execution_preferences.py +3 -5
- classiq/interface/executor/execution_request.py +10 -10
- classiq/interface/executor/execution_result.py +1 -2
- classiq/interface/executor/quantum_code.py +8 -8
- classiq/interface/executor/result.py +28 -18
- classiq/interface/executor/user_budget.py +25 -17
- classiq/interface/executor/vqe_result.py +5 -6
- classiq/interface/generator/ansatz_library.py +6 -8
- classiq/interface/generator/application_apis/__init__.py +0 -3
- classiq/interface/generator/arith/arithmetic.py +2 -2
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +2 -3
- classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -5
- classiq/interface/generator/arith/arithmetic_expression_parser.py +11 -4
- classiq/interface/generator/arith/arithmetic_expression_validator.py +12 -15
- classiq/interface/generator/arith/arithmetic_operations.py +4 -6
- classiq/interface/generator/arith/arithmetic_param_getters.py +70 -107
- classiq/interface/generator/arith/arithmetic_result_builder.py +4 -4
- classiq/interface/generator/arith/ast_node_rewrite.py +8 -4
- classiq/interface/generator/arith/binary_ops.py +15 -40
- classiq/interface/generator/arith/logical_ops.py +2 -3
- classiq/interface/generator/arith/number_utils.py +2 -2
- classiq/interface/generator/arith/register_user_input.py +3 -3
- classiq/interface/generator/arith/unary_ops.py +2 -2
- classiq/interface/generator/circuit_code/circuit_code.py +8 -10
- classiq/interface/generator/circuit_code/types_and_constants.py +1 -1
- classiq/interface/generator/complex_type.py +2 -2
- classiq/interface/generator/copy.py +1 -3
- classiq/interface/generator/expressions/atomic_expression_functions.py +0 -5
- classiq/interface/generator/expressions/evaluated_expression.py +2 -3
- classiq/interface/generator/expressions/expression.py +2 -2
- classiq/interface/generator/expressions/proxies/classical/classical_array_proxy.py +4 -7
- classiq/interface/generator/function_param_list.py +0 -40
- classiq/interface/generator/function_params.py +5 -6
- classiq/interface/generator/functions/classical_function_declaration.py +2 -2
- classiq/interface/generator/functions/classical_type.py +3 -3
- classiq/interface/generator/functions/type_modifier.py +0 -15
- classiq/interface/generator/functions/type_name.py +2 -2
- classiq/interface/generator/generated_circuit_data.py +14 -18
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +2 -4
- classiq/interface/generator/hardware/hardware_data.py +8 -8
- classiq/interface/generator/hardware_efficient_ansatz.py +9 -9
- classiq/interface/generator/mcu.py +3 -3
- classiq/interface/generator/mcx.py +3 -3
- classiq/interface/generator/model/constraints.py +34 -5
- classiq/interface/generator/model/preferences/preferences.py +15 -21
- classiq/interface/generator/model/quantum_register.py +7 -10
- classiq/interface/generator/noise_properties.py +3 -7
- classiq/interface/generator/parameters.py +1 -1
- classiq/interface/generator/partitioned_register.py +1 -2
- classiq/interface/generator/preferences/qasm_to_qmod_params.py +11 -0
- classiq/interface/generator/quantum_function_call.py +9 -12
- classiq/interface/generator/quantum_program.py +10 -23
- classiq/interface/generator/range_types.py +3 -3
- classiq/interface/generator/slice_parsing_utils.py +4 -5
- classiq/interface/generator/standard_gates/standard_gates.py +2 -4
- classiq/interface/generator/synthesis_execution_parameter.py +1 -3
- classiq/interface/generator/synthesis_metadata/synthesis_duration.py +9 -0
- classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +2 -3
- classiq/interface/generator/transpiler_basis_gates.py +12 -4
- classiq/interface/generator/types/builtin_enum_declarations.py +0 -145
- classiq/interface/generator/types/compilation_metadata.py +12 -1
- classiq/interface/generator/types/enum_declaration.py +2 -1
- classiq/interface/generator/validations/flow_graph.py +3 -3
- classiq/interface/generator/visitor.py +10 -12
- classiq/interface/hardware.py +2 -3
- classiq/interface/helpers/classproperty.py +2 -2
- classiq/interface/helpers/custom_encoders.py +2 -1
- classiq/interface/helpers/custom_pydantic_types.py +1 -1
- classiq/interface/helpers/text_utils.py +1 -4
- classiq/interface/ide/visual_model.py +6 -5
- classiq/interface/interface_version.py +1 -1
- classiq/interface/jobs.py +3 -3
- classiq/interface/model/allocate.py +4 -4
- classiq/interface/model/block.py +6 -2
- classiq/interface/model/bounds.py +3 -3
- classiq/interface/model/classical_if.py +4 -0
- classiq/interface/model/control.py +8 -1
- classiq/interface/model/inplace_binary_operation.py +2 -2
- classiq/interface/model/invert.py +4 -0
- classiq/interface/model/model.py +4 -4
- classiq/interface/model/model_visitor.py +40 -1
- classiq/interface/model/parameter.py +1 -3
- classiq/interface/model/port_declaration.py +1 -1
- classiq/interface/model/power.py +4 -0
- classiq/interface/model/quantum_expressions/quantum_expression.py +1 -2
- classiq/interface/model/quantum_function_call.py +3 -6
- classiq/interface/model/quantum_function_declaration.py +1 -0
- classiq/interface/model/quantum_lambda_function.py +4 -4
- classiq/interface/model/quantum_statement.py +11 -4
- classiq/interface/model/quantum_type.py +14 -14
- classiq/interface/model/repeat.py +4 -0
- classiq/interface/model/skip_control.py +4 -0
- classiq/interface/model/validation_handle.py +2 -3
- classiq/interface/model/variable_declaration_statement.py +2 -2
- classiq/interface/model/within_apply_operation.py +4 -0
- classiq/interface/pretty_print/expression_to_qmod.py +3 -4
- classiq/interface/server/routes.py +0 -16
- classiq/interface/source_reference.py +3 -4
- classiq/model_expansions/arithmetic.py +11 -7
- classiq/model_expansions/arithmetic_compute_result_attrs.py +30 -27
- classiq/model_expansions/capturing/captured_vars.py +3 -3
- classiq/model_expansions/capturing/mangling_utils.py +1 -2
- classiq/model_expansions/closure.py +12 -11
- classiq/model_expansions/function_builder.py +14 -6
- classiq/model_expansions/generative_functions.py +7 -12
- classiq/model_expansions/interpreters/base_interpreter.py +3 -7
- classiq/model_expansions/interpreters/frontend_generative_interpreter.py +2 -1
- classiq/model_expansions/interpreters/generative_interpreter.py +5 -3
- classiq/model_expansions/quantum_operations/allocate.py +4 -4
- classiq/model_expansions/quantum_operations/assignment_result_processor.py +2 -4
- classiq/model_expansions/quantum_operations/call_emitter.py +31 -37
- classiq/model_expansions/quantum_operations/declarative_call_emitter.py +2 -2
- classiq/model_expansions/quantum_operations/emitter.py +3 -5
- classiq/model_expansions/quantum_operations/expression_evaluator.py +3 -3
- classiq/model_expansions/quantum_operations/skip_control_verifier.py +1 -2
- classiq/model_expansions/quantum_operations/variable_decleration.py +2 -2
- classiq/model_expansions/scope.py +7 -7
- classiq/model_expansions/scope_initialization.py +4 -0
- classiq/model_expansions/visitors/symbolic_param_inference.py +6 -6
- classiq/model_expansions/visitors/uncomputation_signature_inference.py +328 -0
- classiq/model_expansions/visitors/variable_references.py +15 -14
- classiq/open_library/functions/__init__.py +28 -11
- classiq/open_library/functions/amplitude_loading.py +81 -0
- classiq/open_library/functions/discrete_sine_cosine_transform.py +5 -5
- classiq/open_library/functions/grover.py +8 -10
- classiq/open_library/functions/lcu.py +47 -18
- classiq/open_library/functions/modular_exponentiation.py +93 -8
- classiq/open_library/functions/qsvt.py +66 -79
- classiq/open_library/functions/qsvt_temp.py +536 -0
- classiq/open_library/functions/state_preparation.py +130 -27
- classiq/qmod/__init__.py +6 -4
- classiq/qmod/builtins/classical_execution_primitives.py +4 -23
- classiq/qmod/builtins/classical_functions.py +1 -42
- classiq/qmod/builtins/enums.py +15 -153
- classiq/qmod/builtins/functions/__init__.py +9 -18
- classiq/qmod/builtins/functions/allocation.py +25 -4
- classiq/qmod/builtins/functions/arithmetic.py +22 -27
- classiq/qmod/builtins/functions/exponentiation.py +51 -2
- classiq/qmod/builtins/functions/mcx_func.py +7 -0
- classiq/qmod/builtins/functions/standard_gates.py +46 -27
- classiq/qmod/builtins/operations.py +165 -79
- classiq/qmod/builtins/structs.py +24 -91
- classiq/qmod/cfunc.py +3 -2
- classiq/qmod/classical_function.py +2 -1
- classiq/qmod/cparam.py +2 -8
- classiq/qmod/create_model_function.py +7 -7
- classiq/qmod/declaration_inferrer.py +33 -30
- classiq/qmod/expression_query.py +7 -4
- classiq/qmod/model_state_container.py +2 -2
- classiq/qmod/native/pretty_printer.py +25 -14
- classiq/qmod/pretty_print/expression_to_python.py +5 -3
- classiq/qmod/pretty_print/pretty_printer.py +39 -17
- classiq/qmod/python_classical_type.py +40 -13
- classiq/qmod/qfunc.py +124 -19
- classiq/qmod/qmod_constant.py +2 -2
- classiq/qmod/qmod_parameter.py +5 -2
- classiq/qmod/qmod_variable.py +47 -46
- classiq/qmod/quantum_callable.py +18 -13
- classiq/qmod/quantum_expandable.py +31 -26
- classiq/qmod/quantum_function.py +84 -36
- classiq/qmod/semantics/annotation/call_annotation.py +5 -5
- classiq/qmod/semantics/error_manager.py +12 -14
- classiq/qmod/semantics/lambdas.py +1 -2
- classiq/qmod/semantics/validation/types_validation.py +1 -2
- classiq/qmod/symbolic.py +2 -4
- classiq/qmod/utilities.py +13 -20
- classiq/qmod/write_qmod.py +3 -4
- classiq/quantum_program.py +1 -3
- classiq/synthesis.py +11 -7
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/METADATA +2 -3
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/RECORD +271 -299
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/WHEEL +1 -1
- classiq/applications/chemistry/ansatz_parameters.py +0 -29
- classiq/applications/chemistry/chemistry_execution_parameters.py +0 -16
- classiq/applications/chemistry/chemistry_model_constructor.py +0 -532
- classiq/applications/chemistry/ground_state_problem.py +0 -42
- classiq/applications/qsvm/__init__.py +0 -8
- classiq/applications/qsvm/qsvm.py +0 -11
- classiq/evaluators/qmod_expression_visitors/qmod_expression_bwc.py +0 -129
- classiq/execution/iqcc.py +0 -128
- classiq/interface/applications/qsvm.py +0 -117
- classiq/interface/chemistry/elements.py +0 -120
- classiq/interface/chemistry/fermionic_operator.py +0 -208
- classiq/interface/chemistry/ground_state_problem.py +0 -132
- classiq/interface/chemistry/ground_state_result.py +0 -8
- classiq/interface/chemistry/molecule.py +0 -71
- classiq/interface/execution/iqcc.py +0 -44
- classiq/interface/generator/application_apis/chemistry_declarations.py +0 -69
- classiq/interface/generator/application_apis/entangler_declarations.py +0 -29
- classiq/interface/generator/application_apis/qsvm_declarations.py +0 -6
- classiq/interface/generator/chemistry_function_params.py +0 -50
- classiq/interface/generator/entangler_params.py +0 -72
- classiq/interface/generator/entanglers.py +0 -14
- classiq/interface/generator/hamiltonian_evolution/qdrift.py +0 -27
- classiq/interface/generator/hartree_fock.py +0 -26
- classiq/interface/generator/hva.py +0 -22
- classiq/interface/generator/linear_pauli_rotations.py +0 -92
- classiq/interface/generator/qft.py +0 -37
- classiq/interface/generator/qsvm.py +0 -96
- classiq/interface/generator/state_preparation/__init__.py +0 -14
- classiq/interface/generator/state_preparation/bell_state_preparation.py +0 -27
- classiq/interface/generator/state_preparation/computational_basis_state_preparation.py +0 -28
- classiq/interface/generator/state_preparation/distributions.py +0 -53
- classiq/interface/generator/state_preparation/exponential_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/ghz_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/metrics.py +0 -41
- classiq/interface/generator/state_preparation/state_preparation.py +0 -113
- classiq/interface/generator/state_preparation/state_preparation_abc.py +0 -24
- classiq/interface/generator/state_preparation/uniform_distibution_state_preparation.py +0 -13
- classiq/interface/generator/state_preparation/w_state_preparation.py +0 -13
- classiq/interface/generator/ucc.py +0 -74
- classiq/interface/helpers/backward_compatibility.py +0 -9
- classiq/model_expansions/transformers/type_modifier_inference.py +0 -392
- classiq/open_library/functions/lookup_table.py +0 -58
- classiq/qmod/builtins/functions/chemistry.py +0 -123
- classiq/qmod/builtins/functions/qsvm.py +0 -24
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/licenses/LICENSE.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AliceBobConfig(ProviderConfig):
|
|
7
|
+
"""
|
|
8
|
+
Configuration specific to Alice&Bob.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
distance (int | None):
|
|
12
|
+
The number of times information is duplicated in the repetition code.
|
|
13
|
+
- **Tooltip**: Phase-flip probability decreases exponentially with this parameter, bit-flip probability increases linearly.
|
|
14
|
+
- **Supported Values**: 3 to 300, though practical values are usually lower than 30.
|
|
15
|
+
- **Default**: None.
|
|
16
|
+
|
|
17
|
+
kappa_1 (float | None):
|
|
18
|
+
The rate at which the cat qubit loses one photon, creating a bit-flip.
|
|
19
|
+
- **Tooltip**: Lower values mean lower error rates.
|
|
20
|
+
- **Supported Values**: 10 to 10^5. Current hardware is at ~10^3.
|
|
21
|
+
- **Default**: None.
|
|
22
|
+
|
|
23
|
+
kappa_2 (float | None):
|
|
24
|
+
The rate at which the cat qubit is stabilized using two-photon dissipation.
|
|
25
|
+
- **Tooltip**: Higher values mean lower error rates.
|
|
26
|
+
- **Supported Values**: 100 to 10^9. Current hardware is at ~10^5.
|
|
27
|
+
- **Default**: None.
|
|
28
|
+
|
|
29
|
+
average_nb_photons (float | None):
|
|
30
|
+
The average number of photons.
|
|
31
|
+
- **Tooltip**: Bit-flip probability decreases exponentially with this parameter, phase-flip probability increases linearly.
|
|
32
|
+
- **Supported Values**: 4 to 10^5, though practical values are usually lower than 30.
|
|
33
|
+
- **Default**: None.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
distance: int | None = pydantic.Field(
|
|
37
|
+
default=None, description="Repetition code distance"
|
|
38
|
+
)
|
|
39
|
+
kappa_1: float | None = pydantic.Field(
|
|
40
|
+
default=None, description="One-photon dissipation rate (Hz)"
|
|
41
|
+
)
|
|
42
|
+
kappa_2: float | None = pydantic.Field(
|
|
43
|
+
default=None, description="Two-photon dissipation rate (Hz)"
|
|
44
|
+
)
|
|
45
|
+
average_nb_photons: float | None = pydantic.Field(
|
|
46
|
+
default=None, description="Average number of photons"
|
|
47
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AQTConfig(ProviderConfig):
|
|
7
|
+
"""
|
|
8
|
+
Configuration specific to AQT (Alpine Quantum Technologies).
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
api_key: The API key required to access AQT's quantum computing services.
|
|
12
|
+
workspace: The AQT workspace where the simulator/hardware is located.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
api_key: str | None = pydantic.Field(default=None, description="AQT API key")
|
|
16
|
+
workspace: str = pydantic.Field(description="AQT workspace")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend import pydantic_backend
|
|
4
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AzureConfig(ProviderConfig):
|
|
8
|
+
"""
|
|
9
|
+
Configuration specific to Azure.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
location (str): Azure region. Defaults to `"East US"`.
|
|
13
|
+
tenant_id (str | None): Azure Tenant ID used to identify the directory in which the application is registered.
|
|
14
|
+
client_id (str | None): Azure Client ID, also known as the application ID, which is used to authenticate the application.
|
|
15
|
+
client_secret (str | None): Azure Client Secret associated with the application, used for authentication.
|
|
16
|
+
resource_id (str | None): Azure Resource ID, including the subscription ID, resource group, and workspace, typically used for personal resources.
|
|
17
|
+
ionq_error_mitigation (bool): Should use error mitigation when running on IonQ through Azure. Defaults to `False`.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
location: str = pydantic.Field(
|
|
21
|
+
default="East US", description="Azure personal resource region"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
tenant_id: str | None = pydantic.Field(default=None, description="Azure Tenant ID")
|
|
25
|
+
client_id: str | None = pydantic.Field(default=None, description="Azure Client ID")
|
|
26
|
+
client_secret: str | None = pydantic.Field(
|
|
27
|
+
default=None, description="Azure Client Secret"
|
|
28
|
+
)
|
|
29
|
+
resource_id: pydantic_backend.PydanticAzureResourceIDType | None = pydantic.Field(
|
|
30
|
+
default=None,
|
|
31
|
+
description="Azure Resource ID (including Azure subscription ID, resource "
|
|
32
|
+
"group and workspace), for personal resource",
|
|
33
|
+
)
|
|
34
|
+
ionq_error_mitigation: bool = pydantic.Field(
|
|
35
|
+
default=False,
|
|
36
|
+
description="Error mitigation configuration upon running on IonQ through Azure.",
|
|
37
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BraketConfig(ProviderConfig):
|
|
7
|
+
"""
|
|
8
|
+
Configuration specific to Amazon Braket.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
braket_access_key_id (str | None):
|
|
12
|
+
The access key id of user with full braket access
|
|
13
|
+
|
|
14
|
+
braket_secret_access_key (str | None):
|
|
15
|
+
The secret key assigned to the access key id for the user with full braket access.
|
|
16
|
+
|
|
17
|
+
s3_bucket_name (str | None):
|
|
18
|
+
The name of the S3 bucket where results and other related data will be stored.
|
|
19
|
+
This field should contain a valid S3 bucket name under your AWS account.
|
|
20
|
+
|
|
21
|
+
s3_folder (pydantic_backend.PydanticS3BucketKey | None):
|
|
22
|
+
The folder path within the specified S3 bucket. This allows for organizing
|
|
23
|
+
results and data under a specific directory within the S3 bucket.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
braket_access_key_id: str | None = pydantic.Field(
|
|
27
|
+
default=None,
|
|
28
|
+
description="Key id assigned to user with credentials to access Braket service",
|
|
29
|
+
)
|
|
30
|
+
braket_secret_access_key: str | None = pydantic.Field(
|
|
31
|
+
default=None,
|
|
32
|
+
description="Secret access key assigned to user with credentials to access Braket service",
|
|
33
|
+
)
|
|
34
|
+
s3_bucket_name: str | None = pydantic.Field(
|
|
35
|
+
default=None, description="S3 Bucket Name"
|
|
36
|
+
)
|
|
37
|
+
s3_folder: str | None = pydantic.Field(
|
|
38
|
+
default=None, description="S3 Folder Path Within The S3 Bucket"
|
|
39
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class IBMConfig(ProviderConfig):
|
|
7
|
+
"""
|
|
8
|
+
Configuration specific to IBM.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
access_token (str | None): The IBM Cloud access token to be used with IBM Quantum hosted backends. Defaults to `None`.
|
|
12
|
+
channel (str): Channel to use for IBM cloud backends. Defaults to `"ibm_cloud"`.
|
|
13
|
+
instance_crn (str): The IBM Cloud instance CRN (Cloud Resource Name) for the IBM Quantum service.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
access_token: str | None = pydantic.Field(
|
|
17
|
+
default=None,
|
|
18
|
+
description="IBM Cloud access token to be used"
|
|
19
|
+
" with IBM Quantum hosted backends.",
|
|
20
|
+
)
|
|
21
|
+
channel: str = pydantic.Field(
|
|
22
|
+
default="ibm_cloud", description="Channel to use for IBM cloud backends."
|
|
23
|
+
)
|
|
24
|
+
instance_crn: str | None = pydantic.Field(
|
|
25
|
+
default=None, description="IBM Cloud instance CRN."
|
|
26
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import pydantic
|
|
2
|
+
|
|
3
|
+
from classiq.interface.backend import pydantic_backend
|
|
4
|
+
from classiq.interface.backend.provider_config.provider_config import ProviderConfig
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IonQConfig(ProviderConfig):
|
|
8
|
+
"""
|
|
9
|
+
Configuration specific to IonQ.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
api_key (PydanticIonQApiKeyType | None): Key to access IonQ API.
|
|
13
|
+
error_mitigation (bool): A configuration option to enable or disable error mitigation during execution. Defaults to `False`.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
api_key: pydantic_backend.PydanticIonQApiKeyType | None = pydantic.Field(
|
|
17
|
+
default=None, description="IonQ API key."
|
|
18
|
+
)
|
|
19
|
+
error_mitigation: bool = pydantic.Field(
|
|
20
|
+
default=False,
|
|
21
|
+
description="Enable error mitigation during execution.",
|
|
22
|
+
)
|
|
@@ -2,6 +2,8 @@ from typing import Literal, Union
|
|
|
2
2
|
|
|
3
3
|
from classiq.interface.enum_utils import StrEnum
|
|
4
4
|
|
|
5
|
+
__all__ = ["ProviderVendor"]
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
class AnalyzerProviderVendor(StrEnum):
|
|
7
9
|
IBM_QUANTUM = "IBM Quantum"
|
|
@@ -10,6 +12,10 @@ class AnalyzerProviderVendor(StrEnum):
|
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
class ProviderVendor(StrEnum):
|
|
15
|
+
"""
|
|
16
|
+
Enum representing various quantum computing service providers.
|
|
17
|
+
"""
|
|
18
|
+
|
|
13
19
|
CLASSIQ = "Classiq"
|
|
14
20
|
IBM_QUANTUM = "IBM Quantum"
|
|
15
21
|
AZURE_QUANTUM = "Azure Quantum"
|
|
@@ -20,7 +26,6 @@ class ProviderVendor(StrEnum):
|
|
|
20
26
|
OQC = "OQC"
|
|
21
27
|
INTEL = "Intel"
|
|
22
28
|
AQT = "AQT"
|
|
23
|
-
IQCC = "IQCC"
|
|
24
29
|
CINECA = "CINECA"
|
|
25
30
|
|
|
26
31
|
|
|
@@ -35,10 +40,23 @@ class ProviderTypeVendor:
|
|
|
35
40
|
OQC = Literal[ProviderVendor.OQC]
|
|
36
41
|
INTEL = Literal[ProviderVendor.INTEL]
|
|
37
42
|
AQT = Literal[ProviderVendor.AQT]
|
|
38
|
-
IQCC = Literal[ProviderVendor.IQCC]
|
|
39
43
|
CINECA = Literal[ProviderVendor.CINECA]
|
|
40
44
|
|
|
41
45
|
|
|
46
|
+
PROVIDER_NAME_MAPPER = {
|
|
47
|
+
ProviderVendor.IONQ: "IONQ",
|
|
48
|
+
ProviderVendor.IBM_QUANTUM: "IBM_CLOUD",
|
|
49
|
+
ProviderVendor.AZURE_QUANTUM: "AZURE",
|
|
50
|
+
ProviderVendor.AMAZON_BRAKET: "AMAZON",
|
|
51
|
+
ProviderVendor.GOOGLE: "GOOGLE",
|
|
52
|
+
ProviderVendor.ALICE_AND_BOB: "ALICE_AND_BOB",
|
|
53
|
+
ProviderVendor.OQC: "OQC",
|
|
54
|
+
ProviderVendor.INTEL: "INTEL",
|
|
55
|
+
ProviderVendor.AQT: "AQT",
|
|
56
|
+
ProviderVendor.CLASSIQ: "CLASSIQ",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
42
60
|
class ClassiqSimulatorBackendNames(StrEnum):
|
|
43
61
|
"""
|
|
44
62
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from pydantic import BaseModel
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
class HardwareEfficientConstraints(BaseModel):
|
|
7
5
|
num_qubits: int
|
|
8
|
-
num_two_qubit_gates:
|
|
9
|
-
num_one_qubit_gates:
|
|
10
|
-
max_depth:
|
|
6
|
+
num_two_qubit_gates: int | None = None
|
|
7
|
+
num_one_qubit_gates: int | None = None
|
|
8
|
+
max_depth: int | None = None
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
class HardwareEfficient(BaseModel):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections.abc import Collection, Iterable
|
|
2
2
|
from functools import reduce
|
|
3
3
|
from itertools import combinations
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, cast
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pydantic
|
|
@@ -65,7 +65,7 @@ class PauliOperator(HashablePydanticBaseModel, VersionedModel):
|
|
|
65
65
|
|
|
66
66
|
@staticmethod
|
|
67
67
|
def _validate_monomial_coefficient(
|
|
68
|
-
coeff:
|
|
68
|
+
coeff: sympy.Expr | ParameterComplexType,
|
|
69
69
|
) -> ParameterComplexType:
|
|
70
70
|
if isinstance(coeff, str):
|
|
71
71
|
validate_expression_str(coeff)
|
|
@@ -219,7 +219,7 @@ class PauliOperator(HashablePydanticBaseModel, VersionedModel):
|
|
|
219
219
|
def from_unzipped_lists(
|
|
220
220
|
cls,
|
|
221
221
|
operators: list[list["Pauli"]],
|
|
222
|
-
coefficients:
|
|
222
|
+
coefficients: list[complex] | None = None,
|
|
223
223
|
) -> "PauliOperator":
|
|
224
224
|
if coefficients is None:
|
|
225
225
|
coefficients = [1] * len(operators)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
import numpy as np
|
|
4
2
|
import pyomo.core as pyo
|
|
5
3
|
|
|
@@ -7,8 +5,8 @@ import pyomo.core as pyo
|
|
|
7
5
|
def knapsack(
|
|
8
6
|
values: list[int],
|
|
9
7
|
upper_bound: int,
|
|
10
|
-
weights:
|
|
11
|
-
max_weight:
|
|
8
|
+
weights: list[int] | None = None,
|
|
9
|
+
max_weight: int | None = None,
|
|
12
10
|
) -> pyo.ConcreteModel:
|
|
13
11
|
model = pyo.ConcreteModel()
|
|
14
12
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import itertools
|
|
2
|
-
from typing import Union
|
|
3
2
|
|
|
4
3
|
import networkx as nx
|
|
5
4
|
import pyomo.core as pyo
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
def tsp_digraph(
|
|
9
|
-
graph: nx.DiGraph, source:
|
|
8
|
+
graph: nx.DiGraph, source: int | str, sink: int | str, nonedge: int
|
|
10
9
|
) -> pyo.ConcreteModel:
|
|
11
10
|
model = pyo.ConcreteModel()
|
|
12
11
|
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
from collections.abc import Sequence
|
|
3
|
-
from typing import Union
|
|
4
3
|
|
|
5
4
|
import zstandard as zstd
|
|
6
5
|
from pydantic import BaseModel
|
|
7
6
|
from pydantic_core import from_json, to_json
|
|
8
7
|
|
|
9
8
|
|
|
10
|
-
def compress_pydantic(obj:
|
|
9
|
+
def compress_pydantic(obj: BaseModel | Sequence[BaseModel]) -> bytes:
|
|
11
10
|
json_data = to_json(obj)
|
|
12
11
|
compressed_data = _compress(json_data, level=22) # max compression level
|
|
13
12
|
return compressed_data
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
def decompress(compressed_data: bytes) ->
|
|
15
|
+
def decompress(compressed_data: bytes) -> dict | list[dict]:
|
|
17
16
|
decompressed_data = _decompress(compressed_data)
|
|
18
17
|
return from_json(decompressed_data)
|
|
19
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Mapping, Sequence
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Union, cast
|
|
3
3
|
from uuid import UUID
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
@@ -20,11 +20,12 @@ ParameterValue = Union[float, int, str, None]
|
|
|
20
20
|
|
|
21
21
|
class FunctionDebugInfo(BaseModel):
|
|
22
22
|
name: str
|
|
23
|
-
statement_type:
|
|
23
|
+
statement_type: StatementType | None = None
|
|
24
24
|
is_inverse: bool = Field(default=False)
|
|
25
|
-
|
|
25
|
+
is_daggered: bool = Field(default=False)
|
|
26
|
+
control_variable: str | None = Field(default=None)
|
|
26
27
|
port_to_passed_variable_map: dict[str, str] = Field(default_factory=dict)
|
|
27
|
-
node:
|
|
28
|
+
node: ConcreteQuantumStatement | None = None
|
|
28
29
|
|
|
29
30
|
@property
|
|
30
31
|
def is_allocate_or_free(self) -> bool:
|
|
@@ -61,7 +62,7 @@ class DebugInfoCollection(BaseModel):
|
|
|
61
62
|
def __setitem__(self, key: UUID, value: FunctionDebugInfo) -> None:
|
|
62
63
|
self.data[str(key)] = value
|
|
63
64
|
|
|
64
|
-
def get(self, key: UUID) ->
|
|
65
|
+
def get(self, key: UUID) -> FunctionDebugInfo | None:
|
|
65
66
|
return self.data.get(str(key))
|
|
66
67
|
|
|
67
68
|
def __getitem__(self, key: UUID) -> FunctionDebugInfo:
|
|
@@ -70,7 +71,7 @@ class DebugInfoCollection(BaseModel):
|
|
|
70
71
|
def __contains__(self, key: UUID) -> bool:
|
|
71
72
|
return str(key) in self.data
|
|
72
73
|
|
|
73
|
-
def get_blackbox_data(self, key: UUID) ->
|
|
74
|
+
def get_blackbox_data(self, key: UUID) -> FunctionDebugInfoInterface | None:
|
|
74
75
|
if (debug_info := self.get(key)) is None:
|
|
75
76
|
return None
|
|
76
77
|
return self.blackbox_data.get(debug_info.name)
|
|
@@ -103,7 +104,7 @@ def new_function_debug_info_by_node(
|
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
def calculate_port_to_passed_variable_mapping(
|
|
106
|
-
arg_decls: Sequence[PositionalArg], args: Sequence[
|
|
107
|
+
arg_decls: Sequence[PositionalArg], args: Sequence[ArgValue | None]
|
|
107
108
|
) -> dict[str, str]:
|
|
108
109
|
return {
|
|
109
110
|
arg_decl.name: str(cast(ConcreteHandleBinding, arg))
|
classiq/interface/exceptions.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from collections.abc import Iterable
|
|
3
|
-
from typing import Optional
|
|
4
3
|
|
|
5
4
|
_logger = logging.getLogger(__name__)
|
|
6
5
|
|
|
@@ -53,7 +52,7 @@ class ClassiqAnalyzerVisualizationError(ClassiqError):
|
|
|
53
52
|
|
|
54
53
|
|
|
55
54
|
class ClassiqAPIError(ClassiqError):
|
|
56
|
-
def __init__(self, message: str, status_code:
|
|
55
|
+
def __init__(self, message: str, status_code: int | None = None) -> None:
|
|
57
56
|
self.status_code = status_code
|
|
58
57
|
super().__init__(message)
|
|
59
58
|
|
|
@@ -96,10 +95,6 @@ class ClassiqQFuncError(ClassiqValueError):
|
|
|
96
95
|
pass
|
|
97
96
|
|
|
98
97
|
|
|
99
|
-
class ClassiqQSVMError(ClassiqValueError):
|
|
100
|
-
pass
|
|
101
|
-
|
|
102
|
-
|
|
103
98
|
class ClassiqQNNError(ClassiqValueError):
|
|
104
99
|
pass
|
|
105
100
|
|
|
@@ -191,7 +186,7 @@ class ClassiqExpansionError(ClassiqError):
|
|
|
191
186
|
|
|
192
187
|
|
|
193
188
|
class ClassiqInternalError(ClassiqError):
|
|
194
|
-
def __init__(self, message:
|
|
189
|
+
def __init__(self, message: str | None = None) -> None:
|
|
195
190
|
final_message = "Internal error occurred. Please contact Classiq support."
|
|
196
191
|
if message is not None:
|
|
197
192
|
final_message += f"\nError: {message}"
|
|
@@ -200,3 +195,7 @@ class ClassiqInternalError(ClassiqError):
|
|
|
200
195
|
|
|
201
196
|
class ClassiqInternalExpansionError(ClassiqInternalError):
|
|
202
197
|
pass
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class ClassiqInternalArithmeticError(ClassiqInternalError):
|
|
201
|
+
pass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Annotated, Literal,
|
|
1
|
+
from typing import Annotated, Literal, Union
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ class MinimizeCostInput(BaseModel, json_encoders=CUSTOM_ENCODERS):
|
|
|
17
17
|
initial_params: Arguments
|
|
18
18
|
max_iteration: int
|
|
19
19
|
quantile: float
|
|
20
|
-
tolerance:
|
|
20
|
+
tolerance: float | None
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class MinimizeClassicalCostInput(MinimizeCostInput):
|
|
@@ -41,7 +41,7 @@ ConcreteMinimizeCostInput = Annotated[
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
class PrimitivesInput(BaseModel, json_encoders=CUSTOM_ENCODERS):
|
|
44
|
-
sample:
|
|
45
|
-
estimate:
|
|
46
|
-
minimize:
|
|
47
|
-
random_seed:
|
|
44
|
+
sample: list[Arguments] | None = Field(default=None)
|
|
45
|
+
estimate: EstimateInput | None = Field(default=None)
|
|
46
|
+
minimize: ConcreteMinimizeCostInput | None = Field(default=None)
|
|
47
|
+
random_seed: int | None = Field(default=None)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
import pydantic
|
|
4
2
|
|
|
5
3
|
from classiq.interface.backend.backend_preferences import (
|
|
@@ -43,7 +41,7 @@ class ExecutionPreferences(pydantic.BaseModel):
|
|
|
43
41
|
job_name (Optional[str]): The name of the job, with a minimum length of 1 character.
|
|
44
42
|
"""
|
|
45
43
|
|
|
46
|
-
noise_properties:
|
|
44
|
+
noise_properties: NoiseProperties | None = pydantic.Field(
|
|
47
45
|
default=None, description="Properties of the noise in the circuit"
|
|
48
46
|
)
|
|
49
47
|
random_seed: int = pydantic.Field(
|
|
@@ -53,13 +51,13 @@ class ExecutionPreferences(pydantic.BaseModel):
|
|
|
53
51
|
backend_preferences: BackendPreferencesTypes = backend_preferences_field(
|
|
54
52
|
backend_name=ClassiqSimulatorBackendNames.SIMULATOR
|
|
55
53
|
)
|
|
56
|
-
num_shots:
|
|
54
|
+
num_shots: pydantic.PositiveInt | None = pydantic.Field(default=None)
|
|
57
55
|
transpile_to_hardware: TranspilationOption = pydantic.Field(
|
|
58
56
|
default=TranspilationOption.DECOMPOSE,
|
|
59
57
|
description="Transpile the circuit to the hardware basis gates before execution",
|
|
60
58
|
title="Transpilation Option",
|
|
61
59
|
)
|
|
62
|
-
job_name:
|
|
60
|
+
job_name: str | None = pydantic.Field(
|
|
63
61
|
min_length=1, description="The job name", default=None
|
|
64
62
|
)
|
|
65
63
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from typing import Annotated, Literal,
|
|
2
|
+
from typing import Annotated, Literal, Union
|
|
3
3
|
|
|
4
4
|
import pydantic
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
@@ -51,28 +51,28 @@ class ProviderJobs(BaseModel):
|
|
|
51
51
|
class JobCost(BaseModel):
|
|
52
52
|
total_cost: float = Field(default=0)
|
|
53
53
|
currency_code: str = Field(default="USD")
|
|
54
|
-
organization:
|
|
54
|
+
organization: str | None = Field(default=None)
|
|
55
55
|
jobs: list[ProviderJobs] = Field(default=[])
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
class ExecutionJobDetails(VersionedModel):
|
|
59
59
|
id: str
|
|
60
60
|
|
|
61
|
-
name:
|
|
61
|
+
name: str | None = Field(default=None)
|
|
62
62
|
start_time: datetime
|
|
63
|
-
end_time:
|
|
63
|
+
end_time: datetime | None = Field(default=None)
|
|
64
64
|
|
|
65
|
-
provider:
|
|
66
|
-
backend_name:
|
|
65
|
+
provider: str | None = Field(default=None)
|
|
66
|
+
backend_name: str | None = Field(default=None)
|
|
67
67
|
|
|
68
68
|
status: JobStatus
|
|
69
69
|
|
|
70
|
-
num_shots:
|
|
71
|
-
program_id:
|
|
70
|
+
num_shots: int | None = Field(default=None)
|
|
71
|
+
program_id: str | None = Field(default=None)
|
|
72
72
|
|
|
73
|
-
error:
|
|
73
|
+
error: str | None = Field(default=None)
|
|
74
74
|
|
|
75
|
-
cost:
|
|
75
|
+
cost: JobCost | None = Field(default=None)
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
class ExecutionJobsQueryResults(VersionedModel):
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
from typing import Annotated, Any, Literal, Union
|
|
1
|
+
from typing import Annotated, Any, Literal, TypeAlias, Union
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
-
from typing_extensions import TypeAlias
|
|
5
4
|
|
|
6
5
|
from classiq.interface.applications.iqae.iqae_result import IQAEResult
|
|
7
6
|
from classiq.interface.enum_utils import StrEnum
|
|
@@ -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
|
|
5
5
|
|
|
6
6
|
import pydantic
|
|
7
7
|
from pydantic import BaseModel, ConfigDict
|
|
@@ -35,7 +35,7 @@ class QuantumBaseCode(BaseModel):
|
|
|
35
35
|
@pydantic.field_validator("code")
|
|
36
36
|
@classmethod
|
|
37
37
|
def load_quantum_program(
|
|
38
|
-
cls, code:
|
|
38
|
+
cls, code: CodeType | IonqQuantumCircuit, values: ValidationInfo
|
|
39
39
|
) -> CodeType:
|
|
40
40
|
syntax = values.data.get("syntax")
|
|
41
41
|
if isinstance(code, IonqQuantumCircuit):
|
|
@@ -57,11 +57,11 @@ class QuantumCode(QuantumBaseCode):
|
|
|
57
57
|
default_factory=dict,
|
|
58
58
|
description="The map of outputs to their qubits in the circuit.",
|
|
59
59
|
)
|
|
60
|
-
registers_initialization:
|
|
60
|
+
registers_initialization: RegistersInitialization | None = pydantic.Field(
|
|
61
61
|
default=None,
|
|
62
62
|
description="Initial conditions for the different registers in the circuit.",
|
|
63
63
|
)
|
|
64
|
-
synthesis_execution_data:
|
|
64
|
+
synthesis_execution_data: ExecutionData | None = pydantic.Field(default=None)
|
|
65
65
|
synthesis_execution_arguments: Arguments = pydantic.Field(default_factory=dict)
|
|
66
66
|
model_config = ConfigDict(validate_assignment=True)
|
|
67
67
|
|
|
@@ -90,9 +90,9 @@ class QuantumCode(QuantumBaseCode):
|
|
|
90
90
|
@classmethod
|
|
91
91
|
def validate_synthesis_execution_data(
|
|
92
92
|
cls,
|
|
93
|
-
synthesis_execution_data:
|
|
93
|
+
synthesis_execution_data: ExecutionData | None,
|
|
94
94
|
values: ValidationInfo,
|
|
95
|
-
) ->
|
|
95
|
+
) -> ExecutionData | None:
|
|
96
96
|
if (
|
|
97
97
|
synthesis_execution_data is not None
|
|
98
98
|
and synthesis_execution_data.function_execution
|
|
@@ -103,8 +103,8 @@ class QuantumCode(QuantumBaseCode):
|
|
|
103
103
|
|
|
104
104
|
@staticmethod
|
|
105
105
|
def from_file(
|
|
106
|
-
file_path:
|
|
107
|
-
syntax:
|
|
106
|
+
file_path: str | Path,
|
|
107
|
+
syntax: str | QuantumInstructionSet | None = None,
|
|
108
108
|
arguments: MultipleArguments = (),
|
|
109
109
|
) -> QuantumCode:
|
|
110
110
|
path = Path(file_path)
|