qctrl-commons 25.4.0__tar.gz → 26.0.0__tar.gz

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 (22) hide show
  1. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/PKG-INFO +5 -8
  2. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/pyproject.toml +5 -12
  3. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/__init__.py +1 -1
  4. qctrl_commons-26.0.0/qctrlcommons/montecarlo.py +440 -0
  5. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/run_options.py +6 -0
  6. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/LICENSE +0 -0
  7. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/README.md +0 -0
  8. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/constants.py +0 -0
  9. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/core_exceptions.py +0 -0
  10. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/data_types.py +0 -0
  11. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/exceptions.py +0 -0
  12. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/graph.py +0 -0
  13. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/node/__init__.py +0 -0
  14. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/node/base.py +0 -0
  15. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/node/wrapper.py +0 -0
  16. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/pauli_operations.py +0 -0
  17. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/preconditions.py +0 -0
  18. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/pytest_plugin.py +0 -0
  19. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/serializers.py +0 -0
  20. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/simulation_types.py +0 -0
  21. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/sparse_occ_op.py +0 -0
  22. {qctrl_commons-25.4.0 → qctrl_commons-26.0.0}/qctrlcommons/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qctrl-commons
3
- Version: 25.4.0
3
+ Version: 26.0.0
4
4
  Summary: Q-CTRL Commons
5
5
  License-File: LICENSE
6
6
  Keywords: black opal,boulder opal,fire opal,nisq,open controls,q control,q ctrl,q-control,q-ctrl,qcontrol,qctrl,quantum,quantum algorithms,quantum circuits,quantum coding,quantum coding software,quantum computing,quantum control,quantum control software,quantum control theory,quantum engineering,quantum error correction,quantum firmware,quantum fundamentals,quantum sensing,qubit,qudit
@@ -8,7 +8,7 @@ Author: Q-CTRL
8
8
  Author-email: support@q-ctrl.com
9
9
  Maintainer: Q-CTRL
10
10
  Maintainer-email: support@q-ctrl.com
11
- Requires-Python: >=3.10, <3.14
11
+ Requires-Python: >=3.11, <3.15
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
@@ -16,10 +16,10 @@ Classifier: Intended Audience :: Education
16
16
  Classifier: Intended Audience :: Science/Research
17
17
  Classifier: Natural Language :: English
18
18
  Classifier: Operating System :: OS Independent
19
- Classifier: Programming Language :: Python :: 3.10
20
19
  Classifier: Programming Language :: Python :: 3.11
21
20
  Classifier: Programming Language :: Python :: 3.12
22
21
  Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
23
  Classifier: Topic :: Internet :: WWW/HTTP
24
24
  Classifier: Topic :: Scientific/Engineering :: Physics
25
25
  Classifier: Topic :: Scientific/Engineering :: Visualization
@@ -27,11 +27,8 @@ Classifier: Topic :: Software Development :: Embedded Systems
27
27
  Classifier: Topic :: System :: Distributed Computing
28
28
  Requires-Dist: graphql-core (>=3.2.1,<3.3.0)
29
29
  Requires-Dist: networkx (>=3.0.0,<4.0.0)
30
- Requires-Dist: numpy (>=2.2.6,<3.0.0) ; python_version == "3.10"
31
- Requires-Dist: numpy (>=2.4.6,<3.0.0) ; python_version == "3.11"
32
- Requires-Dist: numpy (>=2.5.1,<3.0.0) ; python_version >= "3.12" and python_version < "3.14"
33
- Requires-Dist: scipy (>=1.14.1,<2.0.0) ; python_version == "3.13"
34
- Requires-Dist: scipy (>=1.9.3) ; python_version >= "3.10" and python_version < "3.13"
30
+ Requires-Dist: numpy (>=2.4.5,<3.0.0)
31
+ Requires-Dist: scipy (>=1.12.0,<2.0.0)
35
32
  Requires-Dist: sympy (>=1.11.1,<2.0.0)
36
33
  Project-URL: Facebook, https://www.facebook.com/qctrl
37
34
  Project-URL: GitHub, https://github.com/qctrl
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "qctrl-commons"
3
- version = "25.4.0"
3
+ version = "26.0.0"
4
4
  description = "Q-CTRL Commons"
5
5
  license-files = ["LICENSE"]
6
- requires-python = ">=3.10, <3.14"
6
+ requires-python = ">=3.11, <3.15"
7
7
  authors = [{name = "Q-CTRL", email = "support@q-ctrl.com"}]
8
8
  maintainers = [{name = "Q-CTRL", email = "support@q-ctrl.com"}]
9
9
  readme = "README.md"
@@ -45,10 +45,10 @@ classifiers = [
45
45
  "Intended Audience :: Science/Research",
46
46
  "Natural Language :: English",
47
47
  "Operating System :: OS Independent",
48
- "Programming Language :: Python :: 3.10",
49
48
  "Programming Language :: Python :: 3.11",
50
49
  "Programming Language :: Python :: 3.12",
51
50
  "Programming Language :: Python :: 3.13",
51
+ "Programming Language :: Python :: 3.14",
52
52
  "Topic :: Internet :: WWW/HTTP",
53
53
  "Topic :: Scientific/Engineering :: Physics",
54
54
  "Topic :: Scientific/Engineering :: Visualization",
@@ -63,15 +63,8 @@ packages = [
63
63
 
64
64
  [tool.poetry.dependencies]
65
65
  networkx = ">=3.0.0,<4.0.0"
66
- numpy = [
67
- { version = "^2.2.6", python = ">=3.10,<3.11" },
68
- { version = "^2.4.6", python = ">=3.11,<3.12" },
69
- { version = "^2.5.1", python = ">=3.12,<3.14" }
70
- ]
71
- scipy = [
72
- { version = ">=1.9.3", python = ">=3.10,<3.13" },
73
- { version = "^1.14.1", python = ">=3.13,<3.14" }
74
- ]
66
+ numpy = "^2.4.5"
67
+ scipy = "^1.12.0"
75
68
  sympy = "^1.11.1"
76
69
  graphql-core = "~3.2.1"
77
70
 
@@ -13,5 +13,5 @@
13
13
 
14
14
  """qctrlcommons - a collection of common libraries for the Python language"""
15
15
 
16
- __version__ = "25.4.0"
16
+ __version__ = "26.0.0"
17
17
  __author__ = "Q-CTRL <support@q-ctrl.com>"
@@ -0,0 +1,440 @@
1
+ # Copyright 2026 Q-CTRL. All rights reserved.
2
+ #
3
+ # Licensed under the Q-CTRL Terms of service (the "License"). Unauthorized
4
+ # copying or use of this file, via any medium, is strictly prohibited.
5
+ # Proprietary and confidential. You may not use this file except in compliance
6
+ # with the License. You may obtain a copy of the License at
7
+ #
8
+ # https://q-ctrl.com/terms
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS. See the
12
+ # License for the specific language.
13
+ """Helper functions for building Monte Carlo integration problem dictionaries."""
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import Any
18
+
19
+ import numpy as np
20
+
21
+ from qctrlcommons.exceptions import QctrlArgumentsValueError
22
+ from qctrlcommons.preconditions import check_argument
23
+
24
+ SUPPORTED_OBJECTIVE_FUNCTIONS = {
25
+ "european_call_pricing",
26
+ "european_call_delta",
27
+ "fixed_income_pricing",
28
+ }
29
+ SUPPORTED_DISTRIBUTIONS = {
30
+ "uniform",
31
+ "normal",
32
+ "lognormal",
33
+ "gaussian_conditional_independence_model",
34
+ }
35
+
36
+ _MIN_UNCERTAINTY = 2
37
+
38
+
39
+ def _validate_bounds(bounds: tuple[float, float], name: str) -> None:
40
+ if bounds[0] >= bounds[1]:
41
+ raise QctrlArgumentsValueError(
42
+ f"{name} lower bound must be strictly less than upper bound.",
43
+ arguments={name: bounds},
44
+ )
45
+
46
+
47
+ def _validate_discrete_point_count(value: float, name: str) -> None:
48
+ check_argument(
49
+ value >= _MIN_UNCERTAINTY,
50
+ f"{name} must be an integer greater than or equal to {_MIN_UNCERTAINTY}.",
51
+ {name: value},
52
+ )
53
+
54
+
55
+ def _validate_discrete_point_counts(
56
+ value: int | list[int],
57
+ name: str,
58
+ ) -> None:
59
+ if isinstance(value, list):
60
+ for i, v in enumerate(value):
61
+ _validate_discrete_point_count(v, f"{name}[{i}]")
62
+ else:
63
+ _validate_discrete_point_count(value, name)
64
+
65
+
66
+ def _validate_bounds_list(
67
+ bounds: tuple[float, float] | list[tuple[float, float]],
68
+ ) -> None:
69
+ if isinstance(bounds, list):
70
+ for i, b in enumerate(bounds):
71
+ _validate_bounds(b, f"bounds[{i}]")
72
+ else:
73
+ _validate_bounds(bounds, "bounds")
74
+
75
+
76
+ def make_uniform_distribution(uncertainty: int) -> dict[str, Any]:
77
+ """
78
+ Create parameters for a uniform probability distribution.
79
+
80
+ Parameters
81
+ ----------
82
+ uncertainty : int
83
+ The number of discrete points for the distribution.
84
+ Must be an integer greater than or equal to 2.
85
+
86
+ Returns
87
+ -------
88
+ dict[str, Any]
89
+ A dictionary containing the parameters of the uniform distribution,
90
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
91
+ """
92
+ _validate_discrete_point_count(uncertainty, "uncertainty")
93
+ return {
94
+ "distribution_name": "uniform",
95
+ "uncertainty": uncertainty,
96
+ }
97
+
98
+
99
+ def make_normal_distribution(
100
+ uncertainty: int | list[int],
101
+ mu: float | list[float] | None = None,
102
+ sigma: float | list[list[float]] | None = None,
103
+ bounds: tuple[float, float] | list[tuple[float, float]] | None = None,
104
+ upto_diag: bool = False,
105
+ ) -> dict[str, Any]:
106
+ """
107
+ Create parameters for a normal (Gaussian) distribution.
108
+
109
+ Parameters
110
+ ----------
111
+ uncertainty : int or list[int]
112
+ The number of discrete points per dimension.
113
+ Each value must be an integer greater than or equal to 2.
114
+ Use a list for multivariate distributions.
115
+ mu : float or list[float] or None, optional
116
+ Mean value(s). Default is None (interpreted as 0 per dimension).
117
+ sigma : float or list[list[float]] or None, optional
118
+ Variance (not standard deviation). For multivariate distributions this
119
+ is a covariance matrix. Default is None (interpreted as 1 per
120
+ dimension).
121
+ bounds : tuple[float, float] or list[tuple[float, float]] or None, optional
122
+ Truncation bounds. Default is None (interpreted as (-1, 1) per
123
+ dimension).
124
+ upto_diag : bool, optional
125
+ Whether to use an optimized circuit that loads the probability
126
+ distribution up to a diagonal phase matrix. Setting this to True
127
+ reduces overall circuit depth, which can improve execution fidelity
128
+ on noisy hardware. Only use this if your subsequent objective function
129
+ operations are unaffected by these relative phases. Default is False.
130
+
131
+ Returns
132
+ -------
133
+ dict[str, Any]
134
+ A dictionary containing the parameters of the normal distribution,
135
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
136
+ """
137
+ _validate_discrete_point_counts(uncertainty, "uncertainty")
138
+ if bounds is not None:
139
+ _validate_bounds_list(bounds)
140
+
141
+ result: dict[str, Any] = {"distribution_name": "normal", "uncertainty": uncertainty}
142
+ if mu is not None:
143
+ result["mu"] = mu
144
+ if sigma is not None:
145
+ result["sigma"] = sigma
146
+ if bounds is not None:
147
+ result["bounds"] = bounds
148
+ if upto_diag:
149
+ result["upto_diag"] = upto_diag
150
+ return result
151
+
152
+
153
+ def make_lognormal_distribution(
154
+ uncertainty: int | list[int],
155
+ mu: float | list[float] | None = None,
156
+ sigma: float | list[list[float]] | None = None,
157
+ bounds: tuple[float, float] | list[tuple[float, float]] | None = None,
158
+ upto_diag: bool = False,
159
+ ) -> dict[str, Any]:
160
+ """
161
+ Create parameters for a log-normal distribution.
162
+
163
+ If X is log-normally distributed then log(X) is normally distributed.
164
+
165
+ Parameters
166
+ ----------
167
+ uncertainty : int or list[int]
168
+ The number of discrete points per dimension.
169
+ Each value must be an integer greater than or equal to 2.
170
+ Use a list for multivariate distributions.
171
+ mu : float or list[float] or None, optional
172
+ Mean of log(X). Default is None (interpreted as 0 per dimension).
173
+ sigma : float or list[list[float]] or None, optional
174
+ Variance of log(X). For multivariate distributions this is a covariance
175
+ matrix. Default is None (interpreted as 1 per dimension).
176
+ bounds : tuple[float, float] or list[tuple[float, float]] or None, optional
177
+ Truncation bounds. Default is None (interpreted as (0, 1) per
178
+ dimension).
179
+ upto_diag : bool, optional
180
+ Whether to use an optimized circuit that loads the probability
181
+ distribution up to a diagonal phase matrix. Setting this to True
182
+ reduces overall circuit depth, which can improve execution fidelity
183
+ on noisy hardware. Only use this if your subsequent objective function
184
+ operations are unaffected by these relative phases. Default is False.
185
+
186
+ Returns
187
+ -------
188
+ dict[str, Any]
189
+ A dictionary containing the parameters of the log-normal distribution,
190
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
191
+ """
192
+ _validate_discrete_point_counts(uncertainty, "uncertainty")
193
+ if bounds is not None:
194
+ _validate_bounds_list(bounds)
195
+
196
+ result: dict[str, Any] = {
197
+ "distribution_name": "lognormal",
198
+ "uncertainty": uncertainty,
199
+ }
200
+ if mu is not None:
201
+ result["mu"] = mu
202
+ if sigma is not None:
203
+ result["sigma"] = sigma
204
+ if bounds is not None:
205
+ result["bounds"] = bounds
206
+ if upto_diag:
207
+ result["upto_diag"] = upto_diag
208
+ return result
209
+
210
+
211
+ def make_gci_model_distribution(
212
+ latent_variable: float,
213
+ normal_max_value: float,
214
+ p_zeros: list[float],
215
+ rhos: list[float],
216
+ ) -> dict[str, Any]:
217
+ """
218
+ Create parameters for a Gaussian Conditional Independence Model distribution.
219
+
220
+ A credit-risk model where dependency between individual risk variables and
221
+ a latent normal variable is approximated linearly.
222
+
223
+ Parameters
224
+ ----------
225
+ latent_variable : float
226
+ The number of discrete points for the latent normal variable.
227
+ Must be an integer greater than or equal to 2.
228
+ normal_max_value : float
229
+ The min/max truncation value for the latent normal variable.
230
+ p_zeros : list[float]
231
+ Standard default probabilities for each asset.
232
+ rhos : list[float]
233
+ Sensitivities of default probability with respect to the latent
234
+ variable, one per asset. Must have the same length as ``p_zeros``.
235
+
236
+ Returns
237
+ -------
238
+ dict[str, Any]
239
+ A dictionary containing the parameters of the Gaussian Conditional Independence Model
240
+ distribution, suitable for use with
241
+ :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
242
+ """
243
+ _validate_discrete_point_count(latent_variable, "latent_variable")
244
+ if len(p_zeros) != len(rhos):
245
+ raise QctrlArgumentsValueError(
246
+ "p_zeros and rhos must have the same length.",
247
+ arguments={"p_zeros": p_zeros, "rhos": rhos},
248
+ )
249
+ return {
250
+ "distribution_name": "gaussian_conditional_independence_model",
251
+ "latent_variable": latent_variable,
252
+ "normal_max_value": normal_max_value,
253
+ "p_zeros": p_zeros,
254
+ "rhos": rhos,
255
+ }
256
+
257
+
258
+ def make_european_call_pricing_objective(
259
+ strike_price: float,
260
+ rescaling_factor: float,
261
+ bounds: tuple[float, float] | None = None,
262
+ ) -> dict[str, Any]:
263
+ """
264
+ Create parameters for a European call option pricing objective.
265
+
266
+ Parameters
267
+ ----------
268
+ strike_price : float
269
+ The strike price K of the option.
270
+ rescaling_factor : float
271
+ Approximation scaling factor for the linear payoff.
272
+ bounds : tuple[float, float] or None, optional
273
+ Bounds of the discretized random variable. Default is None.
274
+
275
+ Returns
276
+ -------
277
+ dict[str, Any]
278
+ A dictionary containing the parameters of the European call option pricing objective,
279
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
280
+ """
281
+
282
+ result: dict[str, Any] = {
283
+ "objective_function_name": "european_call_pricing",
284
+ "strike_price": strike_price,
285
+ "rescaling_factor": rescaling_factor,
286
+ }
287
+ if bounds is not None:
288
+ _validate_bounds(bounds, "bounds")
289
+ result["bounds"] = bounds
290
+ return result
291
+
292
+
293
+ def make_european_call_delta_objective(
294
+ strike_price: float,
295
+ bounds: tuple[float, float] | None = None,
296
+ ) -> dict[str, Any]:
297
+ """
298
+ Create parameters for a European call option delta objective.
299
+
300
+ Parameters
301
+ ----------
302
+ strike_price : float
303
+ The strike price K of the option.
304
+ bounds : tuple[float, float] or None, optional
305
+ Bounds of the discretized random variable. Default is None.
306
+
307
+ Returns
308
+ -------
309
+ dict[str, Any]
310
+ A dictionary containing the parameters of the European call option delta objective,
311
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
312
+ """
313
+
314
+ result: dict[str, Any] = {
315
+ "objective_function_name": "european_call_delta",
316
+ "strike_price": strike_price,
317
+ }
318
+ if bounds is not None:
319
+ _validate_bounds(bounds, "bounds")
320
+ result["bounds"] = bounds
321
+ return result
322
+
323
+
324
+ def make_fixed_income_pricing_objective(
325
+ pca_matrix: np.ndarray,
326
+ initial_interests: list[int],
327
+ cash_flow: list[float],
328
+ rescaling_factor: float,
329
+ bounds: list[tuple[float, float]] | None = None,
330
+ ) -> dict[str, Any]:
331
+ """
332
+ Create parameters for a fixed income pricing objective.
333
+
334
+ Parameters
335
+ ----------
336
+ pca_matrix : numpy.ndarray
337
+ PCA matrix for interest rate changes, shape (T, D) where T is the
338
+ number of time steps and D is the number of dimensions.
339
+ initial_interests : list[int]
340
+ Initial interest rates/offsets, must be length T.
341
+ cash_flow : list[float]
342
+ Cash flow time series, must be length T.
343
+ rescaling_factor : float
344
+ Scaling factor in the Taylor approximation.
345
+ bounds : list[tuple[float, float]] or None, optional
346
+ Bounds for each asset dimension, must be length D. Default is None.
347
+
348
+ Returns
349
+ -------
350
+ dict[str, Any]
351
+ A dictionary containing the parameters for the fixed income pricing objective,
352
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
353
+ """
354
+
355
+ pca = np.asarray(pca_matrix)
356
+ t_dim = pca.shape[0]
357
+ if len(initial_interests) != t_dim:
358
+ raise QctrlArgumentsValueError(
359
+ "initial_interests length must match the number of rows in pca_matrix.",
360
+ arguments={
361
+ "pca_matrix shape": pca.shape,
362
+ "initial_interests": initial_interests,
363
+ },
364
+ )
365
+ if len(cash_flow) != t_dim:
366
+ raise QctrlArgumentsValueError(
367
+ "cash_flow length must match the number of rows in pca_matrix.",
368
+ arguments={
369
+ "pca_matrix shape": pca.shape,
370
+ "cash_flow": cash_flow,
371
+ },
372
+ )
373
+ if bounds is not None:
374
+ d_dim = pca.shape[1] if pca.ndim > 1 else 1
375
+ if len(bounds) != d_dim:
376
+ raise QctrlArgumentsValueError(
377
+ "bounds length must match the number of columns in pca_matrix.",
378
+ arguments={
379
+ "pca_matrix shape": pca.shape,
380
+ "bounds": bounds,
381
+ },
382
+ )
383
+ for i, b in enumerate(bounds):
384
+ _validate_bounds(b, f"bounds[{i}]")
385
+
386
+ result: dict[str, Any] = {
387
+ "objective_function_name": "fixed_income_pricing",
388
+ "pca_matrix": pca_matrix,
389
+ "initial_interests": initial_interests,
390
+ "cash_flow": cash_flow,
391
+ "rescaling_factor": rescaling_factor,
392
+ }
393
+ if bounds is not None:
394
+ result["bounds"] = bounds
395
+ return result
396
+
397
+
398
+ def make_monte_carlo_problem(
399
+ objective_function_parameters: dict[str, Any],
400
+ distribution_parameters: dict[str, Any],
401
+ ) -> dict[str, Any]:
402
+ """
403
+ Assemble a Monte Carlo integration problem dictionary for
404
+ ``fireopal.integrate_monte_carlo``.
405
+
406
+ Parameters
407
+ ----------
408
+ objective_function_parameters : dict[str, Any]
409
+ Parameters for the objective function, as returned by one of the
410
+ ``make_*_objective`` helpers.
411
+ distribution_parameters : dict[str, Any]
412
+ Parameters for the distribution, as returned by one of the
413
+ ``make_*_distribution`` helpers.
414
+
415
+ Returns
416
+ -------
417
+ dict[str, Any]
418
+ A dictionary containing the parameters of the Monte Carlo integration
419
+ problem, suitable for use with :func:`~qctrlcommons.montecarlo.integrate_monte_carlo`.
420
+ """
421
+ obj_name = objective_function_parameters.get("objective_function_name")
422
+ dist_name = distribution_parameters.get("distribution_name")
423
+ if obj_name not in SUPPORTED_OBJECTIVE_FUNCTIONS:
424
+ raise QctrlArgumentsValueError(
425
+ f"Unsupported objective function: {obj_name!r}. "
426
+ f"Must be one of {sorted(SUPPORTED_OBJECTIVE_FUNCTIONS)}.",
427
+ arguments={
428
+ "objective_function": obj_name,
429
+ },
430
+ )
431
+ if dist_name not in SUPPORTED_DISTRIBUTIONS:
432
+ raise QctrlArgumentsValueError(
433
+ f"Unsupported distribution: {dist_name!r}. "
434
+ f"Must be one of {sorted(SUPPORTED_DISTRIBUTIONS)}.",
435
+ arguments={"distribution": dist_name},
436
+ )
437
+ return {
438
+ "objective_function_parameters": objective_function_parameters,
439
+ "distribution_parameters": distribution_parameters,
440
+ }
@@ -42,6 +42,11 @@ class IbmRunOptions(RunOptions):
42
42
  A list of tags to append to the jobs submitted to IBM Quantum. Tags are
43
43
  useful for filtering and identifying jobs in the IBM Quantum dashboard.
44
44
  Defaults to None, meaning no additional tags are applied.
45
+ reduce_approximation : bool, optional
46
+ A flag indicating whether to run circuit optimization with lower approximation
47
+ tolerance. This may be desirable to turn on if the impact of trivial unitary
48
+ rotations or near-identity gates must be preserved rather than simplified away.
49
+ Defaults to False.
45
50
 
46
51
  Examples
47
52
  --------
@@ -59,3 +64,4 @@ class IbmRunOptions(RunOptions):
59
64
 
60
65
  session_id: str | None = None
61
66
  job_tags: list[str] | None = None
67
+ reduce_approximation: bool = False
File without changes
File without changes