Skip to content

Commit dbf01f0

Browse files
Update API dev docs (#4128)
An action recently synced the latest dev docs. This PR updates all dev APIs that changed. > [!NOTE] > This pull request was created by a GitHub action. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent de536e0 commit dbf01f0

File tree

68 files changed

+625
-296
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+625
-296
lines changed

docs/api/qiskit-c/dev/_toc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
"title": "QkComplex64",
2626
"url": "/docs/api/qiskit-c/dev/qk-complex-64"
2727
},
28+
{
29+
"title": "QkDag",
30+
"url": "/docs/api/qiskit-c/dev/qk-dag"
31+
},
2832
{
2933
"title": "QkExitCode",
3034
"url": "/docs/api/qiskit-c/dev/qk-exit-code"

docs/api/qiskit-c/dev/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ As this interface is still new in Qiskit it should be considered experimental an
3838

3939
Using the transpiler from the C API is intended to only cover circuits created solely via the C API. If you are in a hybrid mode where you’re using the C API with Python you should invoke the transpiler via the Python [`qiskit.transpiler`](/docs/api/qiskit/dev/transpiler#module-qiskit.transpiler "qiskit.transpiler") module instead; the functionality is the same Rust internals they just offer different entrypoints. The C API for transpilation makes assumptions about the input only using constructs exposed to the C Quantum Circuit API and you will potentially get incomplete results transpiling circuits from Python via the C API.
4040

41+
* [QkDag](qk-dag)
4142
* [QkTranspiler](qk-transpiler)
4243
* [QkTarget](qk-target)
4344
* [QkTargetEntry](qk-target-entry)

docs/api/qiskit-c/dev/qk-bit-term.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The numeric structure of these is that they are all four-bit values of which the
9191
<Function id="qk_bitterm_label" signature="uint8_t qk_bitterm_label(QkBitTerm bit_term)">
9292
Get the label for a bit term.
9393

94-
<span id="group__QkBitTerm_1autotoc_md144" />
94+
<span id="group__QkBitTerm_1autotoc_md155" />
9595

9696
#### Example
9797

@@ -101,11 +101,11 @@ The numeric structure of these is that they are all four-bit values of which the
101101
char label = qk_bitterm_label(bit_term);
102102
```
103103

104-
<span id="group__QkBitTerm_1autotoc_md145" />
104+
<span id="group__QkBitTerm_1autotoc_md156" />
105105

106106
#### Safety
107107

108-
<span id="group__QkBitTerm_1autotoc_md145" />
108+
<span id="group__QkBitTerm_1autotoc_md156" />
109109

110110
The behavior is undefined if `bit_term` is not a valid `uint8_t` value of a `QkBitTerm`.
111111

docs/api/qiskit-c/dev/qk-dag.mdx

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
---
2+
title: QkDag (dev version)
3+
description: API reference for QkDag in the dev version of qiskit-c
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: QkDag
7+
---
8+
9+
# QkDag
10+
11+
```c
12+
typedef struct QkDag QkDag
13+
```
14+
15+
The `QkDag` struct exposes a low level interface to the Qiskit transpiler’s directed acyclic graph (DAG) representation of a quantum circuit for use in transpiler passes. It exposes only what is defined in the inner data model of Qiskit. Therefore it is missing some functionality that is available in the higher level Python [`DAGCircuit`](/docs/api/qiskit/dev/qiskit.dagcircuit.DAGCircuit#qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") class.
16+
17+
The C API currently only supports building DAGs that contain operations defined in Qiskit’s internal Rust data model. Generally this includes only gates in the standard gate library, standard non-unitary operations (currently [`Barrier`](/docs/api/qiskit/dev/circuit#qiskit.circuit.Barrier "qiskit.circuit.Barrier"), [`Measure`](/docs/api/qiskit/dev/circuit#qiskit.circuit.Measure "qiskit.circuit.Measure"), [`Reset`](/docs/api/qiskit/dev/circuit#qiskit.circuit.Reset "qiskit.circuit.Reset"), and [`Delay`](/docs/api/qiskit/dev/circuit#qiskit.circuit.Delay "qiskit.circuit.Delay")) and [`UnitaryGate`](/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryGate#qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate"). This functionality will be expanded over time as the Rust data model is expanded to natively support more functionality.
18+
19+
## Functions
20+
21+
### qk\_dag\_new
22+
23+
<Function id="qk_dag_new" signature="QkDag *qk_dag_new(void)">
24+
Construct a new empty DAG.
25+
26+
You must free the returned DAG with qk\_dag\_free when done with it.
27+
28+
<span id="group__QkDag_1autotoc_md50" />
29+
30+
#### Example
31+
32+
```c
33+
QkDag *empty = qk_dag_new();
34+
```
35+
36+
**Returns**
37+
38+
A pointer to the created DAG.
39+
</Function>
40+
41+
### qk\_dag\_add\_quantum\_register
42+
43+
<Function id="qk_dag_add_quantum_register" signature="void qk_dag_add_quantum_register(QkDag *dag, const QkQuantumRegister *reg)">
44+
Add a quantum register to the DAG.
45+
46+
<span id="group__QkDag_1autotoc_md51" />
47+
48+
#### Example
49+
50+
```c
51+
QkDag *dag = qk_dag_new();
52+
QkQuantumRegister *qr = qk_quantum_register_new(1024, "my_register");
53+
qk_dag_add_quantum_register(dag, qr);
54+
qk_quantum_register_free(qr);
55+
qk_dag_free(dag);
56+
```
57+
58+
<span id="group__QkDag_1autotoc_md52" />
59+
60+
#### Safety
61+
62+
<span id="group__QkDag_1autotoc_md52" />
63+
64+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag` and if `reg` is not a valid, non-null pointer to a `QkQuantumRegister`.
65+
66+
**Parameters**
67+
68+
* **dag** – A pointer to the DAG.
69+
* **reg** – A pointer to the quantum register.
70+
</Function>
71+
72+
### qk\_dag\_add\_classical\_register
73+
74+
<Function id="qk_dag_add_classical_register" signature="void qk_dag_add_classical_register(QkDag *dag, const QkClassicalRegister *reg)">
75+
Add a classical register to the DAG.
76+
77+
<span id="group__QkDag_1autotoc_md53" />
78+
79+
#### Example
80+
81+
```c
82+
QkDag *dag = qk_dag_new();
83+
QkClassicalRegister *cr = qk_classical_register_new(24, "my_register");
84+
qk_dag_add_classical_register(dag, cr);
85+
qk_classical_register_free(cr);
86+
qk_dag_free(dag);
87+
```
88+
89+
<span id="group__QkDag_1autotoc_md54" />
90+
91+
#### Safety
92+
93+
<span id="group__QkDag_1autotoc_md54" />
94+
95+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag` and if `reg` is not a valid, non-null pointer to a `QkClassicalRegister`.
96+
97+
**Parameters**
98+
99+
* **dag** – A pointer to the DAG.
100+
* **reg** – A pointer to the classical register.
101+
</Function>
102+
103+
### qk\_dag\_num\_qubits
104+
105+
<Function id="qk_dag_num_qubits" signature="uint32_t qk_dag_num_qubits(const QkDag *dag)">
106+
Get the number of qubits the DAG contains.
107+
108+
<span id="group__QkDag_1autotoc_md55" />
109+
110+
#### Example
111+
112+
```c
113+
QkDag *dag = qk_dag_new();
114+
QkQuantumRegister *qr = qk_quantum_register_new(24, "my_register");
115+
qk_dag_add_quantum_register(dag, qr);
116+
uint32_t num_qubits = qk_dag_num_qubits(dag); // num_qubits==24
117+
qk_quantum_register_free(qr);
118+
qk_dag_free(dag);
119+
```
120+
121+
<span id="group__QkDag_1autotoc_md56" />
122+
123+
#### Safety
124+
125+
<span id="group__QkDag_1autotoc_md56" />
126+
127+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
128+
129+
**Parameters**
130+
131+
**dag** – A pointer to the DAG.
132+
133+
**Returns**
134+
135+
The number of qubits the DAG is defined on.
136+
</Function>
137+
138+
### qk\_dag\_num\_clbits
139+
140+
<Function id="qk_dag_num_clbits" signature="uint32_t qk_dag_num_clbits(const QkDag *dag)">
141+
Get the number of clbits the DAG contains.
142+
143+
<span id="group__QkDag_1autotoc_md57" />
144+
145+
#### Example
146+
147+
```c
148+
QkDag *dag = qk_dag_new();
149+
QkClassicalRegister *cr = qk_classical_register_new(24, "my_register");
150+
qk_dag_add_classical_register(dag, cr);
151+
uint32_t num_clbits = qk_dag_num_clbits(dag); // num_clbits==24
152+
qk_classical_register_free(cr);
153+
qk_dag_free(dag);
154+
```
155+
156+
<span id="group__QkDag_1autotoc_md58" />
157+
158+
#### Safety
159+
160+
<span id="group__QkDag_1autotoc_md58" />
161+
162+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
163+
164+
**Parameters**
165+
166+
**dag** – A pointer to the DAG.
167+
168+
**Returns**
169+
170+
The number of clbits the DAG is defined on.
171+
</Function>
172+
173+
### qk\_dag\_free
174+
175+
<Function id="qk_dag_free" signature="void qk_dag_free(QkDag *dag)">
176+
Free the DAG.
177+
178+
<span id="group__QkDag_1autotoc_md59" />
179+
180+
#### Example
181+
182+
```c
183+
QkDag *dag = qk_dag_new();
184+
qk_dag_free(dag);
185+
```
186+
187+
<span id="group__QkDag_1autotoc_md60" />
188+
189+
#### Safety
190+
191+
<span id="group__QkDag_1autotoc_md60" />
192+
193+
Behavior is undefined if `dag` is not either null or a valid pointer to a `QkDag`.
194+
195+
**Parameters**
196+
197+
**dag** – A pointer to the DAG to free.
198+
</Function>
199+

docs/api/qiskit-c/dev/qk-obs-term.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This is a group of functions for interacting with an opaque (Rust-space) SparseT
6666
<Function id="qk_obsterm_str" signature="char *qk_obsterm_str(const QkObsTerm *term)">
6767
Return a string representation of the sparse term.
6868

69-
<span id="group__QkObsTerm_1autotoc_md142" />
69+
<span id="group__QkObsTerm_1autotoc_md153" />
7070

7171
#### Example
7272

@@ -78,11 +78,11 @@ This is a group of functions for interacting with an opaque (Rust-space) SparseT
7878
qk_str_free(string);
7979
```
8080
81-
<span id="group__QkObsTerm_1autotoc_md143" />
81+
<span id="group__QkObsTerm_1autotoc_md154" />
8282
8383
#### Safety
8484
85-
<span id="group__QkObsTerm_1autotoc_md143" />
85+
<span id="group__QkObsTerm_1autotoc_md154" />
8686
8787
Behavior is undefined `term` is not a valid, non-null pointer to a `QkObsTerm`.
8888

0 commit comments

Comments
 (0)