Skip to content

Commit 9dc1503

Browse files
Sync docs for SDK version 1.2.0
1 parent 715f6b0 commit 9dc1503

File tree

10 files changed

+102
-25
lines changed

10 files changed

+102
-25
lines changed

.internal/docs/qmod-reference/api-reference/functions/core_library/gray_code.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ search:
1010
show_if_no_docstrings: false
1111
members:
1212
- select_rotation
13+
- select_z_rotation
1314
<!-- prettier-ignore-end -->
1415
<!-- spell-checker: enable -->

.internal/docs/qmod-reference/language-reference/expressions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ on the Assignment documentation page.
166166

167167
Classical expressions are expressions that involve classical variables and
168168
constant literals, but no quantum variables.
169-
Classical variables may have known values at [compile time, link time, or runtime]](https://docs.classiq.io/latest/qmod-reference/language-reference/classical-variables/#semantics).
169+
Classical variables may have known values at [compile time, link time, or runtime](https://docs.classiq.io/latest/qmod-reference/language-reference/classical-variables/#semantics).
170170
Classical expressions with only compile-time variables are evaluated and
171171
simplified during compilation.
172172
This applies sub-expressions of quantum expressions too.

.internal/docs/qmod-reference/language-reference/generative-descriptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ The example below demonstrates the declaration and use of a function parameter w
141141
a Python type. The function `my_operator` takes a function parameter `my_operand`,
142142
which expects a Python `float` as parameter. In function `main`, `my_operator` is called
143143
and passed a lambda expression in which the corresponding `ratio` parameter is used
144-
in Python context expression, namely as the argument of `math.asin`. If `ration*2` were
144+
in Python context expression, namely as the argument of `math.asin`. If `ratio*2` were
145145
a symbolic expression, it would be illegal to use it in this context.
146146

147147
```python

.internal/docs/qmod-reference/language-reference/quantum-types.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ the values are rounded down:
223223

224224
Output measurements:
225225

226+
```
226227
state=[{'x': 1.0, 'y': 1.25}: 268,
227228
{'x': 1.5, 'y': 2.0}: 262,
228229
{'x': 2.5, 'y': 3.25}: 261,
@@ -231,6 +232,7 @@ Output measurements:
231232
{'x': 3.5, 'y': 0.75}: 253,
232233
{'x': 0.5, 'y': 0.5}: 251,
233234
{'x': 3.0, 'y': 0.0}: 238]
235+
```
234236

235237
Notice, for instance, when `x = 1.0`, the exact product 1.4 is rounded down to 1.25 to fit into `y`'s available qubits.
236238

@@ -491,9 +493,11 @@ diffuser is defined in a generic way and uses the qubit array view of the state.
491493
Executing this model will sample a state representing a solution to the problem in
492494
very high probability. This is an example of an output. Here is an output example:
493495

496+
```
494497
state={'p': {'a': 0.0, 'b': 0.625}} shots=350
495498
state={'p': {'a': 0.25, 'b': 0.375}} shots=344
496499
state={'p': {'a': 0.5, 'b': 0.125}} shots=306
500+
```
497501

498502
In Qmod's Python embedding, the size of `MyProblem` is given by
499503
`MyProblem.num_qubits`:

.internal/docs/qmod-reference/language-reference/statements/power.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ of the _power_ operation.
4343

4444
```python
4545
from classiq import *
46+
from classiq.qmod.symbolic import pi
4647

4748

4849
@qfunc
@@ -52,8 +53,7 @@ of the _power_ operation.
5253

5354

5455
@qfunc
55-
def main() -> None:
56-
q = QBit()
56+
def main(q: Output[QBit]) -> None:
5757
allocate(q)
5858
power(2, lambda: foo(5, q))
5959
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
search:
3+
boost: 1.0
4+
---
5+
6+
<!-- cspell:ignore cudaq -->
7+
8+
Classiq to [CUDA-Q](https://developer.nvidia.com/cuda-q) translation.
9+
These functions require the `cudaq` extra (install `classiq[cudaq]`).
10+
Note that the `cudaq` extra is only available in Classiq Studio and on any Linux
11+
Machine.
12+
13+
::: classiq.qprog_to_cudaq

.internal/docs/user-guide/execution/budget-management.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ search:
55

66
# Managing Execution Budget
77

8-
Enrolled users can run quantum programs on multiple backends without needing to provide their own credentials, by using `run_through_classiq`.
8+
Enrolled users can run quantum programs on multiple backends without needing to provide their own credentials, by using `run_via_classiq`.
99

10-
When a job is submitted using `run_through_classiq`, it will only proceed if the estimated cost is within the remaining budget allocated for the chosen provider.
10+
When a job is submitted using `run_via_classiq`, it will only proceed if the estimated cost is within the remaining budget allocated for the chosen provider.
1111

1212
Additionally, we offer methods to monitor usage and set limits, helping you control and optimize your spending.
1313

14-
For example, to set up execution using `run_through_classiq` on the Amazon Braket SV1 simulator:
14+
For example, to set up execution using `run_via_classiq` on the Amazon Braket SV1 simulator:
1515

1616
[comment]: DO_NOT_TEST
1717

@@ -29,7 +29,7 @@ qprog = synthesize(main)
2929
exec_pref = ExecutionPreferences(
3030
backend_preferences=AwsBackendPreferences(
3131
backend_name="SV1",
32-
run_through_classiq=True,
32+
run_via_classiq=True,
3333
)
3434
)
3535

.internal/docs/user-guide/execution/cloud-providers/azure-backends.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The Classiq executor supports execution on Azure Quantum cloud simulators and ha
1616

1717
Possible modes of operation:
1818

19-
- Running through Classiq-Azure integration. In this mode you do not need to provide credentials or location.
19+
- Running via Classiq-Azure integration. In this mode you do not need to provide credentials or location.
2020
- Executing on your private Azure Quantum Workspace by providing credentials.
2121
For more details, see [Executing on Your Quantum Workspace](#executing-on-your-quantum-workspace).
2222

@@ -30,12 +30,12 @@ Possible modes of operation:
3030
AzureBackendPreferences,
3131
)
3232

33-
# Running through Classiq-Azure integration:
33+
# Running via Classiq-Azure integration:
3434
preferences = AzureBackendPreferences(
3535
backend_name="Name of requsted simulator or hardware",
3636
)
3737

38-
# Running through a private Azure account:
38+
# Running via a private Azure account:
3939
cred = AzureCredential(
4040
tenant_id="Azure Tenant ID (from Azure Active Directory)",
4141
client_id="Azure Application (client) ID",
@@ -54,7 +54,7 @@ Possible modes of operation:
5454

5555
![Opening info tab](../../../resources/execution_azure_login.png)
5656

57-
For academic users, backends run through Classiq-Azure integration by default. To override this configuration, switch on "Run with my own credentials" in the backends summary section on the Execution page:
57+
For academic users, backends run via Classiq-Azure integration by default. To override this configuration, switch on "Run with my own credentials" in the backends summary section on the Execution page:
5858

5959
![Config run with own credentials](../../../resources/config-run-with-own-credentials.png)
6060

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# CUDA-Q Integration
2+
3+
## Overview
4+
5+
The Classiq–CUDA-Q integration enables users to design quantum algorithms at a high level using Classiq, while leveraging CUDA-Q for execution, simulation, and hybrid quantum–classical workflows.
6+
This integration is particularly well suited for variational algorithms, such as QAOA, where circuit synthesis, parameterized execution, and classical optimization must work together efficiently.
7+
8+
## Prerequisites
9+
10+
Before using the integration, ensure the following are installed in your python environment:
11+
12+
- Python 3.9 or later
13+
- Classiq SDK
14+
- CUDA-Q
15+
16+
Note: The integration is only supported on Linux. The simplest way to handle installations is to use [Classiq Studio](https://platform.classiq.io/studio/) and `pip install classiq[cudaq]`.
17+
18+
## Integration Core Functions
19+
20+
The Integration is built around two Classiq SDK helper functions:
21+
22+
- `qprog_to_cudaq_kernel()`
23+
Converts a synthesized Classiq quantum program (`qprog`) into a CUDA-Q kernel that can be executed using CUDA-Q SDK.
24+
25+
- `pauli_operator_to_cudaq_spin_op()`
26+
Transforms Qmod's `SparsePauliOp` data structure to CUDA-Q's `SpinOperator`.
27+
28+
## Usage Example
29+
30+
Here is a minimal example:
31+
32+
- Defining and synthesizing a parametric model using Classiq.
33+
- Converting to CUDA-Q kernel, assigning value to the parameter and sampling.
34+
35+
[comment]: DO_NOT_TEST
36+
37+
```python
38+
# ! pip install classiq[cudaq]
39+
from classiq import *
40+
import cudaq
41+
import math
42+
43+
44+
@qfunc
45+
def main(theta: CReal, q: Output[QBit]):
46+
allocate(q)
47+
RX(theta, q)
48+
49+
50+
qprog = synthesize(main)
51+
my_kernel = qprog_to_cudaq_kernel(qprog)
52+
53+
counts = cudaq.sample(my_kernel, math.pi / 3)
54+
print(counts)
55+
56+
# example outputs -
57+
# { 0:753 1:247 }
58+
```

.internal/docs/user-guide/execution/index.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When designing your model, do not forget to include [execution primitives](primi
1616

1717
When viewing a quantum program in the "Quantum Program" page, after synthesizing your model or uploading your quantum program file, click "Execute":
1818

19-
![Execute a quantum program](../resources/execute_circuit_button.png)
19+
![Execute a quantum program](../resources/newvis_execute_circuit_button.png)
2020

2121
In the next screen you can choose your execution preferences and run your quantum program.
2222

@@ -25,26 +25,26 @@ When designing your model, do not forget to include [execution primitives](primi
2525
[comment]: DO_NOT_TEST
2626

2727
```python
28-
from classiq import qfunc, Output, QBit, synthesize, execute, allocate
28+
from classiq import *
2929

3030

3131
# Design your quantum model
3232
@qfunc
3333
def main(res: Output[QBit]) -> None:
34-
allocate(1, res)
34+
allocate(res)
3535

3636

3737
# Synthesize a quantum program from the quantum model
3838
quantum_program = synthesize(main)
3939

4040
# Execute the quantum program and access the result
41-
job = execute(quantum_program)
42-
results = job.result()
41+
ex = execute(quantum_program)
42+
results = ex.result()
4343
```
4444

4545
### Execution Preferences
4646

47-
You can configure the execution process by modifying the execution preferences.
47+
You can configure the execution process by modifying the execution preferences with the function [`ExecutionPreferences`](../../sdk-reference/execution/#classiq.execution.ExecutionPreferences).
4848
The main execution preferences:
4949

5050
- Backend preferences, such as provider, backend name, and credentials. See [Cloud Providers](cloud-providers/index.md).
@@ -58,13 +58,13 @@ The main execution preferences:
5858

5959
Choose your backend preferences in the "Execute Quantum Circuit" window:
6060

61-
![Choose backend preferences](../resources/backend_preferences.png)
61+
![Choose backend preferences](../resources/newvis_backend_preferences.png)
6262

6363
You can select more than one backend on which to run, but note that a maximum of five backends can be selected at a time.
6464

6565
Optionally configure more execution preferences in the "Execution Configuration" window:
6666

67-
![Choose execution preferences](../resources/execution_preferences.png)
67+
![Choose execution preferences](../resources/newvis_execution_preferences.png)
6868

6969
Finally, execute your program by clicking "Run".
7070

@@ -75,17 +75,17 @@ The main execution preferences:
7575
[comment]: DO_NOT_TEST
7676

7777
```python
78-
from classiq import set_execution_preferences, ExecutionPreferences
78+
from classiq import *
7979

8080
# Define execution preferences
8181
execution_preferences = ExecutionPreferences(
8282
num_shots=1000
8383
) # set your real preferences instead!
8484

8585
# Set the execution preferences
86-
model = set_execution_preferences(model, execution_preferences)
86+
with ExecutionSession(qprog, execution_preferences=execution_preferences) as es:
87+
results_more_shots = es.sample()
8788
```
88-
See [ExecutionPreferences](../../sdk-reference/execution/#classiq.execution.ExecutionPreferences) in the SDK reference for more details.
8989

9090
<!-- prettier-ignore-start -->
9191
!!! tip
@@ -131,6 +131,8 @@ regardless of whether they were originally sent via the IDE or the SDK.
131131
job = ExecutionJob.from_id("00000000-0000-0000-0000-000000000000")
132132
```
133133

134+
See also [`get_execution_jobs` reference](../../sdk-reference/execution/#classiq.execution.jobs.get_execution_jobs)
135+
134136
### Results
135137

136138
=== "IDE"
@@ -143,8 +145,7 @@ regardless of whether they were originally sent via the IDE or the SDK.
143145

144146
It is possible to filter the results by specifying them:
145147

146-
![Filter results](../resources/filter_results_button.png)
147-
![Filtered results](../resources/filtered_results.png)
148+
![Filter results](../resources/newvis_filter_results_button.png)
148149

149150
=== "SDK"
150151

0 commit comments

Comments
 (0)