You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: docs/api/qiskit-c/dev/index.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,9 @@ As this interface is still new in Qiskit it should be considered experimental an
34
34
35
35
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.
@@ -82,7 +82,7 @@ The circuit C API currently only supports creating circuits that contain operati
82
82
83
83
This struct represents the data contained in an individual instruction in a `QkCircuit`. It is not a pointer to the underlying object, but contains a copy of the properties of the instruction for inspection.
84
84
85
-
#### const char \*name
85
+
#### char \*name
86
86
87
87
<Attribute id="name">
88
88
The instruction name
@@ -202,7 +202,7 @@ The circuit C API currently only supports creating circuits that contain operati
@@ -391,7 +391,7 @@ The circuit C API currently only supports creating circuits that contain operati
391
391
392
392
<spanid="group__QkCircuit_1autotoc_md25" />
393
393
394
-
The `qubits` and `params` types are expected to be a pointer to an array of `uint32_t` and `double` respectively where the length is matching the expectations for the standard gate. If the array is insufficently long the behavior of this function is undefined as this will read outside the bounds of the array. It can be a null pointer if there are no qubits or params for a given gate. You can check `qk_gate_num_qubits` and `qk_gate_num_params` to determine how many qubits and params are required for a given gate.
394
+
The `qubits` and `params` types are expected to be a pointer to an array of `uint32_t` and `double` respectively where the length is matching the expectations for the standard gate. If the array is insufficiently long the behavior of this function is undefined as this will read outside the bounds of the array. It can be a null pointer if there are no qubits or params for a given gate. You can check `qk_gate_num_qubits` and `qk_gate_num_params` to determine how many qubits and params are required for a given gate.
395
395
396
396
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`.
397
397
@@ -562,17 +562,16 @@ The circuit C API currently only supports creating circuits that contain operati
@@ -607,7 +606,7 @@ The circuit C API currently only supports creating circuits that contain operati
607
606
608
607
```c
609
608
QkCircuit *qc = qk_circuit_new(100, 0);
610
-
uint32_tqubit[1] = {0};
609
+
uint32_tqubits[1] = {0};
611
610
qk_circuit_gate(qc, QkGate_H, qubits, NULL);
612
611
QkOpCounts counts = qk_circuit_count_ops(qc);
613
612
```
@@ -669,16 +668,19 @@ The circuit C API currently only supports creating circuits that contain operati
669
668
670
669
This function is used to get the instruction details for a given instruction in the circuit.
671
670
671
+
This function allocates memory internally for the provided `QkCircuitInstruction` and thus you are responsible for calling `qk_circuit_instruction_clear` to free it.
672
+
672
673
<spanid="group__QkCircuit_1autotoc_md40" />
673
674
674
675
#### Example
675
676
676
677
```c
677
678
QkCircuitInstruction inst;
678
-
QkCircuit *qc = qk_circuit_new(100);
679
+
QkCircuit *qc = qk_circuit_new(100, 0);
679
680
uint32_t qubit[1] = {0};
680
681
qk_circuit_gate(qc, QkGate_H, qubit, NULL);
681
682
qk_circuit_get_instruction(qc, 0, &inst);
683
+
qk_circuit_instruction_clear(&inst);
682
684
```
683
685
684
686
<span id="group__QkCircuit_1autotoc_md41" />
@@ -698,7 +700,7 @@ The circuit C API currently only supports creating circuits that contain operati
This function doesn’t free the allocation for the provided `QkCircuitInstruction` pointer, it only frees the internal allocations for the data contained in the instruction. You are responsible for allocating and freeing the actual allocation used to store a `QkCircuitInstruction`.
@@ -709,12 +711,12 @@ The circuit C API currently only supports creating circuits that contain operati
A common way to instantiate several bits at once is to create a register. A register is a named collection of bits. Creating a register enables giving a collection of bits a name which can be use as metadata around specific bits in a circuit. This name will also typically be preseserved when exporting the circuit to interchange languages.
15
+
A common way to instantiate several bits at once is to create a register. A register is a named collection of bits. Creating a register enables giving a collection of bits a name which can be use as metadata around specific bits in a circuit. This name will also typically be preserved when exporting the circuit to interchange languages.
16
16
17
17
You can create a register by calling `qk_classical_register_new()`, for example:
Copy file name to clipboardExpand all lines: docs/api/qiskit-c/dev/qk-complex-64.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ python_api_name: QkComplex64
8
8
9
9
# QkComplex64
10
10
11
-
A complex, double-precision number representation. This data type is used to safely use complex numbers within Qiskit, but is not necessarily designed for easy manipulation on user-side. Instead, we provide functions to convert from compiler-native representation (e.g. `double complex` for GNU or Clang compilers), which allow for ergonomic handling, to Qiskit’s `QkComplex64` representation, which is meant for passing into Qiskit functions and structs.
11
+
A complex, double-precision number representation. This data type is used to safely use complex numbers within Qiskit, but is not necessarily designed for easy manipulation on user-side. Instead, we provide functions to convert from compiler-native representation (e.g. `complex double` for GNU or Clang compilers), which allow for ergonomic handling, to Qiskit’s `QkComplex64` representation, which is meant for passing into Qiskit functions and structs.
12
12
13
13
Explicitly, Qiskit assumes the compiler-native complex number type in C to be `_Dcomplex` for Windows MSVC (if `_MSC_VER` is defined) and `double _Complex` otherwise. In C++ (if `__cplusplus` is defined), the complex number type is always `std::complex<double>`.
14
14
@@ -38,11 +38,11 @@ Convert a `QkComplex64` to a compiler-native complex number representation. Note
38
38
39
39
### Example
40
40
41
-
Assuming a GNU/clang compiler with `double complex` as native complex number, we have
41
+
Assuming a GNU/clang compiler with `complex double` as native complex number, we have
42
42
43
43
```c
44
44
QkComplex64 qk_value = {1, 1}; // represents 1 + i
45
-
double complex value = qk_complex64_to_native(&qk_value);
45
+
complex double value = qk_complex64_to_native(&qk_value);
46
46
```
47
47
48
48
### Safety
@@ -65,10 +65,10 @@ Convert a compiler-native complex number to a `QkComplex64`. Note that `CMPLX_DO
65
65
66
66
### Example
67
67
68
-
Assuming a GNU/clang compiler with `double complex` as native complex number, we have
68
+
Assuming a GNU/clang compiler with `complex double` as native complex number, we have
When running the `qk_transpiler_pass_standalone_elide_permutations` function it returns a modified circuit and a permutation array as a QkElidePermutationsResult object. This object contains the outcome of the transpiler pass, whether the pass was able to elide any gates or not, and what the results of that elision were.
Behavior is undefined if `result` is not a valid, non-null pointer to a `QkElidePermutationsResult`. The pointer to the returned circuit is owned by the result object, it should not be passed to `qk_circuit_free()` as it will be freed by `qk_elide_permutations_result_free()`.
53
+
54
+
**Parameters**
55
+
56
+
**result** – a pointer to the result of the pass. It must have elided gates as checked by `qk_elide_permutations_result_elided_gates()`
57
+
58
+
**Returns**
59
+
60
+
A pointer to the circuit with the permutation gates elided
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkElidePermutationsResult`. Also qubit must be a valid qubit for the circuit and there must be a result found. The pointer to the permutation array is owned by the result object, it should not be passed to `free()` as it will be freed by `qk_elide_permutations_result_free()` when that is called.
75
+
76
+
**Parameters**
77
+
78
+
**result** – a pointer to the result of the pass. It must have elided gates as checked by `qk_elide_permutations_result_elided_gates()`
79
+
80
+
**Returns**
81
+
82
+
A pointer to the permutation array caused by the swap elision performed by the pass. This array has a length equal to the number of qubits of the circuit returned by `qk_elide_permutations_result_elided_gates()` (or the circuit passed into `qk_transpiler_pass_standalone_elide_permutations()`). The permutation array maps the virtual qubit in the original circuit at each index to its new output position after all the elision performed by the pass. For example, and array of `[2, 1, 0]` means that qubit 0 is now in qubit 2 on the output of the circuit and qubit 2’s is now at 0 (qubit 1 remains unchanged)
0 commit comments