Skip to content

Commit 9e4fa18

Browse files
committed
Merge branch 'main' of github.com:Qiskit/documentation into audit-2.1
2 parents dbfaa2a + e067431 commit 9e4fa18

File tree

1,956 files changed

+205355
-6088
lines changed

Some content is hidden

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

1,956 files changed

+205355
-6088
lines changed

.github/ISSUE_TEMPLATE/courses.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: (COURSES 🎓) Report a bug/typo or request new content
22
description: Report typos, bugs, out-of-date content, broken links, etc. or make a request for new content
33
labels: ["content 📄", "course 🎓", "needs triage 🤔"]
44
assignees:
5-
- jhwatrous
65
- livlanes
76
- christopherporter1
87
- docs-content-team

.github/workflows/notebook-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
docs/guides/transpiler-stages.ipynb
4848
docs/guides/represent-quantum-computers.ipynb
4949
docs/guides/common-parameters.ipynb
50+
docs/guides/DAG-representation.ipynb
5051
""".strip().split("\n")
5152
import os
5253
github_output = os.getenv("GITHUB_OUTPUT")

ImageMagick.tar.gz

-15.1 MB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "qiskit-c",
3+
"version": "2.0.3"
4+
}

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"title": "Qiskit SDK C API",
3+
"children": [
4+
{
5+
"title": "API index",
6+
"url": "/docs/api/qiskit-c/2.0"
7+
},
8+
{
9+
"title": "QkBitTerm",
10+
"url": "/docs/api/qiskit-c/2.0/qk-bit-term"
11+
},
12+
{
13+
"title": "QkExitCode",
14+
"url": "/docs/api/qiskit-c/2.0/qk-exit-code"
15+
},
16+
{
17+
"title": "QkObs",
18+
"url": "/docs/api/qiskit-c/2.0/qk-obs"
19+
},
20+
{
21+
"title": "QkObsTerm",
22+
"url": "/docs/api/qiskit-c/2.0/qk-obs-term"
23+
},
24+
{
25+
"title": "Release notes",
26+
"url": "/docs/api/qiskit/release-notes"
27+
}
28+
],
29+
"collapsed": true
30+
}

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Qiskit SDK C API API documentation (v2.0)
3+
description: Index of all the modules in qiskit-c v2.0.
4+
---
5+
6+
<span id="qiskit-c-api-qiskit-h" />
7+
8+
# Qiskit C API (`qiskit.h`)
9+
10+
The Qiskit C API is a low level interface to the core data model of Qiskit. It is designed to provide a high performance interface to Qiskit for compiled languages and provides a defined ABI to the internal Rust data model that is used to create the Python API. There are two expected modes of operation for the C API:
11+
12+
* A standalone shared library for creating and working with Qiskit objects from compiled languages without a runtime dependency on Python, and
13+
* For building Python extensions that are using Qiskit but interface directly with the Rust objects from the extension code without using Python for better performance.
14+
15+
To get started, see [Install the Qiskit C API](/docs/guides/install-c-api). To combine the C API with custom Python extensions, see [Extend Qiskit in Python with C](/docs/guides/c-extension-for-python).
16+
17+
As this interface is still new in Qiskit it should be considered experimental and the interface might change between minor version releases.
18+
19+
## Quantum information
20+
21+
* [QkObs](qk-obs)
22+
* [QkObsTerm](qk-obs-term)
23+
* [QkBitTerm](qk-bit-term)
24+
* [QkExitCode](qk-exit-code)
25+
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: QkBitTerm (v2.0)
3+
description: API reference for QkBitTerm in qiskit-c v2.0
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: QkBitTerm
7+
---
8+
9+
# QkBitTerm
10+
11+
```c
12+
enum QkBitTerm
13+
```
14+
15+
An enum that to represent each of the single-qubit alphabet terms enumerated below.
16+
17+
## Values
18+
19+
* **`QkBitTerm_X`**
20+
21+
The Pauli $X$ operator.
22+
23+
Value: 2 (`0b0010`)
24+
25+
* **`QkBitTerm_Y`**
26+
27+
The Pauli $Y$ operator.
28+
29+
Value: 3 (`0b0011`)
30+
31+
* **`QkBitTerm_Z`**
32+
33+
The Pauli $Z$ operator.
34+
35+
Value: 1 (`0b0001`)
36+
37+
* **`QkBitTerm_Plus`**
38+
39+
The projector $\lvert +\rangle\langle +\rvert$ to the positive $X$ eigenstate.
40+
41+
Value: 10 (`0b1010`)
42+
43+
* **`QkBitTerm_Minus`**
44+
45+
The projector $\lvert -\rangle\langle -\rvert$ to the negative $X$ eigenstate.
46+
47+
Value: 6 (`0b0110`)
48+
49+
* **`QkBitTerm_Right`**
50+
51+
The projector $\lvert r\rangle\langle r\rvert$ to the positive $Y$ eigenstate.
52+
53+
Value: 11 (`0b1011`)
54+
55+
* **`QkBitTerm_Left`**
56+
57+
The projector $\lvert l\rangle\langle l\rvert$ to the negative $Y$ eigenstate.
58+
59+
Value: 7 (`0b0111`)
60+
61+
* **`QkBitTerm_Zero`**
62+
63+
The projector $\lvert 0\rangle\langle 0\rvert$ to the positive $Z$ eigenstate.
64+
65+
Value: 9 (`0b1001`)
66+
67+
* **`QkBitTerm_One`**
68+
69+
The projector $\lvert 1\rangle\langle 1\rvert$ to the negative $Z$ eigenstate.
70+
71+
Value: 5 (`0b0101`)
72+
73+
## Representation
74+
75+
The enum is stored as single byte, its elements are represented as unsigned 8-bit integer.
76+
77+
```c
78+
typedef uint8_t QkBitTerm
79+
```
80+
81+
<Admonition title="Warning" type="caution">
82+
Not all `uint8_t` values are valid bit terms. Passing invalid values is undefined behavior.
83+
</Admonition>
84+
85+
The numeric structure of these is that they are all four-bit values of which the low two bits are the (phase-less) symplectic representation of the Pauli operator related to the object, where the low bit denotes a contribution by $Z$ and the second lowest a contribution by $X$, while the upper two bits are `00` for a Pauli operator, `01` for the negative-eigenstate projector, and `10` for the positive-eigenstate projector.
86+
87+
## Functions
88+
89+
### qk\_bitterm\_label
90+
91+
<Function id="qk_bitterm_label" signature="uint8_t qk_bitterm_label(QkBitTerm bit_term)">
92+
Get the label for a bit term.
93+
94+
<span id="group__QkBitTerm_1autotoc_md46" />
95+
96+
#### Example
97+
98+
```c
99+
QkBitTerm bit_term = QkBitTerm_Y;
100+
// cast the uint8_t to char
101+
char label = qk_bitterm_label(bit_term);
102+
```
103+
104+
<span id="group__QkBitTerm_1autotoc_md47" />
105+
106+
#### Safety
107+
108+
<span id="group__QkBitTerm_1autotoc_md47" />
109+
110+
The behavior is undefined if `bit_term` is not a valid `uint8_t` value of a `QkBitTerm`.
111+
112+
**Parameters**
113+
114+
**bit\_term** – The bit term.
115+
116+
**Returns**
117+
118+
The label as `uint8_t`, which can be cast to `char` to obtain the character.
119+
</Function>
120+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: QkExitCode (v2.0)
3+
description: API reference for QkExitCode in qiskit-c v2.0
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: QkExitCode
7+
---
8+
9+
# QkExitCode
10+
11+
```c
12+
enum QkExitCode
13+
```
14+
15+
Function exit codes.
16+
17+
## Values
18+
19+
* **`QkExitCode_Success`**
20+
21+
Success.
22+
23+
Value: 0
24+
25+
* **`QkExitCode_CInputError`**
26+
27+
Error related to data input.
28+
29+
Value: 100
30+
31+
* **`QkExitCode_NullPointerError`**
32+
33+
Unexpected null pointer.
34+
35+
Value: 101
36+
37+
* **`QkExitCode_AlignmentError`**
38+
39+
Pointer is not aligned to expected data.
40+
41+
Value: 102
42+
43+
* **`QkExitCode_IndexError`**
44+
45+
Index out of bounds.
46+
47+
Value: 103
48+
49+
* **`QkExitCode_ArithmeticError`**
50+
51+
Error related to arithmetic operations or similar.
52+
53+
Value: 200
54+
55+
* **`QkExitCode_MismatchedQubits`**
56+
57+
Mismatching number of qubits.
58+
59+
Value: 201
60+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: QkObsTerm (v2.0)
3+
description: API reference for QkObsTerm in qiskit-c v2.0
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: QkObsTerm
7+
---
8+
9+
# QkObsTerm
10+
11+
This is a group of functions for interacting with an opaque (Rust-space) SparseTerm instance.
12+
13+
## Data types
14+
15+
### QkObsTerm
16+
17+
<Class id="QkObsTerm" signature="struct QkObsTerm">
18+
A term in a `QkObs`.
19+
20+
This contains the coefficient (`coeff`), the number of qubits of the observable (`num_qubits`) and pointers to the `bit_terms` and `indices` arrays, which have length `len`. It’s the responsibility of the user that the data is coherent, see also the below section on safety.
21+
22+
<span id="structQkObsTerm_1autotoc_md2" />
23+
24+
#### Safety
25+
26+
<span id="structQkObsTerm_1autotoc_md2" />
27+
28+
* `bit_terms` must be a non-null, aligned pointer to `len` elements of type `QkBitTerm`.
29+
* `indices` must be a non-null, aligned pointer to `len` elements of type `uint32_t`.
30+
31+
#### QkComplex64 coeff
32+
33+
<Attribute id="coeff">
34+
The coefficient of the observable term.
35+
</Attribute>
36+
37+
#### uintptr\_t len
38+
39+
<Attribute id="len">
40+
Length of the `bit_terms` and `indices` arrays.
41+
</Attribute>
42+
43+
#### QkBitTerm \*bit\_terms
44+
45+
<Attribute id="bit_terms">
46+
A non-null, aligned pointer to `len` elements of type `QkBitTerm`.
47+
</Attribute>
48+
49+
#### uint32\_t \*indices
50+
51+
<Attribute id="indices">
52+
A non-null, aligned pointer to `len` elements of type `uint32_t`.
53+
</Attribute>
54+
55+
#### uint32\_t num\_qubits
56+
57+
<Attribute id="num_qubits">
58+
The number of qubits the observable term is defined on.
59+
</Attribute>
60+
</Class>
61+
62+
## Functions
63+
64+
### qk\_obsterm\_str
65+
66+
<Function id="qk_obsterm_str" signature="char *qk_obsterm_str(const QkObsTerm *term)">
67+
Return a string representation of the sparse term.
68+
69+
<span id="group__QkObsTerm_1autotoc_md44" />
70+
71+
#### Example
72+
73+
```c
74+
QkObs *obs = qk_obs_identity(100);
75+
QkObsTerm term;
76+
qk_obs_term(obs, 0, &term);
77+
char *string = qk_obsterm_str(&term);
78+
qk_str_free(string);
79+
```
80+
81+
<span id="group__QkObsTerm_1autotoc_md45" />
82+
83+
#### Safety
84+
85+
<span id="group__QkObsTerm_1autotoc_md45" />
86+
87+
Behavior is undefined `term` is not a valid, non-null pointer to a `QkObsTerm`.
88+
89+
The string must not be freed with the normal C free, you must use `qk_str_free` to free the memory consumed by the String. Not calling `qk_str_free` will lead to a memory leak.
90+
91+
Do not change the length of the string after it’s returned, although values can be mutated.
92+
93+
**Parameters**
94+
95+
**term** – A pointer to the term.
96+
97+
**Returns**
98+
99+
The function exit code. This is `>0` if reading the term failed.
100+
</Function>
101+

0 commit comments

Comments
 (0)