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
@@ -5,10 +5,9 @@ from typing import Any, Dict
|
|
5
5
|
import pydantic
|
6
6
|
from pydantic import BaseModel
|
7
7
|
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
8
9
|
from classiq.interface.generator.arith.register_user_input import RegisterUserInput
|
9
10
|
|
10
|
-
from classiq.exceptions import ClassiqValueError
|
11
|
-
|
12
11
|
_DEFAULT_CONTROL_NAME: str = "ctrl"
|
13
12
|
_DEFAULT_NUM_CONTROL_QUBITS = 1
|
14
13
|
_INVALID_CONTROL_STATE = "invalid_control_state"
|
@@ -2,6 +2,7 @@ from typing import Dict, Type
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.enum_utils import StrEnum
|
5
6
|
from classiq.interface.generator.ansatz_library import (
|
6
7
|
EntanglingLayersArgs,
|
7
8
|
HypercubeArgs,
|
@@ -11,8 +12,6 @@ from classiq.interface.generator.ansatz_library import (
|
|
11
12
|
TwoLocalArgs,
|
12
13
|
)
|
13
14
|
|
14
|
-
from classiq._internals.enum_utils import StrEnum
|
15
|
-
|
16
15
|
|
17
16
|
class CustomAnsatzType(StrEnum):
|
18
17
|
TwoLocal = "TwoLocal"
|
@@ -1,12 +1,11 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Dict
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
from classiq.interface.generator.types.builtin_enum_declarations import (
|
4
|
+
FinanceFunctionType,
|
5
|
+
)
|
5
6
|
|
6
7
|
|
7
8
|
def get_finance_function_dict() -> Dict[str, "FinanceFunctionType"]:
|
8
|
-
from classiq.qmod.builtins.enums import FinanceFunctionType
|
9
|
-
|
10
9
|
return {
|
11
10
|
"var": FinanceFunctionType.VAR,
|
12
11
|
"expected shortfall": FinanceFunctionType.SHORTFALL,
|
@@ -6,6 +6,7 @@ from sympy import Expr
|
|
6
6
|
from typing_extensions import get_args
|
7
7
|
|
8
8
|
from classiq.interface.backend.pydantic_backend import EXECUTION_PARAMETER_PATTERN
|
9
|
+
from classiq.interface.exceptions import ClassiqValueError
|
9
10
|
from classiq.interface.generator.expressions.expression_types import (
|
10
11
|
ExpressionValue,
|
11
12
|
QmodStructInstance,
|
@@ -13,8 +14,6 @@ from classiq.interface.generator.expressions.expression_types import (
|
|
13
14
|
)
|
14
15
|
from classiq.interface.generator.expressions.handle_identifier import HandleIdentifier
|
15
16
|
|
16
|
-
from classiq.exceptions import ClassiqValueError
|
17
|
-
|
18
17
|
|
19
18
|
@dataclass(frozen=True)
|
20
19
|
class EvaluatedExpression:
|
@@ -6,6 +6,7 @@ import pydantic
|
|
6
6
|
from pydantic import PrivateAttr
|
7
7
|
|
8
8
|
from classiq.interface.ast_node import HashableASTNode
|
9
|
+
from classiq.interface.exceptions import ClassiqError
|
9
10
|
from classiq.interface.generator.arith.arithmetic_expression_validator import (
|
10
11
|
DEFAULT_SUPPORTED_FUNC_NAMES,
|
11
12
|
)
|
@@ -20,8 +21,6 @@ from classiq.interface.generator.expressions.sympy_supported_expressions import
|
|
20
21
|
)
|
21
22
|
from classiq.interface.generator.function_params import validate_expression_str
|
22
23
|
|
23
|
-
from classiq.exceptions import ClassiqError
|
24
|
-
|
25
24
|
|
26
25
|
class Expression(HashableASTNode):
|
27
26
|
expr: str
|
@@ -2,6 +2,7 @@ from typing import TYPE_CHECKING, Any, Mapping, Union
|
|
2
2
|
|
3
3
|
from sympy import Integer
|
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.expressions.non_symbolic_expr import NonSymbolicExpr
|
7
8
|
from classiq.interface.generator.expressions.qmod_sized_proxy import QmodSizedProxy
|
@@ -11,8 +12,6 @@ from classiq.interface.model.handle_binding import (
|
|
11
12
|
SubscriptHandleBinding,
|
12
13
|
)
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
if TYPE_CHECKING:
|
17
16
|
from classiq.interface.model.quantum_type import QuantumType
|
18
17
|
|
@@ -94,9 +93,7 @@ class QmodQArrayProxy(NonSymbolicExpr, QmodSizedProxy):
|
|
94
93
|
|
95
94
|
@property
|
96
95
|
def fields(self) -> Mapping[str, Any]:
|
97
|
-
return {
|
98
|
-
"len": self.len,
|
99
|
-
}
|
96
|
+
return {**super().fields, "len": self.len}
|
100
97
|
|
101
98
|
@property
|
102
99
|
def size(self) -> int:
|
@@ -2,11 +2,10 @@ from typing import Any, Mapping
|
|
2
2
|
|
3
3
|
from sympy import Symbol
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.expressions.qmod_sized_proxy import QmodSizedProxy
|
6
7
|
from classiq.interface.model.handle_binding import HandleBinding
|
7
8
|
|
8
|
-
from classiq.exceptions import ClassiqValueError
|
9
|
-
|
10
9
|
|
11
10
|
class QmodQScalarProxy(Symbol, QmodSizedProxy):
|
12
11
|
def __new__(cls, handle: HandleBinding, **assumptions: bool) -> "QmodQScalarProxy":
|
@@ -42,10 +41,6 @@ class QmodQNumProxy(QmodQScalarProxy):
|
|
42
41
|
def type_name(self) -> str:
|
43
42
|
return "Quantum numeric"
|
44
43
|
|
45
|
-
@property
|
46
|
-
def size(self) -> int:
|
47
|
-
return self._size
|
48
|
-
|
49
44
|
@property
|
50
45
|
def fraction_digits(self) -> int:
|
51
46
|
return self._fraction_digits
|
@@ -57,7 +52,7 @@ class QmodQNumProxy(QmodQScalarProxy):
|
|
57
52
|
@property
|
58
53
|
def fields(self) -> Mapping[str, Any]:
|
59
54
|
return {
|
60
|
-
|
55
|
+
**super().fields,
|
61
56
|
"is_signed": self.is_signed,
|
62
57
|
"fraction_digits": self.fraction_digits,
|
63
58
|
}
|
@@ -19,6 +19,8 @@ import pydantic
|
|
19
19
|
import sympy
|
20
20
|
from pydantic.fields import ModelField
|
21
21
|
|
22
|
+
from classiq.interface.enum_utils import StrEnum
|
23
|
+
from classiq.interface.exceptions import ClassiqValueError
|
22
24
|
from classiq.interface.generator.arith.arithmetic_expression_validator import (
|
23
25
|
validate_expression,
|
24
26
|
)
|
@@ -28,9 +30,6 @@ from classiq.interface.helpers.hashable_pydantic_base_model import (
|
|
28
30
|
HashablePydanticBaseModel,
|
29
31
|
)
|
30
32
|
|
31
|
-
from classiq._internals.enum_utils import StrEnum
|
32
|
-
from classiq.exceptions import ClassiqValueError
|
33
|
-
|
34
33
|
FunctionParamsDiscriminator = str
|
35
34
|
|
36
35
|
IOName = PydanticNonEmptyString
|
@@ -22,12 +22,6 @@ class ClassicalType(HashableASTNode):
|
|
22
22
|
def as_symbolic(self, name: str) -> Union[NamedSymbol, List[NamedSymbol]]:
|
23
23
|
return Symbol(name)
|
24
24
|
|
25
|
-
@property
|
26
|
-
def qmod_type(self) -> type:
|
27
|
-
raise NotImplementedError(
|
28
|
-
f"{self.__class__.__name__!r} has no QMOD SDK equivalent"
|
29
|
-
)
|
30
|
-
|
31
25
|
class Config:
|
32
26
|
extra = Extra.forbid
|
33
27
|
|
@@ -45,12 +39,6 @@ class Integer(ClassicalType):
|
|
45
39
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
46
40
|
return values_with_discriminator(values, "kind", "int")
|
47
41
|
|
48
|
-
@property
|
49
|
-
def qmod_type(self) -> type:
|
50
|
-
from classiq.qmod.qmod_parameter import CInt
|
51
|
-
|
52
|
-
return CInt
|
53
|
-
|
54
42
|
|
55
43
|
class Real(ClassicalType):
|
56
44
|
kind: Literal["real"]
|
@@ -62,12 +50,6 @@ class Real(ClassicalType):
|
|
62
50
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
63
51
|
return values_with_discriminator(values, "kind", "real")
|
64
52
|
|
65
|
-
@property
|
66
|
-
def qmod_type(self) -> type:
|
67
|
-
from classiq.qmod.qmod_parameter import CReal
|
68
|
-
|
69
|
-
return CReal
|
70
|
-
|
71
53
|
|
72
54
|
class Bool(ClassicalType):
|
73
55
|
kind: Literal["bool"]
|
@@ -76,12 +58,6 @@ class Bool(ClassicalType):
|
|
76
58
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
77
59
|
return values_with_discriminator(values, "kind", "bool")
|
78
60
|
|
79
|
-
@property
|
80
|
-
def qmod_type(self) -> type:
|
81
|
-
from classiq.qmod.qmod_parameter import CBool
|
82
|
-
|
83
|
-
return CBool
|
84
|
-
|
85
61
|
|
86
62
|
class ClassicalList(ClassicalType):
|
87
63
|
kind: Literal["list"]
|
@@ -94,12 +70,6 @@ class ClassicalList(ClassicalType):
|
|
94
70
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
95
71
|
return values_with_discriminator(values, "kind", "list")
|
96
72
|
|
97
|
-
@property
|
98
|
-
def qmod_type(self) -> type:
|
99
|
-
from classiq.qmod.qmod_parameter import CArray
|
100
|
-
|
101
|
-
return CArray[self.element_type.qmod_type] # type:ignore[name-defined]
|
102
|
-
|
103
73
|
|
104
74
|
class StructMetaType(ClassicalType):
|
105
75
|
kind: Literal["type_proxy"]
|
@@ -121,14 +91,6 @@ class ClassicalArray(ClassicalType):
|
|
121
91
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
122
92
|
return values_with_discriminator(values, "kind", "array")
|
123
93
|
|
124
|
-
@property
|
125
|
-
def qmod_type(self) -> type:
|
126
|
-
from classiq.qmod.qmod_parameter import CArray
|
127
|
-
|
128
|
-
return CArray[
|
129
|
-
self.element_type.qmod_type, self.size # type:ignore[name-defined]
|
130
|
-
]
|
131
|
-
|
132
94
|
|
133
95
|
class OpaqueHandle(ClassicalType):
|
134
96
|
pass
|
@@ -1,9 +1,8 @@
|
|
1
1
|
from typing import Any
|
2
2
|
|
3
|
+
from classiq.interface.enum_utils import StrEnum
|
3
4
|
from classiq.interface.generator.function_params import PortDirection
|
4
5
|
|
5
|
-
from classiq._internals.enum_utils import StrEnum
|
6
|
-
|
7
6
|
|
8
7
|
class PortDeclarationDirection(StrEnum):
|
9
8
|
Input = "input"
|
@@ -7,7 +7,7 @@ from classiq.interface.generator.functions.classical_type import (
|
|
7
7
|
ClassicalType,
|
8
8
|
)
|
9
9
|
from classiq.interface.helpers.pydantic_model_helpers import values_with_discriminator
|
10
|
-
from classiq.interface.model.handle_binding import
|
10
|
+
from classiq.interface.model.handle_binding import HandleBinding
|
11
11
|
from classiq.interface.model.quantum_type import (
|
12
12
|
QuantumType,
|
13
13
|
)
|
@@ -15,8 +15,6 @@ from classiq.interface.model.quantum_type import (
|
|
15
15
|
if TYPE_CHECKING:
|
16
16
|
from classiq.interface.generator.functions.concrete_types import ConcreteQuantumType
|
17
17
|
|
18
|
-
from classiq.qmod.qmod_variable import QStruct
|
19
|
-
|
20
18
|
|
21
19
|
class TypeName(ClassicalType, QuantumType): # type:ignore[misc]
|
22
20
|
kind: Literal["struct_instance"]
|
@@ -29,10 +27,6 @@ class TypeName(ClassicalType, QuantumType): # type:ignore[misc]
|
|
29
27
|
def _set_kind(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
30
28
|
return values_with_discriminator(values, "kind", "struct_instance")
|
31
29
|
|
32
|
-
@property
|
33
|
-
def qmod_type(self) -> type:
|
34
|
-
return type(self.name, (TypeName,), dict())
|
35
|
-
|
36
30
|
def _update_size_in_bits_from_declaration(self) -> None:
|
37
31
|
fields_types = list(self.fields.values())
|
38
32
|
for field_type in fields_types:
|
@@ -59,20 +53,6 @@ class TypeName(ClassicalType, QuantumType): # type:ignore[misc]
|
|
59
53
|
def type_name(self) -> str:
|
60
54
|
return self.name
|
61
55
|
|
62
|
-
def to_qvar(self, origin: HandleBinding) -> "QStruct":
|
63
|
-
from classiq.qmod.qmod_variable import QStruct
|
64
|
-
|
65
|
-
return QStruct(
|
66
|
-
origin,
|
67
|
-
self.name,
|
68
|
-
{
|
69
|
-
field_name: field_type.to_qvar(
|
70
|
-
FieldHandleBinding(base_handle=origin, field=field_name)
|
71
|
-
)
|
72
|
-
for field_name, field_type in self.fields.items()
|
73
|
-
},
|
74
|
-
)
|
75
|
-
|
76
56
|
@property
|
77
57
|
def fields(self) -> Mapping[str, "ConcreteQuantumType"]:
|
78
58
|
from classiq.qmod.model_state_container import QMODULE
|
@@ -97,8 +77,4 @@ class Enum(TypeName):
|
|
97
77
|
|
98
78
|
|
99
79
|
class Struct(TypeName):
|
100
|
-
|
101
|
-
def qmod_type(self) -> type:
|
102
|
-
type_ = super().qmod_type
|
103
|
-
type_.__dataclass_fields__ = [] # type:ignore[attr-defined]
|
104
|
-
return type_
|
80
|
+
pass
|
@@ -2,6 +2,7 @@ from typing import Any, Dict, List, Set, Tuple, 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.function_params import (
|
7
8
|
ArithmeticIODict,
|
@@ -11,8 +12,6 @@ from classiq.interface.generator.function_params import (
|
|
11
12
|
from classiq.interface.generator.state_preparation import StatePreparation
|
12
13
|
from classiq.interface.generator.user_defined_function_params import CustomFunction
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
GroverStatePreparation = Union[StatePreparation, CustomFunction]
|
17
16
|
|
18
17
|
|
@@ -2,6 +2,7 @@ from typing import Any, Dict, Optional
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.function_params import (
|
6
7
|
FunctionParams,
|
7
8
|
FunctionParamsDiscriminator,
|
@@ -18,8 +19,6 @@ from classiq.interface.generator.oracles.oracle_function_param_list import (
|
|
18
19
|
from classiq.interface.generator.range_types import NonNegativeFloatRange
|
19
20
|
from classiq.interface.generator.state_preparation import Metrics, StatePreparation
|
20
21
|
|
21
|
-
from classiq.exceptions import ClassiqValueError
|
22
|
-
|
23
22
|
_DEFAULT_ORACLE_DISCRIMINATOR: FunctionParamsDiscriminator = (
|
24
23
|
ArithmeticOracle.discriminator()
|
25
24
|
)
|
@@ -4,12 +4,11 @@ import pydantic
|
|
4
4
|
|
5
5
|
from classiq.interface.chemistry import operator
|
6
6
|
from classiq.interface.chemistry.operator import PauliOperator
|
7
|
+
from classiq.interface.enum_utils import StrEnum
|
7
8
|
from classiq.interface.generator.hamiltonian_evolution.hamiltonian_evolution import (
|
8
9
|
HamiltonianEvolution,
|
9
10
|
)
|
10
11
|
|
11
|
-
from classiq._internals.enum_utils import StrEnum
|
12
|
-
|
13
12
|
|
14
13
|
class ExponentiationOptimization(StrEnum):
|
15
14
|
MINIMIZE_DEPTH = "MINIMIZE_DEPTH"
|
@@ -2,13 +2,12 @@ import pydantic
|
|
2
2
|
|
3
3
|
from classiq.interface.chemistry import operator
|
4
4
|
from classiq.interface.chemistry.operator import PauliOperator
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.hamiltonian_evolution.hamiltonian_evolution import (
|
6
7
|
HamiltonianEvolution,
|
7
8
|
)
|
8
9
|
from classiq.interface.generator.parameters import ParameterFloatType
|
9
10
|
|
10
|
-
from classiq.exceptions import ClassiqValueError
|
11
|
-
|
12
11
|
|
13
12
|
class SuzukiParameters(pydantic.BaseModel):
|
14
13
|
order: pydantic.PositiveInt = pydantic.Field(
|
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, MutableSet, Optional
|
|
5
5
|
import pydantic
|
6
6
|
|
7
7
|
from classiq.interface.backend.backend_preferences import BackendPreferences
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
8
9
|
from classiq.interface.generator.transpiler_basis_gates import (
|
9
10
|
DEFAULT_BASIS_GATES,
|
10
11
|
DEFAULT_ROUTING_BASIS_GATES,
|
@@ -14,8 +15,6 @@ from classiq.interface.generator.transpiler_basis_gates import (
|
|
14
15
|
)
|
15
16
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonNegIntTuple
|
16
17
|
|
17
|
-
from classiq.exceptions import ClassiqValueError
|
18
|
-
|
19
18
|
ConnectivityMap = List[PydanticNonNegIntTuple]
|
20
19
|
BACKEND_VALIDATION_ERROR_MESSAGE = (
|
21
20
|
"Backend service provider and backend name should be specified together."
|
@@ -3,6 +3,8 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.enum_utils import StrEnum
|
7
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
8
|
from classiq.interface.generator import function_params
|
7
9
|
from classiq.interface.generator.arith.register_user_input import RegisterUserInput
|
8
10
|
from classiq.interface.generator.function_params import (
|
@@ -15,9 +17,6 @@ from classiq.interface.generator.transpiler_basis_gates import (
|
|
15
17
|
)
|
16
18
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonNegIntTuple
|
17
19
|
|
18
|
-
from classiq._internals.enum_utils import StrEnum
|
19
|
-
from classiq.exceptions import ClassiqValueError
|
20
|
-
|
21
20
|
ConnectivityMap = List[PydanticNonNegIntTuple]
|
22
21
|
|
23
22
|
|
@@ -7,12 +7,11 @@ from classiq.interface.chemistry.ground_state_problem import (
|
|
7
7
|
HamiltonianProblem,
|
8
8
|
MoleculeProblem,
|
9
9
|
)
|
10
|
+
from classiq.interface.exceptions import ClassiqValueError
|
10
11
|
from classiq.interface.generator.chemistry_function_params import (
|
11
12
|
ChemistryFunctionParams,
|
12
13
|
)
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
|
17
16
|
class HartreeFock(ChemistryFunctionParams):
|
18
17
|
@pydantic.validator("gs_problem")
|
@@ -2,11 +2,10 @@ from typing import TYPE_CHECKING, Any, Dict, List
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator import function_params
|
6
7
|
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
7
8
|
|
8
|
-
from classiq.exceptions import ClassiqValueError
|
9
|
-
|
10
9
|
STATE = "state"
|
11
10
|
TARGET = "target"
|
12
11
|
|
@@ -2,13 +2,12 @@ from typing import Any, Dict, Optional, cast
|
|
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.function_params import FunctionParams
|
8
9
|
from classiq.interface.generator.parameters import ParameterFloatType
|
9
10
|
|
10
|
-
from classiq.exceptions import ClassiqValueError
|
11
|
-
|
12
11
|
CTRL = "CTRL"
|
13
12
|
TARGET = "TARGET"
|
14
13
|
|
@@ -2,12 +2,11 @@ from typing import Any, Dict, List, Optional
|
|
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.function_params import FunctionParams
|
8
9
|
|
9
|
-
from classiq.exceptions import ClassiqValueError
|
10
|
-
|
11
10
|
CTRL = "CTRL_IN"
|
12
11
|
TARGET_QUBIT = "TARGET_QUBIT"
|
13
12
|
|
@@ -4,11 +4,10 @@ from typing import Dict, Optional, Union
|
|
4
4
|
import pydantic
|
5
5
|
from pydantic import BaseModel, Extra
|
6
6
|
|
7
|
+
from classiq.interface.enum_utils import StrEnum
|
8
|
+
from classiq.interface.exceptions import ClassiqValueError
|
7
9
|
from classiq.interface.generator.transpiler_basis_gates import TranspilerBasisGates
|
8
10
|
|
9
|
-
from classiq._internals.enum_utils import StrEnum
|
10
|
-
from classiq.exceptions import ClassiqValueError
|
11
|
-
|
12
11
|
UNCONSTRAINED = -1
|
13
12
|
|
14
13
|
|
@@ -3,6 +3,7 @@ from typing import List
|
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
7
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
7
8
|
from classiq.interface.generator.constant import Constant
|
8
9
|
from classiq.interface.generator.function_params import ArithmeticIODict
|
@@ -13,8 +14,6 @@ from classiq.interface.helpers.validation_helpers import is_list_unique
|
|
13
14
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
14
15
|
from classiq.interface.model.quantum_type import RegisterQuantumTypeDict
|
15
16
|
|
16
|
-
from classiq.exceptions import ClassiqValueError
|
17
|
-
|
18
17
|
TYPE_LIBRARY_DUPLICATED_TYPE_NAMES = (
|
19
18
|
"Cannot have multiple struct types with the same name"
|
20
19
|
)
|
@@ -11,6 +11,8 @@ from classiq.interface.backend.quantum_backend_providers import (
|
|
11
11
|
AllBackendsNameByVendor,
|
12
12
|
ProviderVendor,
|
13
13
|
)
|
14
|
+
from classiq.interface.enum_utils import StrEnum
|
15
|
+
from classiq.interface.exceptions import ClassiqValueError
|
14
16
|
from classiq.interface.generator.arith.machine_precision import (
|
15
17
|
DEFAULT_MACHINE_PRECISION,
|
16
18
|
)
|
@@ -22,9 +24,6 @@ from classiq.interface.generator.model.preferences.randomness import create_rand
|
|
22
24
|
from classiq.interface.hardware import Provider
|
23
25
|
from classiq.interface.helpers.custom_pydantic_types import PydanticMachinePrecision
|
24
26
|
|
25
|
-
from classiq._internals.enum_utils import StrEnum
|
26
|
-
from classiq.exceptions import ClassiqValueError
|
27
|
-
|
28
27
|
if TYPE_CHECKING:
|
29
28
|
VisualizationLevel: TypeAlias = Optional[int]
|
30
29
|
else:
|
@@ -11,6 +11,7 @@ from typing import ( # type: ignore[attr-defined]
|
|
11
11
|
_GenericAlias,
|
12
12
|
)
|
13
13
|
|
14
|
+
from classiq.interface.exceptions import ClassiqQRegError
|
14
15
|
from classiq.interface.generator.arith.register_user_input import (
|
15
16
|
RegisterArithmeticInfo,
|
16
17
|
RegisterUserInput,
|
@@ -18,8 +19,6 @@ from classiq.interface.generator.arith.register_user_input import (
|
|
18
19
|
from classiq.interface.generator.function_params import ArithmeticIODict, IOName
|
19
20
|
from classiq.interface.generator.register_role import RegisterRole
|
20
21
|
|
21
|
-
from classiq.exceptions import ClassiqQRegError
|
22
|
-
|
23
22
|
if sys.version_info >= (3, 9):
|
24
23
|
from types import GenericAlias as TypesGenericAlias
|
25
24
|
|
@@ -4,6 +4,7 @@ from typing import Dict
|
|
4
4
|
|
5
5
|
import numexpr # type: ignore[import]
|
6
6
|
|
7
|
+
from classiq.interface.exceptions import ClassiqArithmeticError, ClassiqValueError
|
7
8
|
from classiq.interface.generator.arith import number_utils
|
8
9
|
from classiq.interface.generator.arith.arithmetic import Arithmetic
|
9
10
|
from classiq.interface.generator.arith.arithmetic_expression_abc import (
|
@@ -17,8 +18,6 @@ from classiq.interface.generator.oracles.oracle_abc import (
|
|
17
18
|
VariableTypedResultMap,
|
18
19
|
)
|
19
20
|
|
20
|
-
from classiq.exceptions import ClassiqArithmeticError, ClassiqValueError
|
21
|
-
|
22
21
|
|
23
22
|
class ArithmeticOracle(OracleABC[float], ArithmeticExpressionABC):
|
24
23
|
@staticmethod
|
@@ -2,6 +2,7 @@ from typing import Any, Dict
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.function_params import parse_function_params_values
|
6
7
|
from classiq.interface.generator.oracles.oracle_abc import (
|
7
8
|
ArithmeticIODict,
|
@@ -11,8 +12,6 @@ from classiq.interface.generator.oracles.oracle_abc import (
|
|
11
12
|
)
|
12
13
|
from classiq.interface.generator.user_defined_function_params import CustomFunction
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
QubitState = str
|
17
16
|
|
18
17
|
|
@@ -3,13 +3,12 @@ from typing import Dict, Generic, List, Optional, Sequence, TypeVar
|
|
3
3
|
|
4
4
|
import numpy as np
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqOracleError
|
6
7
|
from classiq.interface.executor.result import State
|
7
8
|
from classiq.interface.generator.arith.register_user_input import RegisterUserInput
|
8
9
|
from classiq.interface.generator.function_params import ArithmeticIODict, FunctionParams
|
9
10
|
from classiq.interface.generator.generated_circuit_data import IOQubitMapping
|
10
11
|
|
11
|
-
from classiq.exceptions import ClassiqOracleError
|
12
|
-
|
13
12
|
ProblemResultType = TypeVar("ProblemResultType")
|
14
13
|
|
15
14
|
VariableBinResultMap = Dict[str, State]
|
@@ -2,10 +2,9 @@ import itertools
|
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from typing import Iterator, List, Optional, Tuple
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.generator.slice_parsing_utils import parse_io_slicing
|
6
7
|
|
7
|
-
from classiq.exceptions import ClassiqValueError
|
8
|
-
|
9
8
|
|
10
9
|
@dataclass(frozen=True)
|
11
10
|
class PartitionedRegister:
|
@@ -3,14 +3,13 @@ from typing import Any, Dict, Generic, List, Sequence, Tuple, TypeVar
|
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqError
|
6
7
|
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
7
8
|
from classiq.interface.generator.function_params import FunctionParams
|
8
9
|
from classiq.interface.helpers.hashable_pydantic_base_model import (
|
9
10
|
HashablePydanticBaseModel,
|
10
11
|
)
|
11
12
|
|
12
|
-
from classiq.exceptions import ClassiqError
|
13
|
-
|
14
13
|
STATE_NAME: str = "state"
|
15
14
|
TARGET_NAME: str = "target"
|
16
15
|
_REL_TOLERANCE: float = 0.01
|