classiq 0.33.0__py3-none-any.whl → 0.34.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.
Files changed (35) hide show
  1. classiq/_internals/api_wrapper.py +9 -20
  2. classiq/_internals/jobs.py +9 -2
  3. classiq/executor.py +3 -10
  4. classiq/interface/_version.py +1 -1
  5. classiq/interface/backend/backend_preferences.py +17 -0
  6. classiq/interface/backend/pydantic_backend.py +8 -0
  7. classiq/interface/backend/quantum_backend_providers.py +13 -1
  8. classiq/interface/chemistry/ground_state_problem.py +1 -1
  9. classiq/interface/chemistry/operator.py +198 -0
  10. classiq/interface/executor/execution_request.py +2 -12
  11. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/atomic_quantum_functions.py +2 -2
  12. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +20 -110
  13. classiq/interface/generator/generated_circuit.py +8 -44
  14. classiq/interface/generator/generated_circuit_data.py +2 -11
  15. classiq/interface/generator/model/preferences/preferences.py +2 -2
  16. classiq/interface/generator/quantum_function_call.py +1 -1
  17. classiq/interface/hardware.py +1 -0
  18. classiq/interface/ide/show.py +1 -14
  19. classiq/interface/model/quantum_function_call.py +9 -339
  20. classiq/interface/model/quantum_statement.py +3 -2
  21. classiq/interface/server/routes.py +5 -6
  22. classiq/model/function_handler.pyi +88 -88
  23. classiq/qmod/declaration_inferrer.py +34 -17
  24. classiq/qmod/model_state_container.py +6 -3
  25. classiq/qmod/qmod_builtins.py +892 -4
  26. classiq/qmod/qmod_parameter.py +24 -8
  27. classiq/qmod/quantum_expandable.py +6 -2
  28. classiq/qmod/quantum_function.py +9 -9
  29. {classiq-0.33.0.dist-info → classiq-0.34.0.dist-info}/METADATA +1 -1
  30. {classiq-0.33.0.dist-info → classiq-0.34.0.dist-info}/RECORD +31 -35
  31. classiq/interface/model/clients/__init__.py +0 -0
  32. classiq/interface/model/clients/qmod/__init__.py +0 -0
  33. classiq/interface/model/clients/qmod/qmod_builtins.py +0 -905
  34. classiq/interface/model/semantics.py +0 -15
  35. {classiq-0.33.0.dist-info → classiq-0.34.0.dist-info}/WHEEL +0 -0
@@ -40,114 +40,114 @@ class FunctionHandler(abc.ABC, metaclass=abc.ABCMeta):
40
40
  def output_wires(self) -> WireNameDict: ...
41
41
  def create_inputs(self, inputs: Mapping[IOName, QRegGenericAlias]) -> Dict[IOName, QReg]: ...
42
42
  def set_outputs(self, outputs: Mapping[IOName, QReg]) -> None: ...
43
- def apply(self, function_name: Union[str, SynthesisQuantumFunctionDeclaration, QuantumFunction], in_wires: Optional[SupportedInputArgs] = ..., out_wires: Optional[SupportedInputArgs] = ..., is_inverse: bool = ..., strict_zero_ios: bool = ..., release_by_inverse: bool = ..., control_states: Optional[Union[ControlState, Iterable[ControlState]]] = ..., should_control: bool = ..., power: int = ..., call_name: Optional[str] = ..., parameters_dict: Optional[Dict[str, ParameterFloatType]] = ...) -> Dict[IOName, QReg]: ...
43
+ def apply(self, function_name: Union[str, SynthesisQuantumFunctionDeclaration, QuantumFunction], in_wires: Optional[SupportedInputArgs] = None, out_wires: Optional[SupportedInputArgs] = None, is_inverse: bool = False, strict_zero_ios: bool = True, release_by_inverse: bool = False, control_states: Optional[Union[ControlState, Iterable[ControlState]]] = None, should_control: bool = True, power: int = 1, call_name: Optional[str] = None, parameters_dict: Optional[Dict[str, ParameterFloatType]] = None) -> Dict[IOName, QReg]: ...
44
44
  def release_qregs(self, qregs: Union[QReg, Collection[QReg]]) -> None: ...
45
45
  def __getattr__(self, item: str) -> Callable[..., Any]: ...
46
46
  def __dir__(self) -> List[str]: ...
47
47
  def include_library(self, library: FunctionLibrary) -> None: ...
48
48
  @abc.abstractmethod
49
49
  def create_library(self) -> None: ...
50
- def YGate(self, params: YGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
51
- def FinanceModels(self, params: FinanceModels, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
52
- def Finance(self, params: Finance, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
53
- def QFT(self, params: QFT, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
54
- def GroverOperator(self, params: GroverOperator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
55
- def AmplitudeEstimation(self, params: AmplitudeEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
50
+ def HadamardTransform(self, params: HadamardTransform, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
51
+ def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
52
+ def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
53
+ def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
54
+ def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
55
+ def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
56
+ def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
57
+ def GreaterThan(self, params: GreaterThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
58
+ def GreaterEqual(self, params: GreaterEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
59
+ def LessThan(self, params: LessThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
60
+ def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
61
+ def CRZGate(self, params: CRZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
62
+ def CPhaseGate(self, params: CPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
63
+ def ExponentialStatePreparation(self, params: ExponentialStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
64
+ def HVA(self, params: HVA, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
65
+ def RZGate(self, params: RZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
66
+ def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
67
+ def Exponentiation(self, params: Exponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
68
+ def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
69
+ def QSVMFeatureMap(self, params: QSVMFeatureMap, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
70
+ def CyclicShift(self, params: CyclicShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
71
+ def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
72
+ def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
73
+ def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
56
74
  def UniformDistributionStatePreparation(self, params: UniformDistributionStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
57
- def TdgGate(self, params: TdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
58
- def RYYGate(self, params: RYYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
75
+ def XGate(self, params: XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
76
+ def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
77
+ def Negation(self, params: Negation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
78
+ def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
79
+ def Subtractor(self, params: Subtractor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
59
80
  def HartreeFock(self, params: HartreeFock, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
81
+ def Finance(self, params: Finance, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
82
+ def Identity(self, params: Identity, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
60
83
  def Mcu(self, params: Mcu, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
61
- def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
62
- def GridEntangler(self, params: GridEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
63
- def BitwiseInvert(self, params: BitwiseInvert, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
64
- def Equal(self, params: Equal, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
65
- def CustomFunction(self, params: CustomFunction, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
66
- def Negation(self, params: Negation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
67
- def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
68
- def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
69
- def CCXGate(self, params: CCXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
84
+ def HypercubeEntangler(self, params: HypercubeEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
85
+ def C3XGate(self, params: C3XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
86
+ def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
87
+ def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
88
+ def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
70
89
  def RandomizedBenchmarking(self, params: RandomizedBenchmarking, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
71
- def RZZGate(self, params: RZZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
72
- def CRXGate(self, params: CRXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
90
+ def PhaseEstimation(self, params: PhaseEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
91
+ def InequalityMixer(self, params: InequalityMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
92
+ def Sign(self, params: Sign, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
93
+ def CommutingPauliExponentiation(self, params: CommutingPauliExponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
94
+ def Equal(self, params: Equal, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
95
+ def AmplitudeLoading(self, params: AmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
96
+ def ComputationalBasisStatePreparation(self, params: ComputationalBasisStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
97
+ def GridEntangler(self, params: GridEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
98
+ def RXGate(self, params: RXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
99
+ def WStatePreparation(self, params: WStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
100
+ def Mcx(self, params: Mcx, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
101
+ def RYYGate(self, params: RYYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
102
+ def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
103
+ def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
104
+ def GroverOperator(self, params: GroverOperator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
105
+ def AmplitudeEstimation(self, params: AmplitudeEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
106
+ def PiecewiseLinearRotationAmplitudeLoading(self, params: PiecewiseLinearRotationAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
107
+ def QFT(self, params: QFT, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
108
+ def YGate(self, params: YGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
109
+ def TwoDimensionalEntangler(self, params: TwoDimensionalEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
73
110
  def ZGate(self, params: ZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
74
- def PhaseGate(self, params: PhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
75
111
  def HGate(self, params: HGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
76
- def IGate(self, params: IGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
112
+ def CHGate(self, params: CHGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
113
+ def CustomFunction(self, params: CustomFunction, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
114
+ def CSXGate(self, params: CSXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
77
115
  def SGate(self, params: SGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
78
- def SdgGate(self, params: SdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
79
- def C4XGate(self, params: C4XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
80
- def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
81
- def Exponentiation(self, params: Exponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
82
- def Mcx(self, params: Mcx, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
116
+ def IGate(self, params: IGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
117
+ def RZZGate(self, params: RZZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
83
118
  def SuzukiTrotter(self, params: SuzukiTrotter, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
84
- def GreaterEqual(self, params: GreaterEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
85
- def LessThan(self, params: LessThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
86
- def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
87
- def Modulo(self, params: Modulo, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
88
- def ExponentialStatePreparation(self, params: ExponentialStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
89
- def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
90
- def RXXGate(self, params: RXXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
91
- def StatePropagator(self, params: StatePropagator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
92
- def CPhaseGate(self, params: CPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
93
- def GreaterThan(self, params: GreaterThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
94
- def AmplitudeLoading(self, params: AmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
95
- def Arithmetic(self, params: Arithmetic, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
96
- def CRZGate(self, params: CRZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
97
- def PiecewiseLinearRotationAmplitudeLoading(self, params: PiecewiseLinearRotationAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
98
- def Subtractor(self, params: Subtractor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
99
- def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
100
- def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
101
119
  def SXGate(self, params: SXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
102
- def TwoDimensionalEntangler(self, params: TwoDimensionalEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
120
+ def SdgGate(self, params: SdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
103
121
  def SXdgGate(self, params: SXdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
122
+ def GHZStatePreparation(self, params: GHZStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
123
+ def TGate(self, params: TGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
124
+ def TdgGate(self, params: TdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
125
+ def iSwapGate(self, params: iSwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
126
+ def QDrift(self, params: QDrift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
127
+ def CustomOracle(self, params: CustomOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
104
128
  def BitwiseXor(self, params: BitwiseXor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
105
- def RZGate(self, params: RZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
106
- def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
107
- def HypercubeEntangler(self, params: HypercubeEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
129
+ def Modulo(self, params: Modulo, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
108
130
  def LogicalOr(self, params: LogicalOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
109
- def XGate(self, params: XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
110
- def PhaseEstimation(self, params: PhaseEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
131
+ def Multiplier(self, params: Multiplier, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
111
132
  def Min(self, params: Min, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
112
- def WStatePreparation(self, params: WStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
133
+ def BitwiseInvert(self, params: BitwiseInvert, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
113
134
  def Max(self, params: Max, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
114
- def CustomOracle(self, params: CustomOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
115
- def CXGate(self, params: CXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
116
- def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
117
- def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
118
- def HVA(self, params: HVA, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
119
- def GHZStatePreparation(self, params: GHZStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
120
- def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
121
- def PiecewiseLinearAmplitudeLoading(self, params: PiecewiseLinearAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
122
- def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
123
- def RangeMixer(self, params: RangeMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
124
- def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
125
- def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
126
- def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
127
- def Adder(self, params: Adder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
128
- def C3XGate(self, params: C3XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
129
- def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
130
- def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
131
- def ComputationalBasisStatePreparation(self, params: ComputationalBasisStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
132
- def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
133
135
  def GroverDiffuser(self, params: GroverDiffuser, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
134
- def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
135
- def InequalityMixer(self, params: InequalityMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
136
- def CyclicShift(self, params: CyclicShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
137
- def Sign(self, params: Sign, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
138
- def iSwapGate(self, params: iSwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
139
- def TGate(self, params: TGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
136
+ def LinearPauliRotations(self, params: LinearPauliRotations, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
137
+ def RangeMixer(self, params: RangeMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
138
+ def Arithmetic(self, params: Arithmetic, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
139
+ def FinanceModels(self, params: FinanceModels, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
140
+ def RXXGate(self, params: RXXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
141
+ def PiecewiseLinearAmplitudeLoading(self, params: PiecewiseLinearAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
142
+ def CCXGate(self, params: CCXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
143
+ def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
144
+ def StatePropagator(self, params: StatePropagator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
145
+ def CRXGate(self, params: CRXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
146
+ def PhaseGate(self, params: PhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
147
+ def CXGate(self, params: CXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
140
148
  def ArithmeticOracle(self, params: ArithmeticOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
141
- def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
149
+ def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
150
+ def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
151
+ def C4XGate(self, params: C4XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
152
+ def Adder(self, params: Adder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
142
153
  def BitwiseOr(self, params: BitwiseOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
143
- def Identity(self, params: Identity, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
144
- def QDrift(self, params: QDrift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
145
- def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
146
- def RXGate(self, params: RXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
147
- def Multiplier(self, params: Multiplier, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
148
- def HadamardTransform(self, params: HadamardTransform, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
149
- def LinearPauliRotations(self, params: LinearPauliRotations, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
150
- def CommutingPauliExponentiation(self, params: CommutingPauliExponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
151
- def QSVMFeatureMap(self, params: QSVMFeatureMap, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
152
- def CHGate(self, params: CHGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
153
- def CSXGate(self, params: CSXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
@@ -44,7 +44,9 @@ def _version_portable_get_args(py_type: type) -> tuple:
44
44
  return get_args(py_type)[0]
45
45
 
46
46
 
47
- def _python_type_to_qmod(py_type: type) -> Optional[ConcreteClassicalType]:
47
+ def _python_type_to_qmod(
48
+ py_type: type, *, qmodule: ModelStateContainer
49
+ ) -> Optional[ConcreteClassicalType]:
48
50
  if py_type == int:
49
51
  return Integer()
50
52
  elif py_type == float:
@@ -52,7 +54,9 @@ def _python_type_to_qmod(py_type: type) -> Optional[ConcreteClassicalType]:
52
54
  elif py_type == bool:
53
55
  return Bool()
54
56
  elif get_origin(py_type) == list:
55
- return ClassicalList(element_type=_python_type_to_qmod(get_args(py_type)[0]))
57
+ return ClassicalList(
58
+ element_type=_python_type_to_qmod(get_args(py_type)[0], qmodule=qmodule)
59
+ )
56
60
  elif get_origin(py_type) == Array:
57
61
  array_args = _version_portable_get_args(py_type)
58
62
  if len(array_args) != 2:
@@ -60,36 +64,41 @@ def _python_type_to_qmod(py_type: type) -> Optional[ConcreteClassicalType]:
60
64
  "Array accepts two generic parameters in the form 'Array[<element-type>, <size>]'"
61
65
  )
62
66
  return ClassicalArray(
63
- element_type=_python_type_to_qmod(array_args[0]),
67
+ element_type=_python_type_to_qmod(array_args[0], qmodule=qmodule),
64
68
  size=get_type_hint_expr(array_args[1]),
65
69
  )
66
70
  elif inspect.isclass(py_type) and issubclass(py_type, QStructBase):
67
- _add_qmod_struct(py_type)
71
+ _add_qmod_struct(py_type, qmodule=qmodule)
68
72
  return Struct(name=py_type.__name__)
69
73
  return None
70
74
 
71
75
 
72
- def _add_qmod_struct(py_type: Type[QStructBase]) -> None:
76
+ def _add_qmod_struct(
77
+ py_type: Type[QStructBase], *, qmodule: ModelStateContainer
78
+ ) -> None:
73
79
  if (
74
80
  py_type.__name__ in StructDeclaration.BUILTIN_STRUCT_DECLARATIONS
75
- or py_type.__name__ in ModelStateContainer.TYPE_DECLS.keys()
81
+ or py_type.__name__ in qmodule.type_decls.keys()
76
82
  ):
77
83
  return
78
84
 
79
- ModelStateContainer.TYPE_DECLS[py_type.__name__] = StructDeclaration(
85
+ qmodule.type_decls[py_type.__name__] = StructDeclaration(
80
86
  name=py_type.__name__,
81
87
  variables={
82
- f.name: _python_type_to_qmod(f.type) for f in dataclasses.fields(py_type)
88
+ f.name: _python_type_to_qmod(f.type, qmodule=qmodule)
89
+ for f in dataclasses.fields(py_type)
83
90
  },
84
91
  )
85
92
 
86
93
 
87
- def _extract_param_decl(name: str, py_type: Any) -> ClassicalParameterDeclaration:
94
+ def _extract_param_decl(
95
+ name: str, py_type: Any, *, qmodule: ModelStateContainer
96
+ ) -> ClassicalParameterDeclaration:
88
97
  if len(get_args(py_type)) != 1:
89
98
  raise ValueError("QParam takes exactly one generic argument")
90
99
  py_type = get_args(py_type)[0]
91
100
  return ClassicalParameterDeclaration(
92
- name=name, classical_type=_python_type_to_qmod(py_type)
101
+ name=name, classical_type=_python_type_to_qmod(py_type, qmodule=qmodule)
93
102
  )
94
103
 
95
104
 
@@ -106,35 +115,43 @@ def _extract_port_decl(name: str, py_type: Any) -> PortDeclaration:
106
115
  )
107
116
 
108
117
 
109
- def _extract_operand_decl(name: str, py_type: Any) -> QuantumOperandDeclaration:
118
+ def _extract_operand_decl(
119
+ name: str, py_type: Any, qmodule: ModelStateContainer
120
+ ) -> QuantumOperandDeclaration:
110
121
  qc_args = _version_portable_get_args(py_type)
111
122
  arg_dict = {
112
123
  OPERAND_ARG_NAME.format(i=i): arg_type for i, arg_type in enumerate(qc_args)
113
124
  }
114
125
  return QuantumOperandDeclaration(
115
126
  name=name,
116
- positional_arg_declarations=_extract_positional_args(arg_dict),
127
+ positional_arg_declarations=_extract_positional_args(arg_dict, qmodule=qmodule),
117
128
  )
118
129
 
119
130
 
120
- def _extract_positional_args(args: Dict[str, Any]) -> List[PositionalArg]:
131
+ def _extract_positional_args(
132
+ args: Dict[str, Any], qmodule: ModelStateContainer
133
+ ) -> List[PositionalArg]:
121
134
  result: List[PositionalArg] = []
122
135
  for name, py_type in args.items():
123
136
  if name == "return":
124
137
  continue
125
138
  name = unmangle_keyword(name)
126
139
  if get_origin(py_type) is QParam:
127
- result.append(_extract_param_decl(name, py_type))
140
+ result.append(_extract_param_decl(name, py_type, qmodule=qmodule))
128
141
  elif QVar.from_type_hint(py_type) is not None:
129
142
  result.append(_extract_port_decl(name, py_type))
130
143
  else:
131
144
  assert get_origin(py_type) or py_type is QCallable
132
- result.append(_extract_operand_decl(name, py_type))
145
+ result.append(_extract_operand_decl(name, py_type, qmodule=qmodule))
133
146
  return result
134
147
 
135
148
 
136
- def infer_func_decl(py_func: Callable) -> QuantumFunctionDeclaration:
149
+ def infer_func_decl(
150
+ py_func: Callable, qmodule: ModelStateContainer
151
+ ) -> QuantumFunctionDeclaration:
137
152
  return QuantumFunctionDeclaration(
138
153
  name=unmangle_keyword(py_func.__name__),
139
- positional_arg_declarations=_extract_positional_args(py_func.__annotations__),
154
+ positional_arg_declarations=_extract_positional_args(
155
+ py_func.__annotations__, qmodule=qmodule
156
+ ),
140
157
  )
@@ -1,4 +1,4 @@
1
- from typing import ClassVar, Dict
1
+ from typing import Dict
2
2
 
3
3
  from classiq.interface.model.native_function_definition import NativeFunctionDefinition
4
4
 
@@ -6,5 +6,8 @@ from classiq import StructDeclaration
6
6
 
7
7
 
8
8
  class ModelStateContainer:
9
- TYPE_DECLS: ClassVar[Dict[str, StructDeclaration]]
10
- NATIVE_DEFS: ClassVar[Dict[str, NativeFunctionDefinition]]
9
+ type_decls: Dict[str, StructDeclaration]
10
+ native_defs: Dict[str, NativeFunctionDefinition]
11
+
12
+
13
+ QMODULE = ModelStateContainer()