qcs-sdk-python 0.26.0__cp313-cp313-win_amd64.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 (36) hide show
  1. README-py.md +111 -0
  2. THIRDPARTY.yaml +40894 -0
  3. qcs_sdk/__init__.py +23 -0
  4. qcs_sdk/__init__.pyi +441 -0
  5. qcs_sdk/_qcs_sdk.cp313-win_amd64.pyd +0 -0
  6. qcs_sdk/_tracing_subscriber/.stubtest-allowlist +7 -0
  7. qcs_sdk/_tracing_subscriber/__init__.py +17 -0
  8. qcs_sdk/_tracing_subscriber/__init__.pyi +131 -0
  9. qcs_sdk/_tracing_subscriber/common/__init__.py +18 -0
  10. qcs_sdk/_tracing_subscriber/common/__init__.pyi +46 -0
  11. qcs_sdk/_tracing_subscriber/layers/__init__.py +18 -0
  12. qcs_sdk/_tracing_subscriber/layers/__init__.pyi +30 -0
  13. qcs_sdk/_tracing_subscriber/layers/file/__init__.py +19 -0
  14. qcs_sdk/_tracing_subscriber/layers/file/__init__.pyi +42 -0
  15. qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.py +18 -0
  16. qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.pyi +118 -0
  17. qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.py +18 -0
  18. qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.pyi +38 -0
  19. qcs_sdk/_tracing_subscriber/subscriber/__init__.py +18 -0
  20. qcs_sdk/_tracing_subscriber/subscriber/__init__.pyi +25 -0
  21. qcs_sdk/client.pyi +124 -0
  22. qcs_sdk/compiler/__init__.pyi +5 -0
  23. qcs_sdk/compiler/quilc.pyi +316 -0
  24. qcs_sdk/diagnostics.pyi +36 -0
  25. qcs_sdk/qpu/__init__.pyi +216 -0
  26. qcs_sdk/qpu/api.pyi +484 -0
  27. qcs_sdk/qpu/experimental/__init__.pyi +5 -0
  28. qcs_sdk/qpu/experimental/random.pyi +98 -0
  29. qcs_sdk/qpu/isa.pyi +472 -0
  30. qcs_sdk/qpu/translation.pyi +180 -0
  31. qcs_sdk/qvm/__init__.pyi +162 -0
  32. qcs_sdk/qvm/api.pyi +236 -0
  33. qcs_sdk_python-0.26.0.dist-info/METADATA +130 -0
  34. qcs_sdk_python-0.26.0.dist-info/RECORD +36 -0
  35. qcs_sdk_python-0.26.0.dist-info/WHEEL +4 -0
  36. qcs_sdk_python-0.26.0.dist-info/sboms/qcs.cyclonedx.json +19204 -0
qcs_sdk/qpu/api.pyi ADDED
@@ -0,0 +1,484 @@
1
+ # This file is automatically generated by pyo3_stub_gen
2
+ # ruff: noqa: E501, F401
3
+
4
+ import builtins
5
+ import collections.abc
6
+ import datetime
7
+ import typing
8
+ from qcs_sdk import QcsSdkError
9
+ from qcs_sdk.client import QCSClient
10
+ from qcs_sdk.qpu import MemoryValues
11
+
12
+ @typing.final
13
+ class APIExecutionOptions:
14
+ r"""
15
+ Options available when executing a job on a QPU, particular to the execution service's API.
16
+
17
+ This is a conventent alias for [`InnerApiExecutionOptions`] which provides a builder.
18
+
19
+ Use [`Default`] to get a reasonable set of defaults, or start with [`ApiExecutionOptionsBuilder`]
20
+ to build a custom set of options.
21
+ """
22
+ @property
23
+ def bypass_settings_protection(self) -> builtins.bool:
24
+ r"""
25
+ Get the configured `bypass_settings_protection` value.
26
+ """
27
+ @property
28
+ def timeout(self) -> typing.Optional[QpuApiDuration]:
29
+ r"""
30
+ Get the configured `timeout` value.
31
+
32
+ Note, this is the timeout while running a job; the job will be evicted from
33
+ the hardware once this time has elapsed.
34
+
35
+ If unset, the job's estimated duration will be used;
36
+ if the job does not have an estimated duration, the default
37
+ timeout is selected by the service.
38
+
39
+ The service may also enforce a maximum value for this field.
40
+ """
41
+ def __new__(cls, bypass_settings_protection: builtins.bool = False, timeout: typing.Optional[datetime.timedelta] = None) -> APIExecutionOptions: ...
42
+ def __repr__(self) -> builtins.str:
43
+ r"""
44
+ Implements `__repr__` for Python in terms of the Rust
45
+ [`Debug`](std::fmt::Debug) implementation.
46
+ """
47
+ @staticmethod
48
+ def builder() -> APIExecutionOptionsBuilder:
49
+ r"""
50
+ Get an [`ExecutionOptionsBuilder`] that can be used to build a custom [`ExecutionOptions`].
51
+ """
52
+ @staticmethod
53
+ def default() -> APIExecutionOptions: ...
54
+
55
+ @typing.final
56
+ class APIExecutionOptionsBuilder:
57
+ r"""
58
+ Builder for [`ApiExecutionOptions`](struct.ApiExecutionOptions.html).
59
+ """
60
+ @property
61
+ def bypass_settings_protection(self) -> typing.Never:
62
+ r"""
63
+ DO NOT CALL THIS METHOD.
64
+
65
+ `mypy` requires write-only properties to have a getter,
66
+ but this method is not actually available at runtime.
67
+ """
68
+ @bypass_settings_protection.setter
69
+ def bypass_settings_protection(self, value: builtins.bool) -> None: ...
70
+ @property
71
+ def timeout(self) -> typing.Never:
72
+ r"""
73
+ DO NOT CALL THIS METHOD.
74
+
75
+ `mypy` requires write-only properties to have a getter,
76
+ but this method is not actually available at runtime.
77
+ """
78
+ @timeout.setter
79
+ def timeout(self, value: typing.Optional[QpuApiDuration]) -> None: ...
80
+ def __new__(cls) -> APIExecutionOptionsBuilder: ...
81
+ def build(self) -> APIExecutionOptions: ...
82
+ @staticmethod
83
+ def default() -> APIExecutionOptionsBuilder: ...
84
+
85
+ class BuildOptionsError(QpuApiError):
86
+ r"""
87
+ Errors building execution options.
88
+ """
89
+ ...
90
+
91
+ class ConnectionStrategy:
92
+ r"""
93
+ The connection strategy to use when submitting and retrieving jobs from a QPU.
94
+ """
95
+ def __getnewargs__(self) -> tuple[str] | tuple[()]: ...
96
+ def __repr__(self) -> builtins.str:
97
+ r"""
98
+ Implements `__repr__` for Python in terms of the Rust
99
+ [`Debug`](std::fmt::Debug) implementation.
100
+ """
101
+ @staticmethod
102
+ def default() -> ConnectionStrategy: ...
103
+ def get_endpoint_id(self) -> builtins.str: ...
104
+ @typing.final
105
+ class DirectAccess(ConnectionStrategy):
106
+ r"""
107
+ Connect directly to the default endpoint, bypassing the gateway. Should only be used when you
108
+ have direct network access and an active reservation.
109
+ """
110
+ __match_args__ = ()
111
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
112
+ def __len__(self) -> builtins.int: ...
113
+ def __new__(cls) -> ConnectionStrategy.DirectAccess: ...
114
+
115
+ @typing.final
116
+ class EndpointAddress(ConnectionStrategy):
117
+ r"""
118
+ Connect directly to a specific endpoint by its gRPC address, bypassing the gateway.
119
+
120
+ Should only be used when you have direct network access.
121
+ """
122
+ __match_args__ = ("_0",)
123
+ @property
124
+ def _0(self) -> builtins.str: ...
125
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
126
+ def __len__(self) -> builtins.int: ...
127
+ def __new__(cls, _0: builtins.str) -> ConnectionStrategy.EndpointAddress: ...
128
+
129
+ @typing.final
130
+ class EndpointId(ConnectionStrategy):
131
+ r"""
132
+ Connect directly to a specific endpoint using its ID.
133
+ """
134
+ __match_args__ = ("_0",)
135
+ @property
136
+ def _0(self) -> builtins.str: ...
137
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
138
+ def __len__(self) -> builtins.int: ...
139
+ def __new__(cls, _0: builtins.str) -> ConnectionStrategy.EndpointId: ...
140
+
141
+ @typing.final
142
+ class Gateway(ConnectionStrategy):
143
+ r"""
144
+ Connect through the publicly accessible gateway.
145
+ """
146
+ __match_args__ = ()
147
+ def __getitem__(self, key: builtins.int) -> typing.Any: ...
148
+ def __len__(self) -> builtins.int: ...
149
+ def __new__(cls) -> ConnectionStrategy.Gateway: ...
150
+
151
+
152
+ @typing.final
153
+ class ExecutionOptions:
154
+ r"""
155
+ Options available when executing a job on a QPU.
156
+
157
+ Use [`Default`] to get a reasonable set of defaults, or start with [`ExecutionOptionsBuilder`]
158
+ to build a custom set of options.
159
+ """
160
+ @property
161
+ def api_options(self) -> typing.Optional[APIExecutionOptions]: ...
162
+ @property
163
+ def connection_strategy(self) -> ConnectionStrategy:
164
+ r"""
165
+ The [`ConnectionStrategy`] to use to establish a connection to the QPU.
166
+ """
167
+ @property
168
+ def timeout_seconds(self) -> typing.Optional[builtins.float]: ...
169
+ def __eq__(self, other: builtins.object) -> builtins.bool: ...
170
+ def __getnewargs__(self) -> tuple[ConnectionStrategy, typing.Optional[datetime.timedelta], typing.Optional[APIExecutionOptions]]: ...
171
+ def __new__(cls, connection_strategy: ConnectionStrategy = ..., timeout: typing.Optional[datetime.timedelta] = ..., api_options: typing.Optional[APIExecutionOptions] = None) -> ExecutionOptions: ...
172
+ def __repr__(self) -> builtins.str:
173
+ r"""
174
+ Implements `__repr__` for Python in terms of the Rust
175
+ [`Debug`](std::fmt::Debug) implementation.
176
+ """
177
+ @staticmethod
178
+ def builder() -> ExecutionOptionsBuilder: ...
179
+ @staticmethod
180
+ def default() -> ExecutionOptions: ...
181
+
182
+ @typing.final
183
+ class ExecutionOptionsBuilder:
184
+ r"""
185
+ Builder for [`ExecutionOptions`](struct.ExecutionOptions.html).
186
+ """
187
+ @property
188
+ def api_options(self) -> typing.Never:
189
+ r"""
190
+ DO NOT CALL THIS METHOD.
191
+
192
+ `mypy` requires write-only properties to have a getter,
193
+ but this method is not actually available at runtime.
194
+ """
195
+ @api_options.setter
196
+ def api_options(self, value: typing.Optional[APIExecutionOptions]) -> None: ...
197
+ @property
198
+ def connection_strategy(self) -> typing.Never:
199
+ r"""
200
+ DO NOT CALL THIS METHOD.
201
+
202
+ `mypy` requires write-only properties to have a getter,
203
+ but this method is not actually available at runtime.
204
+ """
205
+ @connection_strategy.setter
206
+ def connection_strategy(self, value: ConnectionStrategy) -> None: ...
207
+ @property
208
+ def timeout_seconds(self) -> typing.Never:
209
+ r"""
210
+ DO NOT CALL THIS METHOD.
211
+
212
+ `mypy` requires write-only properties to have a getter,
213
+ but this method is not actually available at runtime.
214
+ """
215
+ @timeout_seconds.setter
216
+ def timeout_seconds(self, value: typing.Optional[builtins.float]) -> None: ...
217
+ def __new__(cls) -> ExecutionOptionsBuilder: ...
218
+ def build(self) -> ExecutionOptions: ...
219
+ @staticmethod
220
+ def default() -> ExecutionOptionsBuilder: ...
221
+
222
+ @typing.final
223
+ class ExecutionResult:
224
+ r"""
225
+ Execution readout data from a particular memory location.
226
+ """
227
+ @property
228
+ def data(self) -> builtins.list[builtins.int] | builtins.list[builtins.complex]:
229
+ r"""
230
+ The result data for all shots by the particular memory location.
231
+ """
232
+ @property
233
+ def dtype(self) -> builtins.str:
234
+ r"""
235
+ The type of the result data (as a `numpy` `dtype`).
236
+ """
237
+ @property
238
+ def shape(self) -> builtins.list[builtins.int]:
239
+ r"""
240
+ The shape of the result data.
241
+ """
242
+ def __getnewargs__(self) -> tuple[builtins.list[builtins.int] | builtins.list[builtins.complex]]: ...
243
+ def __new__(cls, register: typing.Sequence[builtins.int] | typing.Sequence[builtins.complex]) -> ExecutionResult: ...
244
+ @staticmethod
245
+ def from_register(register: typing.Sequence[builtins.int] | typing.Sequence[builtins.complex]) -> ExecutionResult:
246
+ r"""
247
+ Build an `ExecutionResult` from a `Register`.
248
+ """
249
+
250
+ @typing.final
251
+ class ExecutionResults:
252
+ r"""
253
+ Execution readout data for all memory locations.
254
+ """
255
+ @property
256
+ def buffers(self) -> builtins.dict[builtins.str, ExecutionResult]:
257
+ r"""
258
+ The readout results of execution, mapping a published filter node to its data.
259
+
260
+ See `TranslationResult.ro_sources` which provides the mapping from the filter node name
261
+ to the name of the memory declaration in the source program.
262
+ """
263
+ @property
264
+ def execution_duration_microseconds(self) -> typing.Optional[builtins.int]:
265
+ r"""
266
+ The time spent executing the program.
267
+ """
268
+ @property
269
+ def memory(self) -> builtins.dict[builtins.str, MemoryValues]:
270
+ r"""
271
+ The final state of memory for parameters that were read from and written to during
272
+ the execution of the program.
273
+ """
274
+ def __new__(cls, buffers: typing.Mapping[builtins.str, ExecutionResult], memory: typing.Mapping[builtins.str, MemoryValues], execution_duration_microseconds: typing.Optional[builtins.int] = None) -> ExecutionResults: ...
275
+
276
+ @typing.final
277
+ class QpuApiDuration:
278
+ r"""
279
+ The duration of an API call.
280
+ """
281
+ @property
282
+ def nanos(self) -> builtins.int: ...
283
+ @property
284
+ def seconds(self) -> builtins.int: ...
285
+ def __new__(cls, seconds: builtins.int, nanos: builtins.int) -> QpuApiDuration: ...
286
+
287
+ class QpuApiError(QcsSdkError):
288
+ r"""
289
+ Errors that can occur while attempting to establish a connection to the QPU.
290
+ """
291
+ ...
292
+
293
+ class SubmissionError(QpuApiError):
294
+ r"""
295
+ Errors that may occur when submitting a program for execution.
296
+ """
297
+ ...
298
+
299
+ def cancel_job(job_id: builtins.str, quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> None:
300
+ r"""
301
+ Cancel a job that has yet to begin executing.
302
+
303
+ This action is *not* atomic, and will attempt to cancel a job even if it cannot be cancelled. A
304
+ job can be cancelled only if it has not yet started executing.
305
+
306
+ Success response indicates only that the request was received. Cancellation is not guaranteed,
307
+ as it is based on job state at the time of cancellation, and is completed on a best effort
308
+ basis.
309
+
310
+ :param job_id: The job ID to cancel.
311
+ :param quantum_processor_id: The quantum processor to execute the job on. This parameter is required unless using the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
312
+ :param client: The ``Qcs`` client to use.
313
+ :param execution_options: The ``ExecutionOptions`` to use.
314
+ """
315
+
316
+ def cancel_job_async(job_id: builtins.str, quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[None]:
317
+ r"""
318
+ Cancel a job that has yet to begin executing.
319
+
320
+ This action is *not* atomic, and will attempt to cancel a job even if it cannot be cancelled. A
321
+ job can be cancelled only if it has not yet started executing.
322
+
323
+ Success response indicates only that the request was received. Cancellation is not guaranteed,
324
+ as it is based on job state at the time of cancellation, and is completed on a best effort
325
+ basis.
326
+
327
+ :param job_id: The job ID to cancel.
328
+ :param quantum_processor_id: The quantum processor to execute the job on. This parameter is required unless using the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
329
+ :param client: The ``Qcs`` client to use.
330
+ :param execution_options: The ``ExecutionOptions`` to use.
331
+ """
332
+
333
+ def cancel_jobs(job_ids: typing.Sequence[builtins.str], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> None:
334
+ r"""
335
+ Cancel all given jobs that have yet to begin executing.
336
+
337
+ This action is *not* atomic, and will attempt to cancel every job even when some jobs cannot be
338
+ cancelled. A job can be cancelled only if it has not yet started executing.
339
+
340
+ Success response indicates only that the request was received. Cancellation is not guaranteed,
341
+ as it is based on job state at the time of cancellation, and is completed on a best effort
342
+ basis.
343
+
344
+ :param job_ids: The job IDs to cancel.
345
+ :param quantum_processor_id: The quantum processor to execute the job on. This parameter is required unless using the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
346
+ :param client: The ``Qcs`` client to use.
347
+ :param execution_options: The ``ExecutionOptions`` to use.
348
+ """
349
+
350
+ def cancel_jobs_async(job_ids: typing.Sequence[builtins.str], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[None]:
351
+ r"""
352
+ Cancel all given jobs that have yet to begin executing.
353
+
354
+ This action is *not* atomic, and will attempt to cancel every job even when some jobs cannot be
355
+ cancelled. A job can be cancelled only if it has not yet started executing.
356
+
357
+ Success response indicates only that the request was received. Cancellation is not guaranteed,
358
+ as it is based on job state at the time of cancellation, and is completed on a best effort
359
+ basis.
360
+
361
+ :param job_ids: The job IDs to cancel.
362
+ :param quantum_processor_id: The quantum processor to execute the job on. This parameter is required unless using the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
363
+ :param client: The ``Qcs`` client to use.
364
+ :param execution_options: The ``ExecutionOptions`` to use.
365
+ """
366
+
367
+ def retrieve_results(job_id: builtins.str, quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> ExecutionResults:
368
+ r"""
369
+ Fetches execution results for the given QCS Job ID.
370
+
371
+ :param job_id: The ID of the job to retrieve results for.
372
+ :param quantum_processor_id: The ID of the quantum processor the job ran on. This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
373
+ :param client: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
374
+ :param execution_options: The ``ExecutionOptions`` to use.
375
+
376
+ :returns: Results from execution.
377
+
378
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
379
+ :raises QpuApiError: If there was a problem retrieving the results.
380
+ """
381
+
382
+ def retrieve_results_async(job_id: builtins.str, quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[ExecutionResults]:
383
+ r"""
384
+ Fetches execution results for the given QCS Job ID.
385
+
386
+ :param job_id: The ID of the job to retrieve results for.
387
+ :param quantum_processor_id: The ID of the quantum processor the job ran on. This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
388
+ :param client: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
389
+ :param execution_options: The ``ExecutionOptions`` to use.
390
+
391
+ :returns: Results from execution.
392
+
393
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
394
+ :raises QpuApiError: If there was a problem retrieving the results.
395
+ """
396
+
397
+ def submit(program: builtins.str, patch_values: typing.Mapping[builtins.str, typing.Sequence[builtins.float]], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> builtins.str:
398
+ r"""
399
+ Submits an executable `program` to be run on the specified QPU.
400
+
401
+ :param program: An executable program (see ``qcs_sdk.qpu.translation.translate``).
402
+ :param patch_values: A mapping of symbols to their desired values (see ``build_patch_values``).
403
+ :param quantum_processor_id: The ID of the quantum processor to run the executable on.
404
+ This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()``
405
+ or ``ConnectionStrategy.endpoint_address()`` execution option.
406
+ :param client: The ``Qcs`` client to use.
407
+ Creates one using environment configuration if unset.
408
+ See https://docs.rigetti.com/qcs/references/qcs-client-configuration for more information.
409
+ :param execution_options: The ``ExecutionOptions`` to use.
410
+ If the connection strategy option used is ``ConnectionStrategy.endpoint_id("endpoint_id")``
411
+ or ``ConnectionStrategy.endpoint_address("http://some_endpoint_address")``,
412
+ then direct access to "endpoint_id" overrides the ``quantum_processor_id`` parameter.
413
+
414
+ :returns: The ID of the submitted job which can be used to fetch results.
415
+
416
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
417
+ :raises SubmissionError: If there was a problem submitting the program for execution.
418
+ """
419
+
420
+ def submit_async(program: builtins.str, patch_values: typing.Mapping[builtins.str, typing.Sequence[builtins.float]], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[builtins.str]:
421
+ r"""
422
+ Submits an executable `program` to be run on the specified QPU.
423
+
424
+ :param program: An executable program (see ``qcs_sdk.qpu.translation.translate``).
425
+ :param patch_values: A mapping of symbols to their desired values (see ``build_patch_values``).
426
+ :param quantum_processor_id: The ID of the quantum processor to run the executable on.
427
+ This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()``
428
+ or ``ConnectionStrategy.endpoint_address()`` execution option.
429
+ :param client: The ``Qcs`` client to use.
430
+ Creates one using environment configuration if unset.
431
+ See https://docs.rigetti.com/qcs/references/qcs-client-configuration for more information.
432
+ :param execution_options: The ``ExecutionOptions`` to use.
433
+ If the connection strategy option used is ``ConnectionStrategy.endpoint_id("endpoint_id")``
434
+ or ``ConnectionStrategy.endpoint_address("http://some_endpoint_address")``,
435
+ then direct access to "endpoint_id" overrides the ``quantum_processor_id`` parameter.
436
+
437
+ :returns: The ID of the submitted job which can be used to fetch results.
438
+
439
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
440
+ :raises SubmissionError: If there was a problem submitting the program for execution.
441
+ """
442
+
443
+ def submit_with_parameter_batch(program: builtins.str, patch_values: typing.Sequence[typing.Mapping[builtins.str, typing.Sequence[builtins.float]]], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> builtins.list[builtins.str]:
444
+ r"""
445
+ Execute a compiled program on a QPU with multiple sets of ``patch_values``.
446
+
447
+ This action is *atomic* in that all jobs will be queued, or none of them will. On success, this
448
+ function will return a list of strings where the length and order correspond to the
449
+ ``patch_values`` given. However, note that execution in the order of given patch values is not
450
+ guaranteed. If there is a failure to queue any of the jobs, then none will be queued.
451
+
452
+ :param program: An executable program (see ``translate``).
453
+ :param patch_values: An iterable containing one or more mapping of symbols to their desired values.
454
+ :param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
455
+ :param client: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
456
+ :param execution_options: The ``ExecutionOptions`` to use.
457
+
458
+ :returns: The IDs of the submitted jobs which can be used to fetch results.
459
+
460
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
461
+ :raises SubmissionError: If there was a problem submitting any of the jobs for execution, or if no ``patch_values`` are given.
462
+ """
463
+
464
+ def submit_with_parameter_batch_async(program: builtins.str, patch_values: typing.Sequence[typing.Mapping[builtins.str, typing.Sequence[builtins.float]]], quantum_processor_id: typing.Optional[builtins.str] = None, client: typing.Optional[QCSClient] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[builtins.list[builtins.str]]:
465
+ r"""
466
+ Execute a compiled program on a QPU with multiple sets of ``patch_values``.
467
+
468
+ This action is *atomic* in that all jobs will be queued, or none of them will. On success, this
469
+ function will return a list of strings where the length and order correspond to the
470
+ ``patch_values`` given. However, note that execution in the order of given patch values is not
471
+ guaranteed. If there is a failure to queue any of the jobs, then none will be queued.
472
+
473
+ :param program: An executable program (see ``translate``).
474
+ :param patch_values: An iterable containing one or more mapping of symbols to their desired values.
475
+ :param quantum_processor_id: The ID of the quantum processor to run the executable on. This field is required, unless being used with the ``ConnectionStrategy.endpoint_id()`` or ``ConnectionStrategy.endpoint_address()`` execution option.
476
+ :param client: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
477
+ :param execution_options: The ``ExecutionOptions`` to use.
478
+
479
+ :returns: The IDs of the submitted jobs which can be used to fetch results.
480
+
481
+ :raises LoadClientError: If there is an issue loading the QCS Client configuration.
482
+ :raises SubmissionError: If there was a problem submitting any of the jobs for execution, or if no ``patch_values`` are given.
483
+ """
484
+
@@ -0,0 +1,5 @@
1
+ # This file is automatically generated by pyo3_stub_gen
2
+ # ruff: noqa: E501, F401
3
+
4
+ from . import random
5
+
@@ -0,0 +1,98 @@
1
+ # This file is automatically generated by pyo3_stub_gen
2
+ # ruff: noqa: E501, F401
3
+
4
+ import builtins
5
+ import typing
6
+ from qcs_sdk import QcsSdkError
7
+
8
+ @typing.final
9
+ class ChooseRandomRealSubRegions:
10
+ r"""
11
+ An [`ExternedCall`] that may be used to select one or more random
12
+ sub-regions from a source array of real values to a destination array.
13
+ """
14
+ NAME: builtins.str = 'choose_random_real_sub_regions'
15
+ r"""
16
+ The name of the function referenced by the `PRAGMA EXTERN` and `CALL` instructions.
17
+ """
18
+ @staticmethod
19
+ def build_signature() -> builtins.str:
20
+ r"""
21
+ Build the signature for the `PRAGMA EXTERN choose_random_real_sub_regions` instruction.
22
+
23
+ The signature expressed in Quil is as follows:
24
+
25
+ ```text
26
+ "(destination : mut REAL[], source : REAL[], sub_region_size : INTEGER, seed : mut INTEGER)"
27
+ ```
28
+ """
29
+
30
+ @typing.final
31
+ class PrngSeedValue:
32
+ r"""
33
+ A valid seed value that may be used to initialize the PRNG. Such
34
+ values are in the range `[1, MAX_SEQUENCER_VALUE]` and are losslessly
35
+ convertible to `f64`.
36
+ """
37
+ def __new__(cls, value: builtins.int) -> PrngSeedValue:
38
+ r"""
39
+ Attempt to create a new instance of `PrngSeedValue` from a `u64`.
40
+
41
+ # Errors
42
+
43
+ Returns [`Error::InvalidSeed`] if the value is not in range `[1, MAX_SEQUENCER_VALUE]`
44
+ or if it is not losslessly convertible to `f64`.
45
+ """
46
+ def as_f64(self) -> builtins.float: ...
47
+
48
+ class RandomError(QcsSdkError):
49
+ r"""
50
+ Errors that may occur using the randomization primitives defined in this module.
51
+ """
52
+ ...
53
+
54
+ def choose_random_real_sub_region_indices(seed: PrngSeedValue, start_index: builtins.int, series_length: builtins.int, sub_region_count: builtins.int) -> builtins.list[builtins.int]:
55
+ r"""
56
+ Given a seed, start index, series length, and sub-region count, this function
57
+ will generate and return the sequence of pseudo-randomly chosen indices on
58
+ the Rigetti control systems.
59
+
60
+ For instance, if the following Quil program is run for 100 shots:
61
+
62
+ ```quil
63
+ # presumed sub-region size is 3.
64
+ DECLARE destination REAL[6] # prng invocations per shot = (6 / sub_region_size) = 2
65
+ DECLARE source REAL[12] # implicit sub-region count = (12 / sub_region_size) = 4
66
+ DECLARE seed INTEGER[1]
67
+ DECLARE ro BIT[1]
68
+
69
+ DELAY 0 1e-6
70
+
71
+ PRAGMA EXTERN choose_random_real_sub_regions "(destination : mut REAL[], source : REAL[], sub_region_size : INTEGER, seed : mut INTEGER)"
72
+ CALL choose_random_real_sub_regions destination source 3 seed
73
+ ```
74
+
75
+ with a seed of 639,523, the following will provide the random sequence of sub-region indices:
76
+
77
+ ```rust
78
+ use qcs::qpu::experimental::random::{choose_random_real_sub_region_indices, PrngSeedValue};
79
+
80
+ let seed = PrngSeedValue::try_new(639_523).unwrap();
81
+ let start_index = 0;
82
+ let prng_invocations_per_shot = 2;
83
+ let shot_count = 100;
84
+ let series_length = prng_invocations_per_shot * shot_count;
85
+ let sub_region_count = 4;
86
+ let _random_indices = choose_random_real_sub_region_indices(seed, start_index, series_length, sub_region_count);
87
+ ```
88
+ """
89
+
90
+ def lfsr_v1_next(seed: PrngSeedValue) -> builtins.int:
91
+ r"""
92
+ This represents the [linear feedback shift
93
+ register](https://en.wikipedia.org/wiki/Linear-feedback_shift_register)
94
+ currently implemented on Rigetti control systems. Specifically,
95
+ it implements a 48-bit LFSR with taps at 0-based indices 47, 46, 20, and 19.
96
+ The taps have been shown to produce maximal sequence lengths for 48-bit strings.
97
+ """
98
+