qctrl-commons 25.4.0__tar.gz → 26.1.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.1.0}/PKG-INFO +5 -8
  2. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/pyproject.toml +5 -12
  3. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/__init__.py +1 -1
  4. qctrl_commons-26.1.0/qctrlcommons/montecarlo.py +442 -0
  5. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/run_options.py +6 -0
  6. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/LICENSE +0 -0
  7. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/README.md +0 -0
  8. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/constants.py +0 -0
  9. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/core_exceptions.py +0 -0
  10. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/data_types.py +0 -0
  11. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/exceptions.py +0 -0
  12. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/graph.py +0 -0
  13. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/node/__init__.py +0 -0
  14. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/node/base.py +0 -0
  15. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/node/wrapper.py +0 -0
  16. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/pauli_operations.py +0 -0
  17. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/preconditions.py +0 -0
  18. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/pytest_plugin.py +0 -0
  19. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/serializers.py +0 -0
  20. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/simulation_types.py +0 -0
  21. {qctrl_commons-25.4.0 → qctrl_commons-26.1.0}/qctrlcommons/sparse_occ_op.py +0 -0
  22. {qctrl_commons-25.4.0 → qctrl_commons-26.1.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.1.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.1.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.1.0"
17
17
  __author__ = "Q-CTRL <support@q-ctrl.com>"
@@ -0,0 +1,442 @@
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
+ MAX_ITERATION_COUNT = 20
37
+
38
+ _MIN_UNCERTAINTY = 2
39
+
40
+
41
+ def _validate_bounds(bounds: tuple[float, float], name: str) -> None:
42
+ if bounds[0] >= bounds[1]:
43
+ raise QctrlArgumentsValueError(
44
+ f"{name} lower bound must be strictly less than upper bound.",
45
+ arguments={name: bounds},
46
+ )
47
+
48
+
49
+ def _validate_discrete_point_count(value: float, name: str) -> None:
50
+ check_argument(
51
+ value >= _MIN_UNCERTAINTY,
52
+ f"{name} must be an integer greater than or equal to {_MIN_UNCERTAINTY}.",
53
+ {name: value},
54
+ )
55
+
56
+
57
+ def _validate_discrete_point_counts(
58
+ value: int | list[int],
59
+ name: str,
60
+ ) -> None:
61
+ if isinstance(value, list):
62
+ for i, v in enumerate(value):
63
+ _validate_discrete_point_count(v, f"{name}[{i}]")
64
+ else:
65
+ _validate_discrete_point_count(value, name)
66
+
67
+
68
+ def _validate_bounds_list(
69
+ bounds: tuple[float, float] | list[tuple[float, float]],
70
+ ) -> None:
71
+ if isinstance(bounds, list):
72
+ for i, b in enumerate(bounds):
73
+ _validate_bounds(b, f"bounds[{i}]")
74
+ else:
75
+ _validate_bounds(bounds, "bounds")
76
+
77
+
78
+ def make_uniform_distribution(uncertainty: int) -> dict[str, Any]:
79
+ """
80
+ Create parameters for a uniform probability distribution.
81
+
82
+ Parameters
83
+ ----------
84
+ uncertainty : int
85
+ The number of discrete points for the distribution.
86
+ Must be an integer greater than or equal to 2.
87
+
88
+ Returns
89
+ -------
90
+ dict[str, Any]
91
+ A dictionary containing the parameters of the uniform distribution,
92
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
93
+ """
94
+ _validate_discrete_point_count(uncertainty, "uncertainty")
95
+ return {
96
+ "distribution_name": "uniform",
97
+ "uncertainty": uncertainty,
98
+ }
99
+
100
+
101
+ def make_normal_distribution(
102
+ uncertainty: int | list[int],
103
+ mu: float | list[float] | None = None,
104
+ sigma: float | list[list[float]] | None = None,
105
+ bounds: tuple[float, float] | list[tuple[float, float]] | None = None,
106
+ upto_diag: bool = False,
107
+ ) -> dict[str, Any]:
108
+ """
109
+ Create parameters for a normal (Gaussian) distribution.
110
+
111
+ Parameters
112
+ ----------
113
+ uncertainty : int or list[int]
114
+ The number of discrete points per dimension.
115
+ Each value must be an integer greater than or equal to 2.
116
+ Use a list for multivariate distributions.
117
+ mu : float or list[float] or None, optional
118
+ Mean value(s). Default is None (interpreted as 0 per dimension).
119
+ sigma : float or list[list[float]] or None, optional
120
+ Variance (not standard deviation). For multivariate distributions this
121
+ is a covariance matrix. Default is None (interpreted as 1 per
122
+ dimension).
123
+ bounds : tuple[float, float] or list[tuple[float, float]] or None, optional
124
+ Truncation bounds. Default is None (interpreted as (-1, 1) per
125
+ dimension).
126
+ upto_diag : bool, optional
127
+ Whether to use an optimized circuit that loads the probability
128
+ distribution up to a diagonal phase matrix. Setting this to True
129
+ reduces overall circuit depth, which can improve execution fidelity
130
+ on noisy hardware. Only use this if your subsequent objective function
131
+ operations are unaffected by these relative phases. Default is False.
132
+
133
+ Returns
134
+ -------
135
+ dict[str, Any]
136
+ A dictionary containing the parameters of the normal distribution,
137
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
138
+ """
139
+ _validate_discrete_point_counts(uncertainty, "uncertainty")
140
+ if bounds is not None:
141
+ _validate_bounds_list(bounds)
142
+
143
+ result: dict[str, Any] = {"distribution_name": "normal", "uncertainty": uncertainty}
144
+ if mu is not None:
145
+ result["mu"] = mu
146
+ if sigma is not None:
147
+ result["sigma"] = sigma
148
+ if bounds is not None:
149
+ result["bounds"] = bounds
150
+ if upto_diag:
151
+ result["upto_diag"] = upto_diag
152
+ return result
153
+
154
+
155
+ def make_lognormal_distribution(
156
+ uncertainty: int | list[int],
157
+ mu: float | list[float] | None = None,
158
+ sigma: float | list[list[float]] | None = None,
159
+ bounds: tuple[float, float] | list[tuple[float, float]] | None = None,
160
+ upto_diag: bool = False,
161
+ ) -> dict[str, Any]:
162
+ """
163
+ Create parameters for a log-normal distribution.
164
+
165
+ If X is log-normally distributed then log(X) is normally distributed.
166
+
167
+ Parameters
168
+ ----------
169
+ uncertainty : int or list[int]
170
+ The number of discrete points per dimension.
171
+ Each value must be an integer greater than or equal to 2.
172
+ Use a list for multivariate distributions.
173
+ mu : float or list[float] or None, optional
174
+ Mean of log(X). Default is None (interpreted as 0 per dimension).
175
+ sigma : float or list[list[float]] or None, optional
176
+ Variance of log(X). For multivariate distributions this is a covariance
177
+ matrix. Default is None (interpreted as 1 per dimension).
178
+ bounds : tuple[float, float] or list[tuple[float, float]] or None, optional
179
+ Truncation bounds. Default is None (interpreted as (0, 1) per
180
+ dimension).
181
+ upto_diag : bool, optional
182
+ Whether to use an optimized circuit that loads the probability
183
+ distribution up to a diagonal phase matrix. Setting this to True
184
+ reduces overall circuit depth, which can improve execution fidelity
185
+ on noisy hardware. Only use this if your subsequent objective function
186
+ operations are unaffected by these relative phases. Default is False.
187
+
188
+ Returns
189
+ -------
190
+ dict[str, Any]
191
+ A dictionary containing the parameters of the log-normal distribution,
192
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
193
+ """
194
+ _validate_discrete_point_counts(uncertainty, "uncertainty")
195
+ if bounds is not None:
196
+ _validate_bounds_list(bounds)
197
+
198
+ result: dict[str, Any] = {
199
+ "distribution_name": "lognormal",
200
+ "uncertainty": uncertainty,
201
+ }
202
+ if mu is not None:
203
+ result["mu"] = mu
204
+ if sigma is not None:
205
+ result["sigma"] = sigma
206
+ if bounds is not None:
207
+ result["bounds"] = bounds
208
+ if upto_diag:
209
+ result["upto_diag"] = upto_diag
210
+ return result
211
+
212
+
213
+ def make_gci_model_distribution(
214
+ latent_variable: float,
215
+ normal_max_value: float,
216
+ p_zeros: list[float],
217
+ rhos: list[float],
218
+ ) -> dict[str, Any]:
219
+ """
220
+ Create parameters for a Gaussian Conditional Independence Model distribution.
221
+
222
+ A credit-risk model where dependency between individual risk variables and
223
+ a latent normal variable is approximated linearly.
224
+
225
+ Parameters
226
+ ----------
227
+ latent_variable : float
228
+ The number of discrete points for the latent normal variable.
229
+ Must be an integer greater than or equal to 2.
230
+ normal_max_value : float
231
+ The min/max truncation value for the latent normal variable.
232
+ p_zeros : list[float]
233
+ Standard default probabilities for each asset.
234
+ rhos : list[float]
235
+ Sensitivities of default probability with respect to the latent
236
+ variable, one per asset. Must have the same length as ``p_zeros``.
237
+
238
+ Returns
239
+ -------
240
+ dict[str, Any]
241
+ A dictionary containing the parameters of the Gaussian Conditional Independence Model
242
+ distribution, suitable for use with
243
+ :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
244
+ """
245
+ _validate_discrete_point_count(latent_variable, "latent_variable")
246
+ if len(p_zeros) != len(rhos):
247
+ raise QctrlArgumentsValueError(
248
+ "p_zeros and rhos must have the same length.",
249
+ arguments={"p_zeros": p_zeros, "rhos": rhos},
250
+ )
251
+ return {
252
+ "distribution_name": "gaussian_conditional_independence_model",
253
+ "latent_variable": latent_variable,
254
+ "normal_max_value": normal_max_value,
255
+ "p_zeros": p_zeros,
256
+ "rhos": rhos,
257
+ }
258
+
259
+
260
+ def make_european_call_pricing_objective(
261
+ strike_price: float,
262
+ rescaling_factor: float,
263
+ bounds: tuple[float, float] | None = None,
264
+ ) -> dict[str, Any]:
265
+ """
266
+ Create parameters for a European call option pricing objective.
267
+
268
+ Parameters
269
+ ----------
270
+ strike_price : float
271
+ The strike price K of the option.
272
+ rescaling_factor : float
273
+ Approximation scaling factor for the linear payoff.
274
+ bounds : tuple[float, float] or None, optional
275
+ Bounds of the discretized random variable. Default is None.
276
+
277
+ Returns
278
+ -------
279
+ dict[str, Any]
280
+ A dictionary containing the parameters of the European call option pricing objective,
281
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
282
+ """
283
+
284
+ result: dict[str, Any] = {
285
+ "objective_function_name": "european_call_pricing",
286
+ "strike_price": strike_price,
287
+ "rescaling_factor": rescaling_factor,
288
+ }
289
+ if bounds is not None:
290
+ _validate_bounds(bounds, "bounds")
291
+ result["bounds"] = bounds
292
+ return result
293
+
294
+
295
+ def make_european_call_delta_objective(
296
+ strike_price: float,
297
+ bounds: tuple[float, float] | None = None,
298
+ ) -> dict[str, Any]:
299
+ """
300
+ Create parameters for a European call option delta objective.
301
+
302
+ Parameters
303
+ ----------
304
+ strike_price : float
305
+ The strike price K of the option.
306
+ bounds : tuple[float, float] or None, optional
307
+ Bounds of the discretized random variable. Default is None.
308
+
309
+ Returns
310
+ -------
311
+ dict[str, Any]
312
+ A dictionary containing the parameters of the European call option delta objective,
313
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
314
+ """
315
+
316
+ result: dict[str, Any] = {
317
+ "objective_function_name": "european_call_delta",
318
+ "strike_price": strike_price,
319
+ }
320
+ if bounds is not None:
321
+ _validate_bounds(bounds, "bounds")
322
+ result["bounds"] = bounds
323
+ return result
324
+
325
+
326
+ def make_fixed_income_pricing_objective(
327
+ pca_matrix: np.ndarray,
328
+ initial_interests: list[int],
329
+ cash_flow: list[float],
330
+ rescaling_factor: float,
331
+ bounds: list[tuple[float, float]] | None = None,
332
+ ) -> dict[str, Any]:
333
+ """
334
+ Create parameters for a fixed income pricing objective.
335
+
336
+ Parameters
337
+ ----------
338
+ pca_matrix : numpy.ndarray
339
+ PCA matrix for interest rate changes, shape (T, D) where T is the
340
+ number of time steps and D is the number of dimensions.
341
+ initial_interests : list[int]
342
+ Initial interest rates/offsets, must be length T.
343
+ cash_flow : list[float]
344
+ Cash flow time series, must be length T.
345
+ rescaling_factor : float
346
+ Scaling factor in the Taylor approximation.
347
+ bounds : list[tuple[float, float]] or None, optional
348
+ Bounds for each asset dimension, must be length D. Default is None.
349
+
350
+ Returns
351
+ -------
352
+ dict[str, Any]
353
+ A dictionary containing the parameters for the fixed income pricing objective,
354
+ suitable for use with :func:`~qctrlcommons.montecarlo.make_monte_carlo_problem`.
355
+ """
356
+
357
+ pca = np.asarray(pca_matrix)
358
+ t_dim = pca.shape[0]
359
+ if len(initial_interests) != t_dim:
360
+ raise QctrlArgumentsValueError(
361
+ "initial_interests length must match the number of rows in pca_matrix.",
362
+ arguments={
363
+ "pca_matrix shape": pca.shape,
364
+ "initial_interests": initial_interests,
365
+ },
366
+ )
367
+ if len(cash_flow) != t_dim:
368
+ raise QctrlArgumentsValueError(
369
+ "cash_flow length must match the number of rows in pca_matrix.",
370
+ arguments={
371
+ "pca_matrix shape": pca.shape,
372
+ "cash_flow": cash_flow,
373
+ },
374
+ )
375
+ if bounds is not None:
376
+ d_dim = pca.shape[1] if pca.ndim > 1 else 1
377
+ if len(bounds) != d_dim:
378
+ raise QctrlArgumentsValueError(
379
+ "bounds length must match the number of columns in pca_matrix.",
380
+ arguments={
381
+ "pca_matrix shape": pca.shape,
382
+ "bounds": bounds,
383
+ },
384
+ )
385
+ for i, b in enumerate(bounds):
386
+ _validate_bounds(b, f"bounds[{i}]")
387
+
388
+ result: dict[str, Any] = {
389
+ "objective_function_name": "fixed_income_pricing",
390
+ "pca_matrix": pca_matrix,
391
+ "initial_interests": initial_interests,
392
+ "cash_flow": cash_flow,
393
+ "rescaling_factor": rescaling_factor,
394
+ }
395
+ if bounds is not None:
396
+ result["bounds"] = bounds
397
+ return result
398
+
399
+
400
+ def make_monte_carlo_problem(
401
+ objective_function_parameters: dict[str, Any],
402
+ distribution_parameters: dict[str, Any],
403
+ ) -> dict[str, Any]:
404
+ """
405
+ Assemble a Monte Carlo integration problem dictionary for
406
+ ``fireopal.integrate_monte_carlo``.
407
+
408
+ Parameters
409
+ ----------
410
+ objective_function_parameters : dict[str, Any]
411
+ Parameters for the objective function, as returned by one of the
412
+ ``make_*_objective`` helpers.
413
+ distribution_parameters : dict[str, Any]
414
+ Parameters for the distribution, as returned by one of the
415
+ ``make_*_distribution`` helpers.
416
+
417
+ Returns
418
+ -------
419
+ dict[str, Any]
420
+ A dictionary containing the parameters of the Monte Carlo integration
421
+ problem, suitable for use with :func:`~qctrlcommons.montecarlo.integrate_monte_carlo`.
422
+ """
423
+ obj_name = objective_function_parameters.get("objective_function_name")
424
+ dist_name = distribution_parameters.get("distribution_name")
425
+ if obj_name not in SUPPORTED_OBJECTIVE_FUNCTIONS:
426
+ raise QctrlArgumentsValueError(
427
+ f"Unsupported objective function: {obj_name!r}. "
428
+ f"Must be one of {sorted(SUPPORTED_OBJECTIVE_FUNCTIONS)}.",
429
+ arguments={
430
+ "objective_function": obj_name,
431
+ },
432
+ )
433
+ if dist_name not in SUPPORTED_DISTRIBUTIONS:
434
+ raise QctrlArgumentsValueError(
435
+ f"Unsupported distribution: {dist_name!r}. "
436
+ f"Must be one of {sorted(SUPPORTED_DISTRIBUTIONS)}.",
437
+ arguments={"distribution": dist_name},
438
+ )
439
+ return {
440
+ "objective_function_parameters": objective_function_parameters,
441
+ "distribution_parameters": distribution_parameters,
442
+ }
@@ -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