classiq 0.44.0__py3-none-any.whl → 0.45.1__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 -2
- classiq/_internals/api_wrapper.py +2 -2
- classiq/_internals/authentication/auth0.py +1 -1
- classiq/_internals/authentication/device.py +5 -1
- classiq/_internals/authentication/token_manager.py +5 -4
- classiq/_internals/client.py +1 -1
- classiq/_internals/config.py +1 -2
- classiq/_internals/host_checker.py +1 -2
- classiq/_internals/jobs.py +1 -1
- classiq/analyzer/analyzer.py +1 -1
- classiq/analyzer/analyzer_utilities.py +1 -1
- classiq/analyzer/rb.py +1 -1
- classiq/applications/chemistry/chemistry_model_constructor.py +1 -1
- classiq/applications/combinatorial_helpers/arithmetic/isolation.py +1 -1
- classiq/applications/combinatorial_helpers/encoding_mapping.py +1 -1
- classiq/applications/combinatorial_helpers/encoding_utils.py +2 -1
- classiq/applications/combinatorial_helpers/optimization_model.py +1 -1
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +1 -1
- classiq/applications/combinatorial_helpers/pyomo_utils.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/encoding.py +1 -1
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +5 -4
- classiq/applications/combinatorial_helpers/transformations/ising_converter.py +1 -1
- classiq/applications/combinatorial_helpers/transformations/sign_seperation.py +1 -1
- classiq/applications/finance/finance_model_constructor.py +1 -1
- classiq/applications/qnn/circuit_utils.py +1 -1
- classiq/applications/qnn/datasets/dataset_base_classes.py +2 -1
- classiq/applications/qnn/datasets/dataset_not.py +2 -1
- classiq/applications/qnn/qlayer.py +2 -1
- classiq/applications/qnn/torch_utils.py +2 -1
- classiq/applications/qsvm/qsvm_model_constructor.py +1 -1
- classiq/execution/execution_session.py +1 -1
- classiq/execution/jobs.py +5 -2
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/cytoscape_graph.py +1 -2
- classiq/interface/analyzer/result.py +2 -3
- classiq/interface/backend/backend_preferences.py +1 -2
- classiq/interface/backend/quantum_backend_providers.py +1 -1
- classiq/interface/chemistry/fermionic_operator.py +1 -2
- classiq/interface/chemistry/ground_state_problem.py +2 -3
- classiq/interface/chemistry/molecule.py +1 -2
- classiq/interface/chemistry/operator.py +3 -9
- classiq/interface/combinatorial_optimization/encoding_types.py +1 -1
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +1 -1
- classiq/interface/combinatorial_optimization/solver_types.py +1 -1
- classiq/interface/executor/aws_execution_cost.py +2 -2
- classiq/interface/executor/execution_preferences.py +1 -2
- classiq/interface/executor/execution_result.py +1 -2
- classiq/interface/executor/optimizer_preferences.py +2 -3
- classiq/interface/executor/quantum_code.py +1 -2
- classiq/interface/executor/quantum_instruction_set.py +2 -2
- classiq/interface/executor/register_initialization.py +1 -2
- classiq/interface/executor/result.py +4 -2
- classiq/interface/finance/function_input.py +6 -11
- classiq/interface/generator/amplitude_loading.py +2 -3
- classiq/interface/generator/ansatz_library.py +1 -1
- classiq/interface/generator/application_apis/finance_declarations.py +1 -22
- classiq/interface/generator/arith/arithmetic.py +10 -8
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +1 -2
- classiq/interface/generator/arith/arithmetic_expression_abc.py +1 -2
- classiq/interface/generator/arith/arithmetic_expression_parser.py +3 -4
- classiq/interface/generator/arith/arithmetic_expression_validator.py +1 -2
- classiq/interface/generator/arith/arithmetic_param_getters.py +1 -2
- classiq/interface/generator/arith/arithmetic_result_builder.py +15 -11
- classiq/interface/generator/arith/ast_node_rewrite.py +1 -1
- classiq/interface/generator/arith/binary_ops.py +2 -3
- classiq/interface/generator/arith/endianness.py +1 -1
- classiq/interface/generator/arith/extremum_operations.py +1 -2
- classiq/interface/generator/arith/logical_ops.py +1 -2
- classiq/interface/generator/arith/register_user_input.py +1 -2
- classiq/interface/generator/arith/unary_ops.py +1 -2
- classiq/interface/generator/arith/uncomputation_methods.py +1 -1
- classiq/interface/generator/chemistry_function_params.py +1 -2
- classiq/interface/generator/circuit_code/circuit_code.py +1 -2
- classiq/interface/generator/circuit_code/types_and_constants.py +1 -2
- classiq/interface/generator/commuting_pauli_exponentiation.py +1 -2
- classiq/interface/generator/control_state.py +1 -2
- classiq/interface/generator/custom_ansatz.py +1 -2
- classiq/interface/generator/expressions/enums/finance_functions.py +4 -5
- classiq/interface/generator/expressions/evaluated_expression.py +1 -2
- classiq/interface/generator/expressions/expression.py +1 -2
- classiq/interface/generator/expressions/non_symbolic_expr.py +1 -1
- classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -5
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -7
- classiq/interface/generator/expressions/qmod_qstruct_proxy.py +1 -1
- classiq/interface/generator/expressions/qmod_sized_proxy.py +1 -1
- classiq/interface/generator/function_params.py +2 -3
- classiq/interface/generator/functions/classical_type.py +0 -38
- classiq/interface/generator/functions/port_declaration.py +1 -2
- classiq/interface/generator/functions/type_name.py +2 -26
- classiq/interface/generator/grover_diffuser.py +1 -2
- classiq/interface/generator/grover_operator.py +1 -2
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +1 -2
- classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +1 -2
- classiq/interface/generator/hardware/hardware_data.py +1 -2
- classiq/interface/generator/hardware_efficient_ansatz.py +2 -3
- classiq/interface/generator/hartree_fock.py +1 -2
- classiq/interface/generator/linear_pauli_rotations.py +1 -2
- classiq/interface/generator/mcmt_method.py +1 -1
- classiq/interface/generator/mcu.py +1 -2
- classiq/interface/generator/mcx.py +1 -2
- classiq/interface/generator/model/constraints.py +2 -3
- classiq/interface/generator/model/model.py +1 -2
- classiq/interface/generator/model/preferences/preferences.py +2 -3
- classiq/interface/generator/model/quantum_register.py +1 -2
- classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
- classiq/interface/generator/oracles/custom_oracle.py +1 -2
- classiq/interface/generator/oracles/oracle_abc.py +1 -2
- classiq/interface/generator/partitioned_register.py +1 -2
- classiq/interface/generator/piecewise_linear_amplitude_loading.py +1 -2
- classiq/interface/generator/preferences/optimization.py +1 -2
- classiq/interface/generator/qpe.py +1 -2
- classiq/interface/generator/qsvm.py +2 -3
- classiq/interface/generator/quantum_function_call.py +1 -2
- classiq/interface/generator/quantum_program.py +4 -5
- classiq/interface/generator/range_types.py +1 -1
- classiq/interface/generator/register_role.py +1 -1
- classiq/interface/generator/slice_parsing_utils.py +1 -2
- classiq/interface/generator/standard_gates/controlled_standard_gates.py +1 -2
- classiq/interface/generator/state_preparation/metrics.py +2 -3
- classiq/interface/generator/state_preparation/state_preparation.py +1 -2
- classiq/interface/generator/transpiler_basis_gates.py +1 -1
- classiq/interface/generator/types/builtin_enum_declarations.py +38 -45
- classiq/interface/generator/types/enum_declaration.py +1 -2
- classiq/interface/generator/types/struct_declaration.py +1 -2
- classiq/interface/generator/ucc.py +1 -2
- classiq/interface/generator/unitary_gate.py +1 -2
- classiq/interface/generator/validations/flow_graph.py +1 -2
- classiq/interface/generator/validations/validator_functions.py +1 -2
- classiq/interface/hardware.py +1 -1
- classiq/interface/helpers/validation_helpers.py +1 -2
- classiq/interface/ide/visual_model.py +1 -2
- classiq/interface/jobs.py +2 -3
- classiq/interface/model/bind_operation.py +1 -2
- classiq/interface/model/inplace_binary_operation.py +1 -2
- classiq/interface/model/model.py +1 -2
- classiq/interface/model/parameter.py +1 -2
- classiq/interface/model/port_declaration.py +1 -2
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +1 -2
- classiq/interface/model/quantum_function_call.py +1 -2
- classiq/interface/model/quantum_lambda_function.py +1 -2
- classiq/interface/model/quantum_type.py +1 -22
- classiq/interface/model/validation_handle.py +1 -2
- classiq/interface/server/global_versions.py +2 -2
- classiq/qmod/builtins/classical_execution_primitives.py +1 -1
- classiq/qmod/builtins/operations.py +1 -1
- classiq/qmod/classical_function.py +1 -1
- classiq/qmod/declaration_inferrer.py +9 -7
- classiq/qmod/qmod_constant.py +1 -1
- classiq/qmod/qmod_parameter.py +26 -2
- classiq/qmod/qmod_variable.py +48 -9
- classiq/qmod/quantum_expandable.py +9 -3
- classiq/qmod/quantum_function.py +9 -2
- classiq/qmod/semantics/annotation.py +1 -2
- classiq/qmod/semantics/static_semantics_visitor.py +1 -1
- classiq/qmod/semantics/validation/func_call_validation.py +1 -1
- classiq/qmod/symbolic.py +2 -1
- classiq/show.py +1 -1
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/METADATA +1 -1
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/RECORD +162 -162
- /classiq/{_internals → interface}/enum_utils.py +0 -0
- /classiq/{exceptions.py → interface/exceptions.py} +0 -0
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/WHEEL +0 -0
@@ -1,11 +1,10 @@
|
|
1
1
|
from pydantic import BaseModel
|
2
2
|
|
3
|
+
from classiq.interface.enum_utils import StrEnum
|
3
4
|
from classiq.interface.helpers.custom_pydantic_types import (
|
4
5
|
PydanticNonOneProbabilityFloat,
|
5
6
|
)
|
6
7
|
|
7
|
-
from classiq._internals.enum_utils import StrEnum
|
8
|
-
|
9
8
|
|
10
9
|
# it seems to be ambiguous in this class. it is Identical to the Metrics, up to the
|
11
10
|
# attribute RANDOM, However RANDOM isn't really used or treated in any part of the code.
|
@@ -2,6 +2,7 @@ from typing import Any, Dict, Optional, Tuple
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqMismatchIOsError, ClassiqValueError
|
5
6
|
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
6
7
|
from classiq.interface.generator.function_param_list_without_self_reference import (
|
7
8
|
function_param_library_without_self_reference,
|
@@ -17,8 +18,6 @@ from classiq.interface.generator.hamiltonian_evolution.exponentiation import (
|
|
17
18
|
)
|
18
19
|
from classiq.interface.generator.user_defined_function_params import CustomFunction
|
19
20
|
|
20
|
-
from classiq.exceptions import ClassiqMismatchIOsError, ClassiqValueError
|
21
|
-
|
22
21
|
PHASE_ESTIMATION_DEFAULT_OUTPUT_NAME = "PHASE_ESTIMATION"
|
23
22
|
CUSTOM_FUNCTIONS_IO_MISMATCH_ERROR = (
|
24
23
|
"Custom function provided to the QPE has different input and output names."
|
@@ -3,6 +3,8 @@ from typing import List, Literal, Optional, Union
|
|
3
3
|
import numpy as np
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.enum_utils import StrEnum
|
7
|
+
from classiq.interface.exceptions import ClassiqQSVMError, ClassiqValueError
|
6
8
|
from classiq.interface.generator.arith.register_user_input import RegisterUserInput
|
7
9
|
from classiq.interface.generator.function_params import (
|
8
10
|
DEFAULT_INPUT_NAME,
|
@@ -13,9 +15,6 @@ from classiq.interface.helpers.hashable_pydantic_base_model import (
|
|
13
15
|
HashablePydanticBaseModel,
|
14
16
|
)
|
15
17
|
|
16
|
-
from classiq._internals.enum_utils import StrEnum
|
17
|
-
from classiq.exceptions import ClassiqQSVMError, ClassiqValueError
|
18
|
-
|
19
18
|
VALID_PAULI_LETTERS = ("I", "X", "Y", "Z")
|
20
19
|
|
21
20
|
|
@@ -23,6 +23,7 @@ from uuid import UUID, uuid4
|
|
23
23
|
import pydantic
|
24
24
|
from pydantic import BaseModel, Extra
|
25
25
|
|
26
|
+
from classiq.interface.exceptions import ClassiqControlError, ClassiqValueError
|
26
27
|
from classiq.interface.generator import function_param_list, function_params as f_params
|
27
28
|
from classiq.interface.generator.arith.arithmetic import Arithmetic
|
28
29
|
from classiq.interface.generator.compiler_keywords import EXPANDED_KEYWORD
|
@@ -48,8 +49,6 @@ from classiq.interface.helpers.hashable_pydantic_base_model import (
|
|
48
49
|
HashablePydanticBaseModel,
|
49
50
|
)
|
50
51
|
|
51
|
-
from classiq.exceptions import ClassiqControlError, ClassiqValueError
|
52
|
-
|
53
52
|
DEFAULT_SUFFIX_LEN: int = 6
|
54
53
|
BAD_INPUT_ERROR_MSG = "Bad input name given"
|
55
54
|
BAD_OUTPUT_ERROR_MSG = "Bad output name given"
|
@@ -6,6 +6,10 @@ from typing import Dict, List, Optional, Tuple, Union
|
|
6
6
|
import pydantic
|
7
7
|
from typing_extensions import TypeAlias
|
8
8
|
|
9
|
+
from classiq.interface.exceptions import (
|
10
|
+
ClassiqMissingOutputFormatError,
|
11
|
+
ClassiqStateInitializationError,
|
12
|
+
)
|
9
13
|
from classiq.interface.executor import quantum_code
|
10
14
|
from classiq.interface.executor.quantum_instruction_set import QuantumInstructionSet
|
11
15
|
from classiq.interface.executor.register_initialization import RegisterInitialization
|
@@ -28,11 +32,6 @@ from classiq.interface.generator.synthesis_metadata.synthesis_duration import (
|
|
28
32
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
29
33
|
from classiq.interface.ide.ide_data import CircuitMetrics
|
30
34
|
|
31
|
-
from classiq.exceptions import (
|
32
|
-
ClassiqMissingOutputFormatError,
|
33
|
-
ClassiqStateInitializationError,
|
34
|
-
)
|
35
|
-
|
36
35
|
RegisterName: TypeAlias = str
|
37
36
|
InitialConditions: TypeAlias = Dict[RegisterName, int]
|
38
37
|
|
@@ -4,7 +4,7 @@ from typing import Any, Dict, Generic, Optional, TypeVar
|
|
4
4
|
import pydantic
|
5
5
|
from pydantic.generics import GenericModel
|
6
6
|
|
7
|
-
from classiq.exceptions import ClassiqValueError
|
7
|
+
from classiq.interface.exceptions import ClassiqValueError
|
8
8
|
|
9
9
|
RangeType = TypeVar("RangeType", int, float)
|
10
10
|
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import re
|
2
2
|
from typing import Match, Optional, Tuple
|
3
3
|
|
4
|
+
from classiq.interface.exceptions import ClassiqValueError
|
4
5
|
from classiq.interface.generator.function_params import NAME_REGEX
|
5
6
|
|
6
|
-
from classiq.exceptions import ClassiqValueError
|
7
|
-
|
8
7
|
NAME = "name"
|
9
8
|
SLICING = "slicing"
|
10
9
|
SEPARATOR = ":"
|
@@ -2,6 +2,7 @@ from typing import Any, Dict, Literal, Optional, Union
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.arith.register_user_input import RegisterUserInput
|
6
7
|
from classiq.interface.generator.control_state import ControlState
|
7
8
|
from classiq.interface.generator.standard_gates.standard_gates import (
|
@@ -9,8 +10,6 @@ from classiq.interface.generator.standard_gates.standard_gates import (
|
|
9
10
|
_StandardGate,
|
10
11
|
)
|
11
12
|
|
12
|
-
from classiq.exceptions import ClassiqValueError
|
13
|
-
|
14
13
|
CONTROLLED_GATE_CONTROL: str = "CTRL"
|
15
14
|
CONTROLLED_GATE_TARGET: str = DEFAULT_STANDARD_GATE_ARG_NAME
|
16
15
|
DEFAULT_NUM_CTRL_QUBITS: int = 1
|
@@ -1,12 +1,11 @@
|
|
1
1
|
from typing import FrozenSet
|
2
2
|
|
3
|
+
from classiq.interface.enum_utils import StrEnum
|
4
|
+
from classiq.interface.exceptions import ClassiqValueError
|
3
5
|
from classiq.interface.generator.preferences.optimization import (
|
4
6
|
StatePrepOptimizationMethod,
|
5
7
|
)
|
6
8
|
|
7
|
-
from classiq._internals.enum_utils import StrEnum
|
8
|
-
from classiq.exceptions import ClassiqValueError
|
9
|
-
|
10
9
|
_AMPLITUDE_SUPPORTING_METRICS: FrozenSet = frozenset(
|
11
10
|
{"L2", "L1", "MAX_PROBABILITY", "TOTAL_VARIATION"}
|
12
11
|
)
|
@@ -3,6 +3,7 @@ from typing import Any, Dict, Optional, Union
|
|
3
3
|
import numpy as np
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
7
|
from classiq.interface.generator.range_types import NonNegativeFloatRange
|
7
8
|
from classiq.interface.generator.state_preparation.distributions import (
|
8
9
|
PMF,
|
@@ -21,8 +22,6 @@ from classiq.interface.generator.validations.validator_functions import (
|
|
21
22
|
validate_amplitudes,
|
22
23
|
)
|
23
24
|
|
24
|
-
from classiq.exceptions import ClassiqValueError
|
25
|
-
|
26
25
|
|
27
26
|
class StatePreparation(StatePreparationABC):
|
28
27
|
amplitudes: Optional[Amplitudes] = pydantic.Field(
|
@@ -1,3 +1,5 @@
|
|
1
|
+
from enum import IntEnum
|
2
|
+
|
1
3
|
from classiq.interface.chemistry.elements import ELEMENTS
|
2
4
|
from classiq.interface.chemistry.ground_state_problem import FermionMapping
|
3
5
|
from classiq.interface.generator.types.enum_declaration import EnumDeclaration
|
@@ -14,56 +16,47 @@ FERMION_MAPPING = EnumDeclaration(
|
|
14
16
|
},
|
15
17
|
)
|
16
18
|
|
17
|
-
FINANCE_FUNCTION_TYPE = EnumDeclaration(
|
18
|
-
name="FinanceFunctionType",
|
19
|
-
members={
|
20
|
-
"VAR": 0,
|
21
|
-
"SHORTFALL": 1,
|
22
|
-
"X_SQUARE": 2,
|
23
|
-
"EUROPEAN_CALL_OPTION": 3,
|
24
|
-
},
|
25
|
-
)
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
},
|
33
|
-
)
|
20
|
+
class FinanceFunctionType(IntEnum):
|
21
|
+
VAR = 0
|
22
|
+
SHORTFALL = 1
|
23
|
+
X_SQUARE = 2
|
24
|
+
EUROPEAN_CALL_OPTION = 3
|
34
25
|
|
35
|
-
OPTIMIZER = EnumDeclaration(
|
36
|
-
name="Optimizer",
|
37
|
-
members={
|
38
|
-
"COBYLA": 1,
|
39
|
-
"SPSA": 2,
|
40
|
-
"L_BFGS_B": 3,
|
41
|
-
"NELDER_MEAD": 4,
|
42
|
-
"ADAM": 5,
|
43
|
-
},
|
44
|
-
)
|
45
26
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
27
|
+
class LadderOperator(IntEnum):
|
28
|
+
PLUS = 0
|
29
|
+
MINUS = 1
|
30
|
+
|
31
|
+
|
32
|
+
class Optimizer(IntEnum):
|
33
|
+
COBYLA = 1
|
34
|
+
SPSA = 2
|
35
|
+
L_BFGS_B = 3
|
36
|
+
NELDER_MEAD = 4
|
37
|
+
ADAM = 5
|
38
|
+
|
39
|
+
|
40
|
+
class Pauli(IntEnum):
|
41
|
+
I = 0 # noqa: E741
|
42
|
+
X = 1
|
43
|
+
Y = 2
|
44
|
+
Z = 3
|
45
|
+
|
46
|
+
|
47
|
+
class QSVMFeatureMapEntanglement(IntEnum):
|
48
|
+
FULL = 0
|
49
|
+
LINEAR = 1
|
50
|
+
CIRCULAR = 2
|
51
|
+
SCA = 3
|
52
|
+
PAIRWISE = 4
|
55
53
|
|
56
|
-
QSVM_FEATURE_MAP_ENTANGLEMENT = EnumDeclaration(
|
57
|
-
name="QSVMFeatureMapEntanglement",
|
58
|
-
members={
|
59
|
-
"FULL": 0,
|
60
|
-
"LINEAR": 1,
|
61
|
-
"CIRCULAR": 2,
|
62
|
-
"SCA": 3,
|
63
|
-
"PAIRWISE": 4,
|
64
|
-
},
|
65
|
-
)
|
66
54
|
|
67
55
|
for enum_decl in list(vars().values()):
|
68
56
|
if isinstance(enum_decl, EnumDeclaration):
|
69
57
|
EnumDeclaration.BUILTIN_ENUM_DECLARATIONS[enum_decl.name] = enum_decl
|
58
|
+
elif isinstance(enum_decl, type) and issubclass(enum_decl, IntEnum):
|
59
|
+
EnumDeclaration.BUILTIN_ENUM_DECLARATIONS[enum_decl.__name__] = EnumDeclaration(
|
60
|
+
name=enum_decl.__name__,
|
61
|
+
members={enum_val.name: enum_val.value for enum_val in enum_decl},
|
62
|
+
)
|
@@ -5,8 +5,7 @@ from typing import ClassVar, Dict
|
|
5
5
|
import pydantic
|
6
6
|
|
7
7
|
from classiq.interface.ast_node import HashableASTNode
|
8
|
-
|
9
|
-
from classiq.exceptions import ClassiqValueError
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
10
9
|
|
11
10
|
|
12
11
|
class EnumDeclaration(HashableASTNode):
|
@@ -3,10 +3,9 @@ from typing import Any, ClassVar, Dict, Mapping
|
|
3
3
|
import pydantic
|
4
4
|
|
5
5
|
from classiq.interface.ast_node import HashableASTNode
|
6
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
7
|
from classiq.interface.generator.functions.concrete_types import ConcreteClassicalType
|
7
8
|
|
8
|
-
from classiq.exceptions import ClassiqValueError
|
9
|
-
|
10
9
|
|
11
10
|
class StructDeclaration(HashableASTNode):
|
12
11
|
name: str
|
@@ -2,6 +2,7 @@ from typing import Iterable, Optional
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.chemistry_function_params import (
|
6
7
|
ChemistryFunctionParams,
|
7
8
|
)
|
@@ -10,8 +11,6 @@ from classiq.interface.generator.excitations import (
|
|
10
11
|
EXCITATIONS_TYPE_EXACT,
|
11
12
|
)
|
12
13
|
|
13
|
-
from classiq.exceptions import ClassiqValueError
|
14
|
-
|
15
14
|
_EXCITATIONS_DICT = {"s": 1, "d": 2, "t": 3, "q": 4}
|
16
15
|
|
17
16
|
DEFAULT_EXCITATIONS = [1, 2]
|
@@ -3,11 +3,10 @@ from typing import List, Union
|
|
3
3
|
import numpy as np
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
7
|
from classiq.interface.generator import complex_type, function_params
|
7
8
|
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
8
9
|
|
9
|
-
from classiq.exceptions import ClassiqValueError
|
10
|
-
|
11
10
|
DataNumber = Union[complex_type.Complex, float, int]
|
12
11
|
DataArray = List[List[DataNumber]]
|
13
12
|
|
@@ -5,14 +5,13 @@ from typing import Collection, Iterable, List, Mapping, Optional, TypeVar
|
|
5
5
|
|
6
6
|
import networkx as nx
|
7
7
|
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
8
9
|
from classiq.interface.generator.quantum_function_call import (
|
9
10
|
SynthesisQuantumFunctionCall,
|
10
11
|
WireName,
|
11
12
|
)
|
12
13
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonEmptyString
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
IO_MULTI_USE_ERROR_MSG = "Input and output names can only be used once"
|
17
16
|
UNCONNECTED_WIRES_ERROR_MSG = "Wires connected only on one end"
|
18
17
|
UNCONNECTED_FLOW_IO_ERROR_MSG = "Flow IOs not connected to inner calls"
|
@@ -2,10 +2,9 @@ from typing import Iterable, List, Sequence, Sized, Tuple, TypeVar
|
|
2
2
|
|
3
3
|
import numpy as np
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.helpers.custom_pydantic_types import PydanticProbabilityFloat
|
6
7
|
|
7
|
-
from classiq.exceptions import ClassiqValueError
|
8
|
-
|
9
8
|
NOT_SUM_TO_ONE_ERROR = "Probabilities do not sum to 1"
|
10
9
|
|
11
10
|
SUM_TO_ONE_SENSITIVITY = 8
|
classiq/interface/hardware.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
from typing import Hashable, List, Mapping
|
2
2
|
|
3
|
+
from classiq.interface.exceptions import ClassiqValueError
|
3
4
|
from classiq.interface.helpers.pydantic_model_helpers import Nameable
|
4
5
|
|
5
|
-
from classiq.exceptions import ClassiqValueError
|
6
|
-
|
7
6
|
|
8
7
|
def is_list_unique(lst: List[Hashable]) -> bool:
|
9
8
|
return len(set(lst)) == len(lst)
|
@@ -2,11 +2,10 @@ from typing import Dict, List, Optional, Tuple
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.enum_utils import StrEnum
|
5
6
|
from classiq.interface.generator.hardware.hardware_data import SynthesisHardwareData
|
6
7
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
7
8
|
|
8
|
-
from classiq._internals.enum_utils import StrEnum
|
9
|
-
|
10
9
|
|
11
10
|
class OperationLevel(StrEnum):
|
12
11
|
QMOD_FUNCTION_CALL = "QMOD_CALL"
|
classiq/interface/jobs.py
CHANGED
@@ -4,11 +4,10 @@ import pydantic
|
|
4
4
|
from pydantic import BaseModel
|
5
5
|
from pydantic.generics import GenericModel
|
6
6
|
|
7
|
+
from classiq.interface.enum_utils import StrEnum
|
8
|
+
from classiq.interface.exceptions import ClassiqAPIError
|
7
9
|
from classiq.interface.helpers.custom_encoders import CUSTOM_ENCODERS
|
8
10
|
|
9
|
-
from classiq._internals.enum_utils import StrEnum
|
10
|
-
from classiq.exceptions import ClassiqAPIError
|
11
|
-
|
12
11
|
JSONObject = Dict[str, Any]
|
13
12
|
T = TypeVar("T", bound=Union[pydantic.BaseModel, JSONObject])
|
14
13
|
AUTH_HEADER = "Classiq-BE-Auth"
|
@@ -2,11 +2,10 @@ from typing import List, Literal, Mapping, Sequence
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.model.handle_binding import ConcreteHandleBinding, HandleBinding
|
6
7
|
from classiq.interface.model.quantum_statement import HandleMetadata, QuantumOperation
|
7
8
|
|
8
|
-
from classiq.exceptions import ClassiqValueError
|
9
|
-
|
10
9
|
BIND_INPUT_NAME = "bind_input"
|
11
10
|
BIND_OUTPUT_NAME = "bind_output"
|
12
11
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from typing import Literal, Mapping, Sequence
|
2
2
|
|
3
|
+
from classiq.interface.enum_utils import StrEnum
|
3
4
|
from classiq.interface.generator.functions.builtins.core_library import (
|
4
5
|
INTEGER_XOR_FUNCTION,
|
5
6
|
MODULAR_ADD_FUNCTION,
|
@@ -11,8 +12,6 @@ from classiq.interface.model.quantum_function_declaration import (
|
|
11
12
|
)
|
12
13
|
from classiq.interface.model.quantum_statement import HandleMetadata, QuantumOperation
|
13
14
|
|
14
|
-
from classiq._internals.enum_utils import StrEnum
|
15
|
-
|
16
15
|
|
17
16
|
class BinaryOperation(StrEnum):
|
18
17
|
Addition = "inplace_add"
|
classiq/interface/model/model.py
CHANGED
@@ -5,6 +5,7 @@ import pydantic
|
|
5
5
|
|
6
6
|
from classiq.interface.ast_node import ASTNode
|
7
7
|
from classiq.interface.debug_info.debug_info import DebugInfoCollection
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
8
9
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
9
10
|
from classiq.interface.generator.constant import Constant
|
10
11
|
from classiq.interface.generator.functions.port_declaration import (
|
@@ -26,8 +27,6 @@ from classiq.interface.model.quantum_function_declaration import (
|
|
26
27
|
)
|
27
28
|
from classiq.interface.model.statement_block import StatementBlock
|
28
29
|
|
29
|
-
from classiq.exceptions import ClassiqValueError
|
30
|
-
|
31
30
|
USER_MODEL_MARKER = "user"
|
32
31
|
|
33
32
|
MAIN_FUNCTION_NAME = "main"
|
@@ -2,6 +2,7 @@ from typing import Any, Dict, Literal, Mapping, Optional
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.expressions.expression import Expression
|
6
7
|
from classiq.interface.generator.functions.concrete_types import ConcreteQuantumType
|
7
8
|
from classiq.interface.generator.functions.port_declaration import (
|
@@ -13,8 +14,6 @@ from classiq.interface.model.quantum_variable_declaration import (
|
|
13
14
|
QuantumVariableDeclaration,
|
14
15
|
)
|
15
16
|
|
16
|
-
from classiq.exceptions import ClassiqValueError
|
17
|
-
|
18
17
|
|
19
18
|
class AnonPortDeclaration(Parameter):
|
20
19
|
kind: Literal["PortDeclaration"]
|
@@ -2,6 +2,7 @@ from typing import Dict, Literal, Mapping, Sequence
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.amplitude_loading import (
|
6
7
|
AMPLITUDE_IO_NAME,
|
7
8
|
TARGET_OUTPUT_NAME,
|
@@ -16,8 +17,6 @@ from classiq.interface.model.quantum_expressions.quantum_expression import (
|
|
16
17
|
from classiq.interface.model.quantum_statement import HandleMetadata
|
17
18
|
from classiq.interface.model.quantum_type import QuantumBit, QuantumNumeric, QuantumType
|
18
19
|
|
19
|
-
from classiq.exceptions import ClassiqValueError
|
20
|
-
|
21
20
|
MULTI_VARS_UNSUPPORTED_ERROR = (
|
22
21
|
"Amplitude Loading with more than one input variable is unsupported."
|
23
22
|
)
|
@@ -14,6 +14,7 @@ from uuid import UUID, uuid4
|
|
14
14
|
import pydantic
|
15
15
|
|
16
16
|
from classiq.interface.ast_node import ASTNode
|
17
|
+
from classiq.interface.exceptions import ClassiqError, ClassiqValueError
|
17
18
|
from classiq.interface.generator.expressions.expression import Expression
|
18
19
|
from classiq.interface.generator.functions.port_declaration import (
|
19
20
|
PortDeclarationDirection,
|
@@ -29,8 +30,6 @@ from classiq.interface.model.quantum_function_declaration import (
|
|
29
30
|
from classiq.interface.model.quantum_lambda_function import QuantumOperand
|
30
31
|
from classiq.interface.model.quantum_statement import HandleMetadata, QuantumOperation
|
31
32
|
|
32
|
-
from classiq.exceptions import ClassiqError, ClassiqValueError
|
33
|
-
|
34
33
|
ArgValue = Union[
|
35
34
|
Expression,
|
36
35
|
QuantumOperand,
|
@@ -3,12 +3,11 @@ from typing import TYPE_CHECKING, Dict, List, Optional, Union, cast
|
|
3
3
|
import pydantic
|
4
4
|
|
5
5
|
from classiq.interface.ast_node import ASTNode
|
6
|
+
from classiq.interface.exceptions import ClassiqError
|
6
7
|
from classiq.interface.model.quantum_function_declaration import (
|
7
8
|
AnonQuantumOperandDeclaration,
|
8
9
|
)
|
9
10
|
|
10
|
-
from classiq.exceptions import ClassiqError
|
11
|
-
|
12
11
|
if TYPE_CHECKING:
|
13
12
|
from classiq.interface.model.statement_block import StatementBlock
|
14
13
|
|
@@ -4,6 +4,7 @@ import pydantic
|
|
4
4
|
from pydantic import BaseModel, Extra, Field
|
5
5
|
|
6
6
|
from classiq.interface.ast_node import HashableASTNode
|
7
|
+
from classiq.interface.exceptions import ClassiqValueError
|
7
8
|
from classiq.interface.generator.arith.register_user_input import (
|
8
9
|
RegisterArithmeticInfo,
|
9
10
|
RegisterUserInput,
|
@@ -19,13 +20,9 @@ from classiq.interface.generator.expressions.qmod_sized_proxy import QmodSizedPr
|
|
19
20
|
from classiq.interface.helpers.pydantic_model_helpers import values_with_discriminator
|
20
21
|
from classiq.interface.model.handle_binding import HandleBinding
|
21
22
|
|
22
|
-
from classiq.exceptions import ClassiqValueError
|
23
|
-
|
24
23
|
if TYPE_CHECKING:
|
25
24
|
from classiq.interface.generator.functions.concrete_types import ConcreteQuantumType
|
26
25
|
|
27
|
-
from classiq.qmod.qmod_variable import QArray, QBit, QNum, QVar
|
28
|
-
|
29
26
|
|
30
27
|
class QuantumType(HashableASTNode):
|
31
28
|
class Config:
|
@@ -62,9 +59,6 @@ class QuantumType(HashableASTNode):
|
|
62
59
|
def type_name(self) -> str:
|
63
60
|
raise NotImplementedError
|
64
61
|
|
65
|
-
def to_qvar(self, origin: HandleBinding) -> "QVar":
|
66
|
-
raise NotImplementedError
|
67
|
-
|
68
62
|
|
69
63
|
class QuantumScalar(QuantumType):
|
70
64
|
def get_proxy(self, handle: "HandleBinding") -> QmodQScalarProxy:
|
@@ -93,11 +87,6 @@ class QuantumBit(QuantumScalar):
|
|
93
87
|
def type_name(self) -> str:
|
94
88
|
return "Quantum bit"
|
95
89
|
|
96
|
-
def to_qvar(self, origin: HandleBinding) -> "QBit":
|
97
|
-
from classiq.qmod.qmod_variable import QBit
|
98
|
-
|
99
|
-
return QBit(origin)
|
100
|
-
|
101
90
|
|
102
91
|
class QuantumBitvector(QuantumType):
|
103
92
|
kind: Literal["qvec"]
|
@@ -151,11 +140,6 @@ class QuantumBitvector(QuantumType):
|
|
151
140
|
def type_name(self) -> str:
|
152
141
|
return "Quantum array"
|
153
142
|
|
154
|
-
def to_qvar(self, origin: HandleBinding) -> "QArray":
|
155
|
-
from classiq.qmod.qmod_variable import QArray
|
156
|
-
|
157
|
-
return QArray(origin, element_type=self.element_type, length=self.length)
|
158
|
-
|
159
143
|
|
160
144
|
class QuantumNumeric(QuantumScalar):
|
161
145
|
kind: Literal["qnum"]
|
@@ -222,11 +206,6 @@ class QuantumNumeric(QuantumScalar):
|
|
222
206
|
def type_name(self) -> str:
|
223
207
|
return "Quantum numeric"
|
224
208
|
|
225
|
-
def to_qvar(self, origin: HandleBinding) -> "QNum":
|
226
|
-
from classiq.qmod.qmod_variable import QNum
|
227
|
-
|
228
|
-
return QNum(origin, self.size, self.is_signed, self.fraction_digits)
|
229
|
-
|
230
209
|
|
231
210
|
class RegisterQuantumType(BaseModel):
|
232
211
|
quantum_types: "ConcreteQuantumType"
|
@@ -2,10 +2,9 @@ import dataclasses
|
|
2
2
|
from enum import Enum
|
3
3
|
from typing import List, Mapping, Optional, Set
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqError
|
5
6
|
from classiq.interface.model.handle_binding import HandleBinding
|
6
7
|
|
7
|
-
from classiq.exceptions import ClassiqError
|
8
|
-
|
9
8
|
|
10
9
|
class HandleState(Enum):
|
11
10
|
INITIALIZED = 0
|
@@ -6,8 +6,8 @@ from pydantic import BaseModel
|
|
6
6
|
|
7
7
|
|
8
8
|
class DeprecationInfo(BaseModel):
|
9
|
-
deprecation_date: Union[
|
10
|
-
removal_date: Union[
|
9
|
+
deprecation_date: Union[datetime, date] = pydantic.Field()
|
10
|
+
removal_date: Union[datetime, date] = pydantic.Field()
|
11
11
|
|
12
12
|
|
13
13
|
class GlobalVersions(BaseModel):
|
@@ -1,5 +1,6 @@
|
|
1
1
|
from typing import Dict, Final, List, Optional, Union
|
2
2
|
|
3
|
+
from classiq.interface.exceptions import ClassiqError
|
3
4
|
from classiq.interface.executor.execution_preferences import QaeWithQpeEstimationMethod
|
4
5
|
from classiq.interface.executor.iqae_result import IQAEResult
|
5
6
|
from classiq.interface.executor.result import (
|
@@ -12,7 +13,6 @@ from classiq.interface.executor.vqe_result import VQESolverResult
|
|
12
13
|
from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
|
13
14
|
|
14
15
|
from classiq.applications.qsvm.qsvm import Data, Labels
|
15
|
-
from classiq.exceptions import ClassiqError
|
16
16
|
from classiq.qmod.builtins.enums import Optimizer
|
17
17
|
|
18
18
|
ExecutionParams = Dict[str, Union[float, int, List[int], List[float]]]
|