diff --git a/docs/api/qiskit-c/dev/qk-bit-term.mdx b/docs/api/qiskit-c/dev/qk-bit-term.mdx
index d7ce65aa8551..ab2742f6debd 100644
--- a/docs/api/qiskit-c/dev/qk-bit-term.mdx
+++ b/docs/api/qiskit-c/dev/qk-bit-term.mdx
@@ -93,7 +93,7 @@ The numeric structure of these is that they are all four-bit values of which the
Get the label for a bit term.
-
+
#### Example
@@ -103,11 +103,11 @@ The numeric structure of these is that they are all four-bit values of which the
char label = qk_bitterm_label(bit_term);
```
-
+
#### Safety
-
+
The behavior is undefined if `bit_term` is not a valid `uint8_t` value of a `QkBitTerm`.
diff --git a/docs/api/qiskit-c/dev/qk-circuit-library.mdx b/docs/api/qiskit-c/dev/qk-circuit-library.mdx
index 6d1af9a02bd3..eb04555b9aa7 100644
--- a/docs/api/qiskit-c/dev/qk-circuit-library.mdx
+++ b/docs/api/qiskit-c/dev/qk-circuit-library.mdx
@@ -123,6 +123,94 @@ The Qiskit circuit library contains functions and higher-level building blocks f
A newly allocated `QkCircuit*` (caller must free with `qk_circuit_free`).
+### qk\_circuit\_library\_n\_local
+
+
+ Construct an n-local variational circuit.
+
+ The structure of the n-local circuit are alternating rotation and entanglement layers. In both layers, parameterized circuit-blocks act on the circuit in a defined way. In the rotation layer, the blocks are applied stacked on top of each other, while in the entanglement layer according to the `entanglement` strategy. The circuit blocks can have arbitrary sizes (smaller equal to the number of qubits in the circuit). Each layer is repeated `reps` times, and by default a final rotation layer is appended.
+
+ For instance, a rotation block on 2 qubits and an entanglement block on 4 qubits using `QkEntanglementStrategy_Linear` entanglement yields the following circuit.
+
+ ```c
+ ┌──────┐ ░ ┌──────┐ ░ ┌──────┐
+ ┤0 ├─░─┤0 ├──────────────── ... ─░─┤0 ├
+ │ Rot │ ░ │ │┌──────┐ ░ │ Rot │
+ ┤1 ├─░─┤1 ├┤0 ├──────── ... ─░─┤1 ├
+ ├──────┤ ░ │ Ent ││ │┌──────┐ ░ ├──────┤
+ ┤0 ├─░─┤2 ├┤1 ├┤0 ├ ... ─░─┤0 ├
+ │ Rot │ ░ │ ││ Ent ││ │ ░ │ Rot │
+ ┤1 ├─░─┤3 ├┤2 ├┤1 ├ ... ─░─┤1 ├
+ ├──────┤ ░ └──────┘│ ││ Ent │ ░ ├──────┤
+ ┤0 ├─░─────────┤3 ├┤2 ├ ... ─░─┤0 ├
+ │ Rot │ ░ └──────┘│ │ ░ │ Rot │
+ ┤1 ├─░─────────────────┤3 ├ ... ─░─┤1 ├
+ └──────┘ ░ └──────┘ ░ └──────┘
+
+ | |
+ +---------------------------------+
+ repeated reps times
+ ```
+
+ Entanglement:
+
+ The entanglement describes the connections of the gates in the entanglement layer. For a two-qubit gate for example, the entanglement contains pairs of qubits on which the gate should acts, e.g. `[[ctrl0, target0], [ctrl1, target1], ...]`. To know more about the available entanglement strategies see `QkEntanglementStrategy`.
+
+
+
+ #### Example
+
+ ```c
+ size_t num_qubits = 2;
+ QkGate rotation_blocks[1] = {QkGate_H};
+ QkGate entanglement_blocks[1] = {QkGate_CRX};
+
+ QkNLocalSettings settings = qk_circuit_library_n_local_settings_default();
+ settings.reps = 2;
+ // For this example we use QkEntanglementStrategy_Linear since
+ // the default is QkEntanglementStrategy_Full
+ settings.entanglement_strategy = QkEntanglementStrategy_Linear;
+
+ QkCircuit *qc = qk_circuit_library_n_local(num_qubits, rotation_blocks, 1,
+ entanglement_blocks, 1, &settings);
+
+ qk_circuit_free(qc);
+ ```
+
+
+
+ #### Safety
+
+
+
+ * Behavior is undefined if `rotation_blocks` is not a valid, non-null pointer to a sequence of `rotation_blocks_size` consecutive elements of `StandardGate`.
+ * Behavior is undefined if `entanglement_blocks` is not a valid, non-null pointer to a sequence of `entanglement_blocks_size` consecutive elements of `StandardGate`.
+ * Behavior is undefined if `settings` is not a valid, non-null pointer.
+
+ **Parameters**
+
+ * **num\_qubits** – The number of qubits of the circuit.
+ * **rotation\_blocks** – The blocks used in the rotation layers.
+ * **rotation\_blocks\_size** – Length of the array of rotation blocks provided.
+ * **entanglement\_blocks** – The blocks used in the entanglement layers.
+ * **entanglement\_blocks\_size** – Length of the list of entanglement blocks provided.
+ * **settings** – A `QkNLocalSettings` pointer that is the settings to be applied to the generated circuit. If `NULL`, the default settings are used, see `QkNLocalSettings` for more details.
+
+ **Returns**
+
+ A pointer to the generated circuit.
+
+
+### qk\_circuit\_library\_n\_local\_settings\_default
+
+
+ Generate default options for `qk_circuit_library_n_local`.
+
+ **Returns**
+
+ A `QkNLocalSettings` object with default settings.
+
+
### qk\_pauli\_product\_rotation\_clear
@@ -130,7 +218,7 @@ The Qiskit circuit library contains functions and higher-level building blocks f
This frees the memory of the `z` and `x` arrays and frees the `angle`. This function should only be called for `QkPauliProductRotation` objects whose data has been populated by Rust.
-
+
#### Example
@@ -158,11 +246,11 @@ The Qiskit circuit library contains functions and higher-level building blocks f
qk_param_free(angle);
```
-
+
#### Safety
-
+
Behavior is undefined if `inst` is not a valid, non-null pointer to a `QkPauliProductRotation`, or if the internal data of `QkPauliProductRotation` is incoherent.
@@ -178,7 +266,7 @@ The Qiskit circuit library contains functions and higher-level building blocks f
This frees the memory of the `z` and `x` arrays. This function should only be called for `QkPauliProductMeasurement` objects whose data has been populated by Rust.
-
+
#### Example
@@ -205,11 +293,11 @@ The Qiskit circuit library contains functions and higher-level building blocks f
// since this data is allocated by C, we do not call `qk_pauli_product_measurement_clear(&inst)`
```
-
+
#### Safety
-
+
Behavior is undefined if `inst` is not a valid, non-null pointer to a `QkPauliProductMeasurement`, or if the internal data of `QkPauliProductMeasurement` is incoherent.
@@ -229,7 +317,7 @@ The Qiskit circuit library contains functions and higher-level building blocks f
\[1] A. Cross et al. Validating quantum computers using randomized model circuits, Phys. Rev. A 100, 032328 (2019). [arXiv:1811.12926](https://arxiv.org/abs/1811.12926)
-
+
#### Example
@@ -255,7 +343,7 @@ The Qiskit circuit library contains functions and higher-level building blocks f
The Suzuki-Trotter formulas improve the error of the Lie-Trotter approximation. In this implementation, the operators are provided as sum terms of a Pauli operator. Higher order decompositions are based on recursions, see Ref. \[1] for more details.
-
+
#### Example
@@ -276,19 +364,19 @@ The Qiskit circuit library contains functions and higher-level building blocks f
qk_circuit_free(qc);
```
-
+
#### Safety
-
+
Behavior is undefined `op` is not a valid, non-null pointer to a `QkObs`.
-
+
#### References
-
+
\[1]: D. Berry, G. Ahokas, R. Cleve and B. Sanders, “Efficient quantum algorithms for simulating sparse Hamiltonians” (2006). [arXiv:quant-ph/0508139](https://arxiv.org/abs/quant-ph/0508139)
diff --git a/docs/api/qiskit-c/dev/qk-classical-expressions.mdx b/docs/api/qiskit-c/dev/qk-classical-expressions.mdx
index 060bd8b6c66b..4146016448b4 100644
--- a/docs/api/qiskit-c/dev/qk-classical-expressions.mdx
+++ b/docs/api/qiskit-c/dev/qk-classical-expressions.mdx
@@ -474,7 +474,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Return the kind of a classical expression node.
-
+
#### Example
@@ -482,11 +482,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
QKExprNodeKind kind = qk_expr_kind(expr);
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -506,7 +506,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a binary expression node.
-
+
#### Example
@@ -516,11 +516,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkExprNode *rhs = info.right;
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -540,7 +540,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a unary expression node.
-
+
#### Example
@@ -549,11 +549,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
QkUnaryOpType op = info.op;
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -573,7 +573,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a cast expression node.
-
+
#### Example
@@ -582,11 +582,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkExprNode *operand = info.operand;
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -606,7 +606,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to an index expression node.
-
+
#### Example
@@ -616,11 +616,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkExprNode *index = info.index;
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -640,7 +640,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a value expression node.
-
+
#### Example
@@ -648,11 +648,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkValue *value = qk_expr_as_value(expr);
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -672,7 +672,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a variable expression node.
-
+
#### Example
@@ -680,11 +680,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkVar *var = qk_expr_as_var(expr);
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -704,7 +704,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `expr` does not point to a stretch expression node.
-
+
#### Example
@@ -712,11 +712,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
const QkStretch *stretch = qk_expr_as_stretch(expr);
```
-
+
#### Safety
-
+
Behavior is undefined if `expr` is not a valid, non-null pointer to a `QkExprNode`.
@@ -734,7 +734,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Return the type information of a value.
-
+
#### Example
@@ -742,11 +742,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
QkExprTypeInfo type_info = qk_value_type_info(value);
```
-
+
#### Safety
-
+
Behavior is undefined if `value` is not a valid, non-null pointer to a `Value`.
@@ -766,7 +766,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `value` does not point to a duration value.
-
+
#### Example
@@ -774,11 +774,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
QkDurationInfo info = qk_value_duration_info(value);
```
-
+
#### Safety
-
+
Behavior is undefined if `value` is not a valid, non-null pointer to a `QkValue`.
@@ -798,7 +798,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `value` does not point to a float value.
-
+
#### Example
@@ -806,11 +806,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
double raw = qk_value_float(value);
```
-
+
#### Safety
-
+
Behavior is undefined if `value` is not a valid, non-null pointer to a `QkValue`.
@@ -832,7 +832,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `value` does not point to a `QkExprType_Uint` value or if the stored integer does not fit in `uint64_t`.
-
+
#### Example
@@ -840,11 +840,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
uint64_t raw = qk_value_uint(value);
```
-
+
#### Safety
-
+
Behavior is undefined if `value` is not a valid, non-null pointer to a `QkValue`.
@@ -864,7 +864,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `value` does not point to a bool value.
-
+
#### Example
@@ -872,11 +872,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
bool raw = qk_value_bool(value);
```
-
+
#### Safety
-
+
Behavior is undefined if `value` is not a valid, non-null pointer to a `QkValue`.
@@ -894,7 +894,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Return the name of a variable as a newly allocated C string.
-
+
#### Example
@@ -906,11 +906,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
}
```
-
+
#### Safety
-
+
Behavior is undefined if `var` is not a valid, non-null pointer to a `QkVar`.
@@ -930,7 +930,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Panics if `var` is a bit variable, which is not yet supported by this API.
-
+
#### Example
@@ -938,11 +938,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
QkExprTypeInfo type_info = qk_var_type_info(var);
```
-
+
#### Safety
-
+
Behavior is undefined if `var` is not a valid, non-null pointer to a `QkVar`.
@@ -960,7 +960,7 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
Return the name of a stretch.
-
+
#### Example
@@ -970,11 +970,11 @@ This union is part of the `QkDurationInfo` struct and should not be used directl
qk_str_free(name);
```
-
+
#### Safety
-
+
Behavior is undefined if `stretch` is not a valid, non-null pointer to a `QkStretch`.
diff --git a/docs/api/qiskit-c/dev/qk-control-flow.mdx b/docs/api/qiskit-c/dev/qk-control-flow.mdx
index ed65101ffaa3..b965dfc26535 100644
--- a/docs/api/qiskit-c/dev/qk-control-flow.mdx
+++ b/docs/api/qiskit-c/dev/qk-control-flow.mdx
@@ -289,7 +289,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Get the kind of a control flow instruction.
-
+
#### Example
@@ -321,11 +321,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -343,7 +343,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Get the number of circuit blocks in a control flow instruction.
-
+
#### Example
@@ -356,11 +356,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -380,7 +380,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Control flow instructions contain one or more circuit blocks (e.g., IfElse has two blocks, Switch may have multiple blocks). This function retrieves a specific block by index.
-
+
#### Example
@@ -391,11 +391,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Process the true and false blocks...
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -416,7 +416,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Returns a pointer to an array that maps the qubits used in the control flow instruction’s blocks to their indices in the top-level circuit. The array length equals the number of qubits used by the control flow instruction. For each qubit index `i` in the nested block, the mapping at index `i` in the array gives the corresponding qubit index in the top-level circuit.
-
+
#### Example
@@ -429,11 +429,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -453,7 +453,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Returns a pointer to an array that maps the classical bits used in the control flow instruction’s blocks to their indices in the top-level circuit. The array length equals the number of classical bits used by the control flow instruction. For each classical bit index `i` in the nested block, the mapping at index `i` in the array gives the corresponding classical bit index in the top-level circuit.
-
+
#### Example
@@ -466,11 +466,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -492,7 +492,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction.
-
+
#### Example
@@ -512,11 +512,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -538,7 +538,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction, or if the condition is not a bit type.
-
+
#### Example
@@ -548,11 +548,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Condition: clbit[%u] == %s\n", bit_info.clbit, bit_info.condition ? "true" : "false");
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -574,7 +574,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction, or if the condition is not a register type.
-
+
#### Example
@@ -584,11 +584,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Register bit width: %lu\n", bit_width);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -610,7 +610,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction, or if the condition is not a register type.
-
+
#### Example
@@ -620,11 +620,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Use the classical register pointer
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -646,7 +646,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction, if the condition is not a register type, or if the condition value does not fit in a `uint64_t`.
-
+
#### Example
@@ -656,11 +656,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Expected register value: %lu\n", expected_value);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -682,7 +682,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not an IfElse or While control flow instruction, or if the condition is not an expression type.
-
+
#### Example Usage
@@ -695,11 +695,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -721,7 +721,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Box control flow instruction.
-
+
#### Example
@@ -741,11 +741,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -767,7 +767,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Box control flow instruction with a concrete duration.
-
+
#### Example
@@ -781,11 +781,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -807,7 +807,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Box control flow instruction with an expression duration.
-
+
#### Example
@@ -817,11 +817,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Use the expression to evaluate or analyze the duration...
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -843,7 +843,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction.
-
+
#### Example
@@ -857,11 +857,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -883,7 +883,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction with a list collection.
-
+
#### Example
@@ -895,11 +895,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -921,7 +921,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction with a range collection.
-
+
#### Example
@@ -932,11 +932,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Loop range: start=%ld, stop=%ld, step=%ld\n", start, stop, step);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`, or if any of `out_start`, `out_stop`, or `out_step` are not aligned valid pointers to write to.
@@ -957,7 +957,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction.
-
+
#### Example
@@ -971,11 +971,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -997,7 +997,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction with a Parameter loop parameter.
-
+
#### Example
@@ -1012,11 +1012,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
qk_str_free(symbol_info.name);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1038,7 +1038,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a ForLoop control flow instruction with a Variable loop parameter.
-
+
#### Example
@@ -1048,11 +1048,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Use the loop variable pointer to access variable information
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1074,7 +1074,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction.
-
+
#### Example
@@ -1094,11 +1094,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1120,7 +1120,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction with a classical bit target.
-
+
#### Example
@@ -1130,11 +1130,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Switch operates on clbit %u\n", clbit_idx);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1156,7 +1156,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction with a register target.
-
+
#### Example
@@ -1166,11 +1166,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Use the register to get its name, size, etc...
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1192,7 +1192,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction with an expression target.
-
+
#### Example
@@ -1202,11 +1202,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
// Evaluate the expression...
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1228,7 +1228,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction.
-
+
#### Example
@@ -1240,11 +1240,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1266,7 +1266,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction.
-
+
#### Example
@@ -1279,11 +1279,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
}
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1306,7 +1306,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction.
-
+
#### Example
@@ -1316,11 +1316,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
printf("Maximum bit width for case 0: %lu\n", bit_width);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`.
@@ -1343,7 +1343,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
Panics if `cf_inst` is not a Switch control flow instruction or if a case label does not fit in `uint64_t`.
-
+
#### Example
@@ -1356,11 +1356,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
qk_control_flow_switch_case_labels_clear(&case_labels);
```
-
+
#### Safety
-
+
Behavior is undefined if `cf_inst` is not a valid pointer to a `QkControlFlowInstruction`, or if `out_labels` is not a valid pointer to a `QkSwitchCaseLabels` struct.
@@ -1381,7 +1381,7 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
This function must be called to free the memory allocated by `qk_control_flow_switch_case_labels_uint`. After calling this function, the labels pointer in the struct will be set to null and the count will be set to zero.
-
+
#### Example
@@ -1392,11 +1392,11 @@ The `QkControlFlowInstruction` opaque struct is the primary handle used by the C
qk_control_flow_switch_case_labels_clear(&case_labels);
```
-
+
#### Safety
-
+
Behavior is undefined if `labels` is not a valid pointer to a `QkSwitchCaseLabels`.
diff --git a/docs/api/qiskit-c/dev/qk-dag.mdx b/docs/api/qiskit-c/dev/qk-dag.mdx
index 88f64e47d3fa..1e577f287058 100644
--- a/docs/api/qiskit-c/dev/qk-dag.mdx
+++ b/docs/api/qiskit-c/dev/qk-dag.mdx
@@ -153,7 +153,7 @@ The C API currently only supports building DAGs that contain operations defined
You must free the returned DAG with `qk_dag_free` when done with it.
-
+
#### Example
@@ -171,7 +171,7 @@ The C API currently only supports building DAGs that contain operations defined
Add a quantum register to the DAG.
-
+
#### Example
@@ -183,11 +183,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
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`.
@@ -202,7 +202,7 @@ The C API currently only supports building DAGs that contain operations defined
Add a classical register to the DAG.
-
+
#### Example
@@ -214,11 +214,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
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`.
@@ -233,7 +233,7 @@ The C API currently only supports building DAGs that contain operations defined
Get the number of qubits the DAG contains.
-
+
#### Example
@@ -246,11 +246,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -268,7 +268,7 @@ The C API currently only supports building DAGs that contain operations defined
Get the number of clbits the DAG contains.
-
+
#### Example
@@ -281,11 +281,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -303,7 +303,7 @@ The C API currently only supports building DAGs that contain operations defined
Return the total number of operation nodes in the DAG.
-
+
#### Example
@@ -320,11 +320,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_quantum_register_free(qr);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -344,7 +344,7 @@ The C API currently only supports building DAGs that contain operations defined
This function returns a copy of the DAG’s global phase and the value must be freed via :c:func:`qk_param_free` after usage.
-
+
#### Example
@@ -358,11 +358,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -382,7 +382,7 @@ The C API currently only supports building DAGs that contain operations defined
This function copies the new global phase upon setting it, so the caller retains ownership of the `QkParam` phase, and the value of the phase must be freed via :c:func:`qk_param_free` after setting.
-
+
#### Example
@@ -394,11 +394,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag` and if `phase` is not a valid, non-null pointer to a `QkParam`.
@@ -419,11 +419,11 @@ The C API currently only supports building DAGs that contain operations defined
The result can be used in a switch statement to dispatch proper handling when iterating over nodes of unknown type.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -442,11 +442,11 @@ The C API currently only supports building DAGs that contain operations defined
Retrieve the index of the input node of the wire corresponding to the given qubit.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -465,11 +465,11 @@ The C API currently only supports building DAGs that contain operations defined
Retrieve the index of the output node of the wire corresponding to the given qubit.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -488,11 +488,11 @@ The C API currently only supports building DAGs that contain operations defined
Retrieve the index of the input node of the wire corresponding to the given clbit.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -511,11 +511,11 @@ The C API currently only supports building DAGs that contain operations defined
Retrieve the index of the output node of the wire corresponding to the given clbit.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -534,11 +534,11 @@ The C API currently only supports building DAGs that contain operations defined
Retrieve the value of a wire endpoint node.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -559,11 +559,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not an operation.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -584,11 +584,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not an operation.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -609,11 +609,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not an operation.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -634,11 +634,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not an operation.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -659,11 +659,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not an operation.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -682,7 +682,7 @@ The C API currently only supports building DAGs that contain operations defined
Apply a `QkGate` to the DAG.
-
+
#### Example
@@ -698,11 +698,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_quantum_register_free(qr);
```
-
+
#### Safety
-
+
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.
@@ -726,11 +726,11 @@ The C API currently only supports building DAGs that contain operations defined
Apply a measure to a DAG.
-
+
#### Example
-
+
Measure all qubits into the corresponding clbit index at the end of the circuit.
@@ -741,11 +741,11 @@ The C API currently only supports building DAGs that contain operations defined
}
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not an aligned, non-null pointer to a valid `QkDag`, or if `qubit` or `clbit` are out of range.
@@ -766,11 +766,11 @@ The C API currently only supports building DAGs that contain operations defined
Apply a reset to the DAG.
-
+
#### Examples
-
+
Apply initial resets on all qubits.
@@ -781,11 +781,11 @@ The C API currently only supports building DAGs that contain operations defined
}
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not an aligned, non-null pointer to a valid `QkDag`, or if `qubit` is out of range.
@@ -805,11 +805,11 @@ The C API currently only supports building DAGs that contain operations defined
Apply a barrier to the DAG.
-
+
#### Examples
-
+
Apply a final barrier on all qubits:
@@ -825,11 +825,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_apply_barrier(dag, qubits, num_qubits, true);
```
-
+
#### Safety
-
+
Behavior is undefined if:
@@ -857,11 +857,11 @@ The C API currently only supports building DAGs that contain operations defined
See :[Circuit conventions](/docs/api/qiskit-c/dev/circuit#circuit-conventions) for detail on the bit-labelling and matrix conventions of Qiskit.
-
+
#### Safety
-
+
Behavior is undefined if any of:
@@ -889,7 +889,7 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not a standard gate operation.
-
+
#### Example
@@ -907,11 +907,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_quantum_register_free(qr);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`. If `out_params` is non-NULL, it must point to a buffer large enough to hold all the gate’s params, otherwise behavior is undefined as this function will write beyond its bounds. You can check `qk_dag_op_node_num_params` to determine how many params are required for any given operation node.
@@ -933,11 +933,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if the node is not a unitary gate.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a non-null pointer to a valid `QkDag`, if `out` is unaligned, or if `out` is not valid for `4**num_qubits` writes of `QkComplex64`.
@@ -957,11 +957,11 @@ The C API currently only supports building DAGs that contain operations defined
Panics if `node` is not an operation node.
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -982,7 +982,7 @@ The C API currently only supports building DAGs that contain operations defined
The successors array and its length are returned as a `QkDagNeighbors` struct, where each element in the array corresponds to a DAG node index. You must call the `qk_dag_neighbors_clear` function when done to free the memory allocated for the struct.
-
+
#### Example
@@ -1000,11 +1000,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -1025,7 +1025,7 @@ The C API currently only supports building DAGs that contain operations defined
The predecessors array and its length are returned as a `QkDagNeighbors` struct, where each element in the array corresponds to a DAG node index. You must call the `qk_dag_neighbors_clear` function when done to free the memory allocated for the struct.
-
+
#### Example
@@ -1043,11 +1043,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -1068,11 +1068,11 @@ The C API currently only supports building DAGs that contain operations defined
The function deallocates the memory pointed to by the `neighbors` field and sets it to NULL. It also sets the `num_neighbors` field to 0.
-
+
#### Safety
-
+
Behavior is undefined if `neighbors` is not a valid, non-null pointer to a [QkDagNeighbors](#structqkdagneighbors) object populated with either `qk_dag_successors` or `qk_dag_predecessors`.
@@ -1090,11 +1090,11 @@ The C API currently only supports building DAGs that contain operations defined
You must call `qk_circuit_instruction_clear` to reset the `QkCircuitInstruction` before reusing it or dropping it.
-
+
#### Examples
-
+
Iterate through a DAG to find which qubits have measures on them:
@@ -1117,11 +1117,11 @@ The C API currently only supports building DAGs that contain operations defined
free(measured);
```
-
+
#### Safety
-
+
Behavior is undefined if either `dag` or `instruction` are not valid, aligned, non-null pointers to the relevant data type. The fields of `instruction` need not be initialized.
@@ -1139,7 +1139,7 @@ The C API currently only supports building DAGs that contain operations defined
`other` may include a smaller or equal number of wires for each type.
-
+
#### Example
@@ -1189,11 +1189,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_quantum_register_free(rqr);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `other` are not valid, non-null pointers to a `QkDag`. If `qubit` nor `clbit` are NULL, it must contains a less or equal amount than what the circuit owns.
@@ -1214,7 +1214,7 @@ The C API currently only supports building DAGs that contain operations defined
Free the DAG.
-
+
#### Example
@@ -1223,11 +1223,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not either null or a valid pointer to a `QkDag`.
@@ -1243,7 +1243,7 @@ The C API currently only supports building DAGs that contain operations defined
The new circuit is copied from the DAG; the original `dag` reference is still owned by the caller and still required to be freed with `qk_dag_free`. You must free the returned circuit with `qk_circuit_free` when done with it.
-
+
#### Example
@@ -1259,11 +1259,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -1281,7 +1281,7 @@ The C API currently only supports building DAGs that contain operations defined
Return the operation nodes in the DAG listed in topological order.
-
+
#### Example
@@ -1313,11 +1313,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag` or if `out_order` is not a valid, non-null pointer to a sequence of `qk_dag_num_op_nodes(dag)` consecutive elements of `uint32_t`.
@@ -1332,7 +1332,7 @@ The C API currently only supports building DAGs that contain operations defined
Replace a node in a `QkDag` with a subcircuit specified by another `QkDag`
-
+
#### Example
@@ -1363,11 +1363,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` and `replacement` are not a valid, non-null pointer to a `QkDag`.
@@ -1390,7 +1390,7 @@ The C API currently only supports building DAGs that contain operations defined
* duration
* all the qubits and clbits, including the registers.
-
+
#### Example
@@ -1414,11 +1414,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(copied_dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid pointer to a `QkDag`.
@@ -1440,7 +1440,7 @@ The C API currently only supports building DAGs that contain operations defined
Upon replacement, the nodes in the block are removed and substituted by a new node acting on the given qubits.
-
+
#### Example
@@ -1467,11 +1467,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if any of:
@@ -1502,7 +1502,7 @@ The C API currently only supports building DAGs that contain operations defined
The new operation should match the shape of the replaced operation. The qargs and cargs for the node will remain the same.
-
+
#### Example
@@ -1523,11 +1523,11 @@ The C API currently only supports building DAGs that contain operations defined
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if any of:
@@ -1549,11 +1549,11 @@ The C API currently only supports building DAGs that contain operations defined
It is not safe to use the `QkDag` pointer after calling this function. In particular, you should not attempt to clear or free it. The caller must own the `QkDag`, not hold a borrowed reference (for example, a `QkDag *` retrieved from `qk_dag_borrow_from_python` is not owned).
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `dag` is not a valid non-null pointer to an initialized and owned `QkDag`.
@@ -1577,11 +1577,11 @@ The C API currently only supports building DAGs that contain operations defined
You can also use `qk_dag_convert_from_python`, which is logically the exact same as this function, but can be directly used as a “converter” function for the `PyArg_Parse*` family of Python converter functions.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `ob` is not a valid non-null pointer to a Python object.
@@ -1605,11 +1605,11 @@ The C API currently only supports building DAGs that contain operations defined
You can also use `qk_dag_borrow_from_python`, which is logically the exact same as this, but with a more natural signature for direct usage.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `object` is not a valid non-null pointer to a Python object, or if `address` is not a pointer to writeable data of the correct type.
diff --git a/docs/api/qiskit-c/dev/qk-dynamic-circuits.mdx b/docs/api/qiskit-c/dev/qk-dynamic-circuits.mdx
index b31455539cd8..3c6d393bdb7c 100644
--- a/docs/api/qiskit-c/dev/qk-dynamic-circuits.mdx
+++ b/docs/api/qiskit-c/dev/qk-dynamic-circuits.mdx
@@ -15,7 +15,7 @@ Qiskit’s C API currently only supports the inspection of control flow instruct
When working with this API, keep the following assumptions and limitations in mind:
* Most objects returned by the control flow and classical expressions API are borrowed read-only pointers (returned as `const *`). These remain valid only as long as the parent object - for example, the circuit that owns an `IfElse` instruction - is alive. As such, callers must not free borrowed pointers, and must ensure that parent objects outlive any use of those pointers.
-* This API does not use error codes. When called correctly, the functions are infallible. However, variant-specific functions (e.g. [`qk_control_flow_box_duration_kind()`](qk-control-flow#qk_control_flow_box_duration_kind "qk_control_flow_box_duration_kind") which expects a `Box` instruction) will panic and abort the process used with an object of the wrong type. To guard against this, a set of query functions is provided to check the type or kind of an object before calling the appropriate variant-specific function.
+* This API does not use error codes. When called correctly, the functions are infallible. However, variant-specific functions (e.g. [`qk_control_flow_box_duration_kind()`](qk-control-flow#c.qk_control_flow_box_duration_kind "qk_control_flow_box_duration_kind") which expects a `Box` instruction) will panic and abort the process used with an object of the wrong type. To guard against this, a set of query functions is provided to check the type or kind of an object before calling the appropriate variant-specific function.
* Qiskit uses big integers to represent some control flow and classical expression constructs, such as classical register condition values and switch case labels. Full big integer support will be added to the C API in the future. Until then, numerical values in this API are limited to what fits in a `uint64_t`.
The following example program demonstrates all API functions and types for inspecting control flow instructions and classical expressions, along with selected classical register query functions. The entry point is `inspect_circuit` at the bottom; it calls the helper functions defined above it.
diff --git a/docs/api/qiskit-c/dev/qk-neighbors.mdx b/docs/api/qiskit-c/dev/qk-neighbors.mdx
index 1a2870a553a5..e5c3e438d8c4 100644
--- a/docs/api/qiskit-c/dev/qk-neighbors.mdx
+++ b/docs/api/qiskit-c/dev/qk-neighbors.mdx
@@ -19,11 +19,11 @@ python_api_name: QkNeighbors
This object is read-only from C. To satisfy the safety guarantees of `qk_neighbors_clear`, you must not overwrite any data initialized by `qk_neighbors_from_target`, including any pointed-to data.
-
+
#### Representation
-
+
After initialization by `qk_neighbors_from_target`, the structure will be in one of two modes:
@@ -64,11 +64,11 @@ python_api_name: QkNeighbors
This is represented by `neighbors` and `partition` being null pointers, so they are not valid for any reads.
-
+
#### Safety
-
+
`neighbors` must an aligned pointer to a valid, initialized `QkNeighbors` object.
@@ -88,7 +88,7 @@ python_api_name: QkNeighbors
If the target contains multi-qubit gates, they will be ignored and the connectivity will only represent the two-qubit coupling constraints. If the target represents all-to-all connectivity, the function returns `true`, and the output pointers will be initialized to be null pointers, in keeping with the representation of all-to-all connectivity.
-
+
#### Examples
@@ -110,11 +110,11 @@ python_api_name: QkNeighbors
qk_neighbors_clear(&neighbors);
```
-
+
#### Safety
-
+
`target` must point to a valid `QkTarget` object. `neighbors` must be aligned and safe to write to, but need not be initialized.
@@ -137,11 +137,11 @@ python_api_name: QkNeighbors
This should only be called on `QkNeighbors` objects that were initialized by `qk_neighbors_from_target`.
-
+
#### Safety
-
+
`neighbors` must point to a valid, initialized `QkNeighbors` object, which must have been initialized by a call to `qk_neighbors_from_target` and unaltered since then.
diff --git a/docs/api/qiskit-c/dev/qk-obs-term.mdx b/docs/api/qiskit-c/dev/qk-obs-term.mdx
index 6358fbdfbd75..cf8063af8f29 100644
--- a/docs/api/qiskit-c/dev/qk-obs-term.mdx
+++ b/docs/api/qiskit-c/dev/qk-obs-term.mdx
@@ -21,11 +21,11 @@ This is a group of functions for interacting with an opaque (Rust-space) SparseT
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.
-
+
#### Safety
-
+
* `bit_terms` must be a non-null, aligned pointer to `len` elements of type `QkBitTerm`.
* `indices` must be a non-null, aligned pointer to `len` elements of type `uint32_t`.
@@ -68,7 +68,7 @@ This is a group of functions for interacting with an opaque (Rust-space) SparseT
Return a string representation of the sparse term.
-
+
#### Example
@@ -81,11 +81,11 @@ This is a group of functions for interacting with an opaque (Rust-space) SparseT
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined `term` is not a valid, non-null pointer to a `QkObsTerm`.
diff --git a/docs/api/qiskit-c/dev/qk-obs.mdx b/docs/api/qiskit-c/dev/qk-obs.mdx
index 18804c727356..152e3081cb45 100644
--- a/docs/api/qiskit-c/dev/qk-obs.mdx
+++ b/docs/api/qiskit-c/dev/qk-obs.mdx
@@ -147,7 +147,7 @@ for (size_t i = 0; i < num_terms; i++) {
Construct the zero observable (without any terms).
-
+
#### Example
@@ -169,7 +169,7 @@ for (size_t i = 0; i < num_terms; i++) {
Construct the identity observable.
-
+
#### Example
@@ -193,7 +193,7 @@ for (size_t i = 0; i < num_terms; i++) {
Any of the pointer arguments may be `NULL` if and only if their corresponding length is zero.
-
+
#### Example
@@ -213,11 +213,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined if any of the following conditions are violated:
@@ -246,7 +246,7 @@ for (size_t i = 0; i < num_terms; i++) {
Free the observable.
-
+
#### Example
@@ -255,11 +255,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined if `obs` is not either null or a valid pointer to a `QkObs`.
@@ -273,7 +273,7 @@ for (size_t i = 0; i < num_terms; i++) {
Add a term to the observable.
-
+
#### Example
@@ -289,11 +289,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkExitCode exit_code = qk_obs_add_term(obs, &term);
```
-
+
#### Safety
-
+
Behavior is undefined if any of the following is violated:
@@ -317,7 +317,7 @@ for (size_t i = 0; i < num_terms; i++) {
A `QkObsTerm` contains pointers to the indices and bit terms in the term, which can be used to modify the internal data of the observable. This can leave the observable in an incoherent state and should be avoided, unless great care is taken. It is generally safer to construct a new observable instead of attempting in-place modifications.
-
+
#### Example
@@ -329,11 +329,11 @@ for (size_t i = 0; i < num_terms; i++) {
// QkExitCode error = qk_obs_term(obs, 12, &term);
```
-
+
#### Safety
-
+
Behavior is undefined if any of the following is violated
@@ -356,7 +356,7 @@ for (size_t i = 0; i < num_terms; i++) {
Get the number of terms in the observable.
-
+
#### Example
@@ -365,11 +365,11 @@ for (size_t i = 0; i < num_terms; i++) {
size_t num_terms = qk_obs_num_terms(obs); // num_terms==1
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -387,7 +387,7 @@ for (size_t i = 0; i < num_terms; i++) {
Get the number of qubits the observable is defined on.
-
+
#### Example
@@ -396,11 +396,11 @@ for (size_t i = 0; i < num_terms; i++) {
uint32_t num_qubits = qk_obs_num_qubits(obs); // num_qubits==100
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -418,7 +418,7 @@ for (size_t i = 0; i < num_terms; i++) {
Get the number of bit terms/indices in the observable.
-
+
#### Example
@@ -427,11 +427,11 @@ for (size_t i = 0; i < num_terms; i++) {
size_t len = qk_obs_len(obs); // len==0, as there are no non-trivial bit terms
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -451,7 +451,7 @@ for (size_t i = 0; i < num_terms; i++) {
This can be used to read and modify the observable’s coefficients. The resulting pointer is valid to read for `qk_obs_num_terms(obs)` elements of `QkComplex64`.
-
+
#### Example
@@ -465,11 +465,11 @@ for (size_t i = 0; i < num_terms; i++) {
}
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -489,7 +489,7 @@ for (size_t i = 0; i < num_terms; i++) {
This can be used to read and modify the observable’s indices. The resulting pointer is valid to read for `qk_obs_len(obs)` elements of size `uint32_t`.
-
+
#### Example
@@ -513,11 +513,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -537,7 +537,7 @@ for (size_t i = 0; i < num_terms; i++) {
This can be used to read and modify the observable’s term boundaries. The resulting pointer is valid to read for `qk_obs_num_terms(obs) + 1` elements of size `size_t`.
-
+
#### Example
@@ -559,11 +559,11 @@ for (size_t i = 0; i < num_terms; i++) {
}
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -583,7 +583,7 @@ for (size_t i = 0; i < num_terms; i++) {
This can be used to read and modify the observable’s bit terms. The resulting pointer is valid to read for `qk_obs_len(obs)` elements of size `uint8_t`.
-
+
#### Example
@@ -607,11 +607,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`, or if invalid values are written into the resulting `QkBitTerm` pointer.
@@ -629,7 +629,7 @@ for (size_t i = 0; i < num_terms; i++) {
Multiply the observable by a complex coefficient.
-
+
#### Example
@@ -639,11 +639,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *result = qk_obs_multiply(obs, &coeff);
```
-
+
#### Safety
-
+
Behavior is undefined if any of the following is violated
@@ -665,7 +665,7 @@ for (size_t i = 0; i < num_terms; i++) {
Multiply the observable in-place by a complex coefficient.
-
+
#### Example
@@ -675,11 +675,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_multiply_inplace(obs, &coeff);
```
-
+
#### Safety
-
+
Behavior is undefined if any of the following is violated
@@ -697,7 +697,7 @@ for (size_t i = 0; i < num_terms; i++) {
Add two observables.
-
+
#### Example
@@ -707,11 +707,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *result = qk_obs_add(left, right);
```
-
+
#### Safety
-
+
Behavior is undefined if `left` or `right` are not valid, non-null pointers to `QkObs`\ s.
@@ -730,7 +730,7 @@ for (size_t i = 0; i < num_terms; i++) {
Add an observable to an existing one.
-
+
#### Example
@@ -740,11 +740,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_add_inplace(left, right);
```
-
+
#### Safety
-
+
Behavior is undefined if `left` or `right` are not valid, non-null pointers to `QkObs`\ s.
@@ -759,7 +759,7 @@ for (size_t i = 0; i < num_terms; i++) {
Add two observables while scaling the coefficients of the right one.
-
+
#### Example
@@ -770,11 +770,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *result = qk_obs_scaled_add(left, right, &factor);
```
-
+
#### Safety
-
+
Behavior is undefined if `left` or `right` are not valid, non-null pointers to `QkObs`\ s.
@@ -794,7 +794,7 @@ for (size_t i = 0; i < num_terms; i++) {
Add a scaled observable to an existing one.
-
+
#### Example
@@ -805,11 +805,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_scaled_add_inplace(left, right, &factor);
```
-
+
#### Safety
-
+
Behavior is undefined if `left` or `right` are not valid, non-null pointers to `QkObs`\ s.
@@ -825,7 +825,7 @@ for (size_t i = 0; i < num_terms; i++) {
Compose (multiply) two observables.
-
+
#### Example
@@ -835,11 +835,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *result = qk_obs_compose(first, second);
```
-
+
#### Safety
-
+
Behavior is undefined if `first` or `second` are not valid, non-null pointers to `QkObs`\ s.
@@ -860,7 +860,7 @@ for (size_t i = 0; i < num_terms; i++) {
Notably, this allows composing two observables of different size.
-
+
#### Example
@@ -870,11 +870,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *result = qk_obs_compose(first, second);
```
-
+
#### Safety
-
+
To call this function safely
@@ -899,11 +899,11 @@ for (size_t i = 0; i < num_terms; i++) {
The layout is set by an array `layout` of new indices, specifying that qubit at current index `i` is relabelled to index `layout[i]`. The number of qubits the observable acts on can be extended by setting a larger `num_qubits` than the current observable has.
-
+
#### Example
-
+
This interface allows to relabel and extend the qubit indices:
@@ -939,11 +939,11 @@ for (size_t i = 0; i < num_terms; i++) {
free(layout);
```
-
+
#### Safety
-
+
Behavior is undefined if `obs` is not a valid, non-null pointer to `QkObs` or if `layout` is not a valid, non-null pointer to a sequence of `qk_obs_num_qubits(obs)` consecutive elements of `uint32_t`.
@@ -968,7 +968,7 @@ for (size_t i = 0; i < num_terms; i++) {
Calculate the canonical representation of the observable.
-
+
#### Example
@@ -980,11 +980,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *canonical = qk_obs_canonicalize(two, tol);
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -1003,7 +1003,7 @@ for (size_t i = 0; i < num_terms; i++) {
Copy the observable.
-
+
#### Example
@@ -1012,11 +1012,11 @@ for (size_t i = 0; i < num_terms; i++) {
QkObs *copied = qk_obs_copy(original);
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -1036,7 +1036,7 @@ for (size_t i = 0; i < num_terms; i++) {
Note that this does not compare mathematical equality, but data equality. This means that two observables might represent the same observable but not compare as equal.
-
+
#### Example
@@ -1046,11 +1046,11 @@ for (size_t i = 0; i < num_terms; i++) {
bool are_equal = qk_obs_equal(observable, other);
```
-
+
#### Safety
-
+
Behavior is undefined if `obs` or `other` are not valid, non-null pointers to `QkObs`\ s.
@@ -1069,7 +1069,7 @@ for (size_t i = 0; i < num_terms; i++) {
Return a string representation of a `QkObs`.
-
+
#### Example
@@ -1080,11 +1080,11 @@ for (size_t i = 0; i < num_terms; i++) {
qk_obs_free(obs);
```
-
+
#### Safety
-
+
Behavior is undefined `obs` is not a valid, non-null pointer to a `QkObs`.
@@ -1106,11 +1106,11 @@ for (size_t i = 0; i < num_terms; i++) {
Free a string representation.
-
+
#### Safety
-
+
Behavior is undefined if `str` is not a pointer returned by `qk_obs_str` or `qk_obsterm_str`.
@@ -1126,11 +1126,11 @@ for (size_t i = 0; i < num_terms; i++) {
It is not safe to use the `QkObs` pointer after calling this function. In particular, you should not attempt to clear or free it. The caller must own the `QkObs`, not hold a borrowed reference (for example, a `QkObs *` retrieved from `qk_obs_borrow_from_python` is not owned).
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `obs` is not a valid non-null pointer to an initialized and owned `QkObs`.
@@ -1154,11 +1154,11 @@ for (size_t i = 0; i < num_terms; i++) {
You can also use `qk_obs_convert_from_python`, which is logically the exact same as this function, but can be directly used as a “converter” function for the `PyArg_Parse*` family of Python converter functions.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `ob` is not a valid non-null pointer to a Python object.
@@ -1182,11 +1182,11 @@ for (size_t i = 0; i < num_terms; i++) {
You can also use `qk_obs_borrow_from_python`, which is logically the exact same as this, but with a more natural signature for direct usage.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `object` is not a valid non-null pointer to a Python object, or if `address` is not a pointer to writeable data of the correct type.
diff --git a/docs/api/qiskit-c/dev/qk-param.mdx b/docs/api/qiskit-c/dev/qk-param.mdx
index 51bb1f8ea1ad..7648a8afd4c8 100644
--- a/docs/api/qiskit-c/dev/qk-param.mdx
+++ b/docs/api/qiskit-c/dev/qk-param.mdx
@@ -21,7 +21,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Construct a new `QkParam` representing an unbound symbol.
-
+
#### Example
@@ -29,11 +29,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
QkParam *a = qk_param_new_symbol("a");
```
-
+
#### Safety
-
+
The `name` parameter must be a pointer to memory that contains a valid nul terminator at the end of the string. It also must be valid for reads of bytes up to and including the nul terminator.
@@ -53,7 +53,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
The `QkParam` returned from this function can be used to store the result of binary or unary operations.
-
+
#### Example
@@ -74,7 +74,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Free the `QkParam`.
-
+
#### Example
@@ -83,11 +83,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_free(a);
```
-
+
#### Safety
-
+
Behavior is undefined if `param` is not either null or a valid pointer to a `QkParam`.
@@ -101,7 +101,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Construct a new `QkParam` from a `double`.
-
+
#### Example
@@ -123,7 +123,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Construct a new `QkParam` from a complex number, given as `QkComplex64`.
-
+
#### Example
@@ -146,7 +146,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Copy a `QkParam`.
-
+
#### Example
@@ -155,11 +155,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
QkParam *b = qk_param_copy(a);
```
-
+
#### Safety
-
+
The behavior is undefined if `param` is not a valid pointer to a non-null `QkParam`.
@@ -177,7 +177,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Get a string representation of the `QkParam`.
-
+
#### Example
@@ -189,11 +189,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_free(a);
```
-
+
#### Safety
-
+
The behavior is undefined if `param` is not a valid pointer to a non-null `QkParam`.
@@ -215,7 +215,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Add two `QkParam`.
-
+
#### Example
@@ -226,11 +226,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_add(out, a, b);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out`, `lhs` or `rhs` is not a valid, non-null pointer to a `QkParam`.
@@ -250,7 +250,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Subtract two `QkParam`.
-
+
#### Example
@@ -261,11 +261,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_sub(out, a, b);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out`, `lhs` or `rhs` is not a valid, non-null pointer to a `QkParam`.
@@ -285,7 +285,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Multiply two `QkParam`.
-
+
#### Example
@@ -296,11 +296,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_mul(out, a, b);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out`, `lhs` or `rhs` is not a valid, non-null pointer to a `QkParam`.
@@ -320,7 +320,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Divide a `QkParam` by another.
-
+
#### Example
@@ -331,11 +331,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_div(out, a, b);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out`, `num` or `den` is not a valid, non-null pointer to a `QkParam`.
@@ -355,7 +355,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Raise a `QkParam` to the power of another.
-
+
#### Example
@@ -366,11 +366,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_pow(out, base, pow);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out`, `base` or `pow` is not a valid, non-null pointer to a `QkParam`.
@@ -390,7 +390,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the sine of a `QkParam`.
-
+
#### Example
@@ -400,11 +400,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_sin(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -423,7 +423,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the cosine of a `QkParam`.
-
+
#### Example
@@ -433,11 +433,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_cos(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -456,7 +456,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the tangent of a `QkParam`.
-
+
#### Example
@@ -466,11 +466,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_tan(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -489,7 +489,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the arcsine of a `QkParam`.
-
+
#### Example
@@ -499,11 +499,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_asin(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -522,7 +522,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the arccosine of a `QkParam`.
-
+
#### Example
@@ -532,11 +532,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_acos(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -555,7 +555,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the arctangent of a `QkParam`.
-
+
#### Example
@@ -565,11 +565,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_atan(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -588,7 +588,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the natural logarithm of a `QkParam`.
-
+
#### Example
@@ -598,11 +598,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_log(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -621,7 +621,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Apply the exponential function to a `QkParam`.
-
+
#### Example
@@ -631,11 +631,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_exp(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -654,7 +654,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the absolute value of a `QkParam`.
-
+
#### Example
@@ -664,11 +664,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_abs(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -687,7 +687,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Get the sign of a `QkParam`.
-
+
#### Example
@@ -697,11 +697,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_sign(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -720,7 +720,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Negate a `QkParam`.
-
+
#### Example
@@ -730,11 +730,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_neg(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -753,7 +753,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Calculate the complex conjugate of a `QkParam`.
-
+
#### Example
@@ -763,11 +763,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
qk_param_conjugate(out, a);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `out` or `src` is not a valid, non-null pointer to a `QkParam`.
@@ -786,7 +786,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
Compare two `QkParam` for equality.
-
+
#### Example
@@ -801,11 +801,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
bool equal = qk_param_equal(x, y);
```
-
+
#### Safety
-
+
The behavior is undefined if any of `lhs` or `rhs` is not a valid, non-null pointer to a `QkParam`.
@@ -826,7 +826,7 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
If the parameter could not be cast to a `double`, because there were unbound parameters, `NAN` is returned. Note that for `QkParam` representing complex values the real part is returned.
-
+
#### Example
@@ -843,11 +843,11 @@ While functionality for a `QkParam` within a circuit is currently limited, a use
double out = qk_param_as_real(y);
```
-
+
#### Safety
-
+
The behavior is undefined if `param` is not a valid, non-null pointer to a `QkParam`.
diff --git a/docs/api/qiskit-c/dev/qk-target-entry.mdx b/docs/api/qiskit-c/dev/qk-target-entry.mdx
index 9044c622aca5..784b8697f828 100644
--- a/docs/api/qiskit-c/dev/qk-target-entry.mdx
+++ b/docs/api/qiskit-c/dev/qk-target-entry.mdx
@@ -43,7 +43,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Creates an entry to the `QkTarget` based on a `QkGate` instance.
-
+
#### Example
@@ -65,7 +65,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Creates a new entry for adding a measurement instruction to a `QkTarget`.
-
+
#### Example
@@ -93,7 +93,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Creates a new entry for adding a reset instruction to a `QkTarget`.
-
+
#### Example
@@ -121,7 +121,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Creates an entry in the `QkTarget` based on a `QkGate` instance with no parameters.
-
+
#### Example
@@ -130,11 +130,11 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
QkTargetEntry *entry = qk_target_entry_new_fixed(QkGate_CRX, crx_params, "crx_fixed")";
```
-
+
#### Safety
-
+
The `params` type is expected to be a pointer to an array of `double` where the length matches the expectations of the `QkGate`. 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 params for a given gate. You can check `qk_gate_num_params` to determine how many qubits are required for a given gate.
@@ -160,7 +160,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Retrieves the number of properties stored in the target entry.
-
+
#### Example
@@ -170,11 +170,11 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
size_t props_size = qk_target_entry_num_properties(entry);
```
-
+
#### Safety
-
+
The behavior is undefined if `entry` is not a valid, non-null pointer to a `QkTargetEntry` object.
@@ -192,7 +192,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Frees the entry.
-
+
#### Example
@@ -201,11 +201,11 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
qk_target_entry_free(entry);
```
-
+
#### Safety
-
+
The behavior is undefined if `entry` is not a valid, non-null pointer to a `QkTargetEntry` object.
@@ -223,7 +223,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Adds an instruction property instance based on its assigned qargs.
-
+
#### Example
@@ -233,11 +233,11 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
qk_target_entry_add_property(entry, qargs, 2, 0.0, 0.1);
```
-
+
#### Safety
-
+
The behavior is undefined if `entry` is not a valid, non-null pointer to a `QkTargetEntry` object.
@@ -259,7 +259,7 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
Sets a custom name to the target entry.
-
+
#### Example
@@ -268,11 +268,11 @@ qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003);
qk_target_entry_set_name(entry, "cx_gate");
```
-
+
#### Safety
-
+
The behavior is undefined if `entry` is not a valid, non-null pointer to a `QkTargetEntry` object. The `name` pointer is expected to be either a C string comprising of valid UTF-8 characters or a null pointer.
diff --git a/docs/api/qiskit-c/dev/qk-target.mdx b/docs/api/qiskit-c/dev/qk-target.mdx
index 524f61f03bba..5ffa908050ee 100644
--- a/docs/api/qiskit-c/dev/qk-target.mdx
+++ b/docs/api/qiskit-c/dev/qk-target.mdx
@@ -108,7 +108,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Construct a new `QkTarget` with the given number of qubits. The number of qubits is bound to change if an instruction is added with properties that apply to a collection of qargs in which any index is higher than the specified number of qubits
-
+
#### Example
@@ -136,11 +136,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
You can also use `qk_target_convert_from_python`, which is logically the exact same as this function, but can be directly used as a “converter” function for the `PyArg_Parse*` family of Python converter functions.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `ob` is not a valid non-null pointer to a Python object.
@@ -164,11 +164,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
You can also use `qk_target_borrow_from_python`, which is logically the exact same as this, but with a more natural signature for direct usage.
-
+
#### Safety
-
+
The caller must be attached to a Python interpreter. Behavior is undefined if `object` is not a valid non-null pointer to a Python object, or if `address` is not a pointer to writeable data of the correct type.
@@ -187,7 +187,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the number of qubits of this `QkTarget`.
-
+
#### Example
@@ -196,11 +196,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
uint32_t num_qubits = qk_target_num_qubits(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -218,7 +218,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the dt value of this `QkTarget`.
-
+
#### Example
@@ -228,11 +228,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
double dt = qk_target_dt(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -250,7 +250,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the granularity value of this `QkTarget`.
-
+
#### Example
@@ -260,11 +260,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
uint32_t granularity = qk_target_granularity(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -282,7 +282,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the `min_length` value of this `QkTarget`.
-
+
#### Example
@@ -292,11 +292,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
size_t min_length = qk_target_min_length(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -314,7 +314,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the `pulse_alignment` value of this `QkTarget`.
-
+
#### Example
@@ -324,11 +324,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
uint32_t pulse_alignment = qk_target_pulse_alignment(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -346,7 +346,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the `acquire_alignment` value of this `QkTarget`.
-
+
#### Example
@@ -356,11 +356,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
uint32_t acquire_alignment = qk_target_pulse_alignment(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -378,7 +378,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Sets the dt value of this `QkTarget`.
-
+
#### Example
@@ -387,11 +387,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
double dt = qk_target_set_dt(target, 10e-9);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -410,7 +410,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Sets the `granularity` value of this `QkTarget`.
-
+
#### Example
@@ -420,11 +420,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_set_granularity(target, 2);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -443,7 +443,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Sets the `min_length` value of this `QkTarget`.
-
+
#### Example
@@ -453,11 +453,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_set_min_length(target, 3);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -476,7 +476,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the `pulse_alignment` value of this `QkTarget`.
-
+
#### Example
@@ -486,11 +486,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_set_pulse_alignment(target, 4);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -509,7 +509,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Sets the `acquire_alignment` value of this `QkTarget`.
-
+
#### Example
@@ -519,11 +519,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_set_acquire_alignment(target, 5);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -542,7 +542,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Creates a copy of the `QkTarget`.
-
+
#### Example
@@ -556,11 +556,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
QkTarget *copied = qk_target_copy(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -578,7 +578,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Free the `QkTarget`.
-
+
#### Example
@@ -587,11 +587,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -605,7 +605,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Adds a gate to the `QkTarget` through a `QkTargetEntry`.
-
+
#### Example
@@ -617,11 +617,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
QkExitCode result = qk_target_add_instruction(target, entry);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -642,7 +642,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Modifies the properties of a gate in the `QkTarget`.
-
+
#### Example
@@ -657,11 +657,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_update_property(target, QkGate_CRX, qargs, 2, 0.0012, 1.1);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -686,7 +686,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Returns the number of instructions tracked by a `QkTarget`.
-
+
#### Example
@@ -698,11 +698,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
size_t num_instructions = qk_target_num_instructions(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -720,7 +720,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Checks if the provided instruction and its qargs are supported by this `Target`.
-
+
#### Example
@@ -742,11 +742,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `target` is not a valid, non-null pointer to a `QkTarget`.
@@ -771,7 +771,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Return the index at which an operation is located based on its name.
-
+
#### Example
@@ -783,11 +783,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
size_t op_idx = qk_target_op_index(target, "h");
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`. Behavior is undefined if `name` is not a pointer to a valid null-terminated string.
@@ -806,7 +806,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Return the name of the operation stored at that index in the `QkTarget` instance’s gate map.
-
+
#### Example
@@ -820,11 +820,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_str_free(op_name);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -843,7 +843,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Return the number of properties defined for the specified operation in the `QkTarget` instance, a.k.a. the length of the property map. Panics if the operation index is not present.
-
+
#### Example
@@ -855,11 +855,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
size_t num_props = qk_target_op_num_properties(target, 0);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -878,7 +878,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Retrieve the index at which some qargs are stored. Returns `SIZE_MAX` if not found.
-
+
#### Example
@@ -893,11 +893,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
size_t idx_0_1 = qk_target_op_qargs_index(target, 0, qargs);
```
-
+
#### Safety
-
+
Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`.
@@ -919,7 +919,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Panics if any of the indices are out of range.
-
+
#### Example
@@ -942,11 +942,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
}
```
-
+
#### Safety
-
+
Behavior is undefined if `target` is not a valid, non-null pointer to a `QkTarget`. Behavior is undefined if each `qargs_out` or `qargs_len` are not aligned and writeable for a single value of the correct type.
@@ -966,7 +966,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Panics if any of the indices are out of range.
-
+
#### Example
@@ -982,11 +982,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_op_props(target, 0, 0, &inst_props);
```
-
+
#### Safety
-
+
Behavior is undefined if `target` is not a valid, non-null pointer to a `QkTarget`. Behavior is undefined if `inst_props` does not point to an address of the correct size to store `QkInstructionProperties` in.
@@ -1003,7 +1003,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Retrieves information about an operation in the Target via index. If the index is not present, this function will panic. You can check the `QkTarget` total number of instructions using `qk_target_num_instructions`.
-
+
#### Example
@@ -1022,11 +1022,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_op_clear(&op);
```
-
+
#### Safety
-
+
Behavior is undefined if `target` is not a valid, non-null pointer to a `QkTarget`. Behavior is undefined if `out_op` does not point to an address of the correct size to store `QkTargetOp` in.
@@ -1042,7 +1042,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Tries to retrieve a `QkGate` based on the operation stored in an index. The user is responsible for checking whether this operation is a gate in the `QkTarget` via using `qk_target_op_get`. If not, this function will panic.
-
+
#### Example
@@ -1067,11 +1067,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
qk_target_op_clear(&op);
```
-
+
#### Safety
-
+
Behavior is undefined if the `target` pointer is null or not aligned.
@@ -1090,11 +1090,11 @@ The Target C API currently only supports additions of `QkGate` instances with ei
Clears the `QkTargetOp` object.
-
+
#### Safety
-
+
The behavior will be undefined if the pointer is null or not-aligned. The data belonging to a `QkTargetOp` originates in Rust and can only be freed using this function.
diff --git a/docs/api/qiskit-c/dev/qk-transpile-layout.mdx b/docs/api/qiskit-c/dev/qk-transpile-layout.mdx
index d6224a6e257c..470f2beff74a 100644
--- a/docs/api/qiskit-c/dev/qk-transpile-layout.mdx
+++ b/docs/api/qiskit-c/dev/qk-transpile-layout.mdx
@@ -81,11 +81,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
Return the number of qubits in the input circuit to the transpiler.
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`.
@@ -103,11 +103,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
Return the number of qubits in the output circuit from the transpiler.
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`.
@@ -133,11 +133,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
indicates that the layout maps virtual qubit 0 -> physical qubit 1, virtual qubit 1 -> physical qubit -> 0, and virtual qubit 2 -> physical qubit 2.
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`. `initial_layout` must be a valid, non-null pointer with a large enough allocation to store the size necessary for the initial layout. If `filter_ancillas` is true this will be number of input qubits (which can be checked with `qk_transpile_layout_num_input_qubits()`) or the number of output qubits if `filter_ancillas` is false (which can be queried with `qk_transpile_layout_num_output_qubits()`).
@@ -165,11 +165,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
indicates that qubit 0 from the start of the circuit is at qubit 1 at the end of the circuit, 1 -> 2, and 2 -> 0.
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`. `output_permutation` must be a valid, non-null pointer with a large enough allocation to store the size necessary for the output\_permutation. This will always be the number of output qubits in the `QkTranspileLayout` which can be queried with `qk_transpile_layout_num_output_qubits()`.
@@ -196,11 +196,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
indicates that virtual qubit 0’s state in the original circuit is on physical qubit 2 at the end of the transpiled circuit, 1 -> 0, and 2 -> 1.
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`. `final_layout` must be a valid, non-null pointer with a large enough allocation to store the size necessary for the final layout. If `filter_ancillas` is true this will be number of input qubits (which can be checked with `qk_transpile_layout_num_input_qubits()`) or the number of output qubits if `filter_ancillas` is false (which can be queried with `qk_transpile_layout_num_output_qubits()`).
@@ -218,11 +218,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
This will generate a `QkTranspileLayout` with the initial layout set (and no ouptput permutation) from a provided mapping. The intent of this function is to enable creating a custom layout pass that also creates a `QkTranspileLayout` that you can use with subsequent stage functions such as `qk_transpile_stage_routing`.
-
+
#### Safety
-
+
Behavior is undefined if `original_dag` and target `target` are not a valid, aligned, non-null pointer to a `QkDag` or a `QkTarget` respectively. `qubit_mapping` must be a valid pointer to a contiguous array of `uint32_t` with enough space for the number of qubits indicated in `target`.
@@ -242,11 +242,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
Free a `QkTranspileLayout` object
-
+
#### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkTranspileLayout`.
@@ -262,11 +262,11 @@ The transpiler will also allocate ancilla qubits to the circuit if the target ha
The created Python-space object is a copy of the `QkTranspileLayout` provided, the data representation is different between C and Python and the data is not moved to Python like for some other `*_to_python` functions.
-
+
#### Safety
-
+
Behavior is undefined if `layout` and `circuit` are not valid, non-null pointers to a `QkTranspileLayout` and `QkCircuit` respectively. It is assumed that the thread currently executing this function holds the Python GIL. This is required to create the Python object returned by this function.
diff --git a/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx b/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx
index 3c7215f5be4e..d1c5f0fb6724 100644
--- a/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx
+++ b/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx
@@ -29,7 +29,7 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
This pass is intended to be run before a layout (mapping virtual qubits to physical qubits) is set during the transpilation pipeline. This pass iterates over the DAG and when a Swap gate is encountered it permutes the virtual qubits in the DAG and removes the swap gate. This will effectively remove any swap gates in the DAG prior to running layout. This optimization is not valid after a layout has been set and should not be run in this case.
-
+
#### Example
@@ -51,11 +51,11 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
qk_dag_free(dag);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDAG`.
@@ -75,7 +75,7 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
The pass checks if the directions of two-qubit gates comply with the gate directions specified in a given target.
-
+
#### Example
@@ -98,11 +98,11 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `target` are not valid, non-null pointers to `QkDag` and `QkTarget` objects, respectively.
@@ -123,7 +123,7 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
The GateDirection pass modifies asymmetric gates to match the hardware coupling directions. This pass supports replacements for the `cx`, `cz`, `ecr`, `swap`, `rzx`, `rxx`, `ryy` and `rzz` gates, using predefined identities.
-
+
#### Example
@@ -147,11 +147,11 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `target` are not valid, non-null pointers to `QkDag` and `QkTarget` objects, respectively.
@@ -178,7 +178,7 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Example
@@ -210,11 +210,11 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
qk_quantum_register_free(qr);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag` and if `target` is not a valid pointer to a `QkTarget`.
@@ -231,7 +231,7 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
Transpiler pass to remove diagonal gates (like RZ, T, Z, etc) before a measurement. Including diagonal 2Q gates.
-
+
#### Example
@@ -250,11 +250,11 @@ The Qiskit C API provides transpiler pass functions in two forms: ones that oper
qk_classical_register_free(cr);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDag`.
@@ -283,7 +283,7 @@ $$
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the RAYON\_NUM\_THREADS environment variable. For example, setting RAYON\_NUM\_THREADS=4 would limit the thread pool to 4 threads.
-
+
#### Example
@@ -316,11 +316,11 @@ $$
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `target` is not a valid, non-null pointer to a `QkDag` and `QkTarget`.
@@ -336,11 +336,11 @@ $$
Run the Split2QUnitaries transpiler pass on a DAG Circuit
-
+
#### Safety
-
+
Behavior is undefined if `dag` is not a valid, non-null pointer to a `QkDAG`.
@@ -368,7 +368,7 @@ $$
This pass is multithreaded, and will perform the analysis in parallel and use all the cores available on your local system. You can refer to the [configuration guide](/docs/guides/configure-qiskit-local) for details on how to control the threading behavior for Qiskit more broadly which will also control this pass
-
+
#### Example
@@ -401,11 +401,11 @@ $$
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `target` is not a valid, non-null pointer to a `QkDag` and `QkTarget`.
@@ -427,7 +427,7 @@ $$
The BasisTranslator transpiler pass translates gates to a target basis by searching for a set of translations from the standard EquivalenceLibrary.
-
+
#### Example
@@ -452,11 +452,11 @@ $$
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` and/or `target` are not valid, non-null pointers to a `QkCircuit` or `QkTarget`.
@@ -476,7 +476,7 @@ $$
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Example
@@ -489,11 +489,11 @@ $$
qk_transpiler_pass_standalone_commutative_cancellation(qc, NULL, 1.0);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, `QkCircuit` and `QkTarget`. `QkCircuit` is not expected to be null and behavior is undefined if it is.
@@ -515,11 +515,11 @@ $$
ConsolidateBlocks is a transpiler pass that consolidates consecutive blocks of gates operating on the same qubits into a Unitary gate, to later on be resynthesized, which leads to a more optimal subcircuit.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit` and if `target` is not a valid pointer to a `QkTarget`.
@@ -538,11 +538,11 @@ $$
This pass converts all standard gates (with less than 4 qubits) in the circuit into a sequence of `QkPauliProductRotation` gates and measurements into `QkPauliProductMeasurement` instructions. Note that this pass panics if the circuit contains non-standard gates. The suggested workflow is to first transpile into a standard basis, keeping rotation gates (such as `QkGate_RXX` and others) intact where possible, and then call this pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not valid, non-null pointers to a `QkCircuit`.
@@ -558,11 +558,11 @@ $$
Refer to the `qk_transpiler_pass_elide_permutations` function for more details about the pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`.
@@ -582,11 +582,11 @@ $$
Refer to the `qk_transpiler_pass_check_gate_direction` function for more details about the pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` are not valid, non-null pointers to `QkCircuit` and `QkTarget` objects, respectively.
@@ -607,11 +607,11 @@ $$
Refer to the `qk_transpiler_pass_gate_direction` function for more details about the pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` are not valid, non-null pointers to `QkCircuit` and `QkTarget` objects, respectively.
@@ -651,7 +651,7 @@ $$
* (QkGate\_SX, QkGate\_SXdg)
* (QkGate\_CS, QkGate\_CSdg)
-
+
#### Example
@@ -665,11 +665,11 @@ $$
qk_transpiler_pass_standalone_inverse_cancellation(qc);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`.
@@ -685,11 +685,11 @@ $$
This pass commutes all Clifford gates to the end of the circuit, converting Pauli rotation gates into `QkPauliProductRotation` gates and measurements into `QkPauliProductMeasurement` instructions. Note that this pass currently only supports circuits that have `QkGate_T`, `QkGate_Tdg` or `QkGate_RZ` gates as non-Cliffords and panics otherwise. The suggested workflow is to first transpile into a Clifford+RZ basis and then call this pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not valid, non-null pointers to a `QkCircuit`.
@@ -710,11 +710,11 @@ $$
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit` and if `target` is not a valid pointer to a `QkTarget`.
@@ -733,11 +733,11 @@ $$
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit` and if `target` is not a valid pointer to a `QkTarget`.
@@ -754,11 +754,11 @@ $$
Refer to the `qk_transpiler_pass_remove_diagonal_gates_before_measure` function for more details about the pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`.
@@ -776,11 +776,11 @@ $$
This function is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the RAYON\_NUM\_THREADS environment variable. For example, setting RAYON\_NUM\_THREADS=4 would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`.
@@ -806,11 +806,11 @@ $$
This function is multithreaded and will launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### References
-
+
\[1] Henry Zou and Matthew Treinish and Kevin Hartman and Alexander Ivrii and Jake Lishman. “LightSABRE: A Lightweight and Enhanced SABRE Algorithm” [arXiv:2409.08368](https://doi.org/10.48550/arXiv.2409.08368)
@@ -820,11 +820,11 @@ $$
[arXiv:1809.02573](https://arxiv.org/pdf/1809.02573.pdf)
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`.
@@ -846,11 +846,11 @@ $$
Refer to the `qk_transpiler_pass_split_2q_unitaries` function for more details about the pass.
-
+
#### Safety
-
+
Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`.
@@ -874,7 +874,7 @@ $$
This function is multithreaded, and will perform the analysis in parallel and use all the cores available on your local system. You can refer to the [configuration guide](/docs/guides/configure-qiskit-local) for details on how to control the threading behavior for Qiskit more broadly which will also control this pass
-
+
#### Example
@@ -904,11 +904,11 @@ $$
qk_target_free(target);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`.
@@ -930,7 +930,7 @@ $$
This pass is multithreaded and will potentially launch a thread pool with threads equal to the number of CPUs by default. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Example
@@ -957,11 +957,11 @@ $$
qk_transpiler_pass_standalone_unitary_synthesis(qc, target, 0, 1.0);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`.
@@ -984,7 +984,7 @@ $$
If this pass finds a solution that means there is a “perfect layout” and that no further swap mapping or routing is needed. However, there is not always a possible solution, or a solution might exist but it is not found within the limits specified when the pass is called.
-
+
#### Example
@@ -1013,11 +1013,11 @@ $$
qk_vf2_layout_configuration_free(config);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`. Behavior is undefined if `config` is a non-null pointer that does not point to a valid `QkVF2LayoutConfiguration` object (but a null pointer is fine).
@@ -1050,7 +1050,7 @@ $$
In both of the first two cases, `qk_vf2_layout_has_match` will return `true`. In only the first case, `qk_vf2_layout_has_improvement` will return `true`.
-
+
#### Example
@@ -1078,11 +1078,11 @@ $$
qk_vf2_layout_configuration_free(config);
```
-
+
#### Safety
-
+
Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`. Behavior is undefined if `config` is a non-null pointer that does not point to a valid `QkVF2LayoutConfiguration` object (but a null pointer is fine).
@@ -1108,11 +1108,11 @@ $$
Replaced by [`qk_transpiler_pass_standalone_vf2_layout_average()`](#qk_transpiler_pass_standalone_vf2_layout_average "qk_transpiler_pass_standalone_vf2_layout_average").
-
+
#### Safety
-
+
The safety requirements of `qk_transpiler_pass_standalone_vf2_layout_average` must be respected for `circuit` and `target`.
diff --git a/docs/api/qiskit-c/dev/qk-transpiler.mdx b/docs/api/qiskit-c/dev/qk-transpiler.mdx
index 2c13ad403cf3..4bd98cedf3e2 100644
--- a/docs/api/qiskit-c/dev/qk-transpiler.mdx
+++ b/docs/api/qiskit-c/dev/qk-transpiler.mdx
@@ -69,11 +69,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
>
> Create a pointer to an empty `QkTranspilerStageState` object
>
->
+>
>
> #### Safety
>
->
+>
>
> Behavior is undefined if `state` is not a valid pointer allocated.
>
@@ -87,11 +87,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
>
> Free a `QkTranspilerStageState` object
>
->
+>
>
> #### Safety
>
->
+>
>
> Behavior is undefined if `state` is not a valid, non-null pointer to a `QkTranspilerStageState`.
>
@@ -107,11 +107,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
>
> This pointer is owned by the `state` object and should not be freed using `qk_transpile_layout_free`. Instead, free the original `state` object using `qk_transpile_state_free`.
>
->
+>
>
> #### Safety
>
->
+>
>
> Behavior is undefined if `state` is not a valid, non-null pointer to a `QkTranspilerStageState`.
>
@@ -131,11 +131,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
>
> Calling this method consumes the `QkTranspileLayout` object which means the user will not need to call `qk_transpile_layout_free`. The user should still de-allocate the space allotted for it using `free`.
>
->
+>
>
> #### Safety
>
->
+>
>
> Behavior is undefined if `state` is not a valid, non-null pointer to a `QkTranspilerStageState`. Behavior is undefined if `state` is not a valid pointer to a `QkTranspileLayout`.
>
@@ -170,11 +170,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `dag`, `target`, or `state`, are not valid, non-null pointers to a `QkDag`, `QkTarget`, or a `QkTranspileLayout` pointer respectively. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`. The value of the inner pointer for `state` will be overwritten by this function. If the value pointed to needs to be freed this must be done outside of this function as it will not be freed by this function.
@@ -202,11 +202,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `dag`, `target`, or `layout`, are not valid, non-null pointers to a `QkDag`, `QkTarget`, or a `QkTranspileLayout` pointer respectively. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`.
@@ -234,11 +234,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `dag` and `target` are not valid, non-null pointers to a `QkDag`, or a `QkTarget` respectively. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`.
@@ -266,11 +266,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `dag` and `target` are not valid, non-null pointers to a `QkDag`, `QkTarget` respectively. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`.
@@ -297,11 +297,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `dag` or `target`, are not valid, non-null pointers to a `QkDag`, or a `QkTarget` respectively. Behavior is also undefined if `layout` is not a valid, aligned, pointer to a pointer to a `QkTranspileLayout` or a pointer to a `NULL` pointer. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`.
@@ -327,11 +327,11 @@ A container collecting individual attributes shared by the transpiler stages. Wh
This function is multithreaded internally and will launch a thread pool with threads equal to the number of CPUs reported by the operating system by default. This will include logical cores on CPUs with simultaneous multithreading. You can tune the number of threads with the `RAYON_NUM_THREADS` environment variable. For example, setting `RAYON_NUM_THREADS=4` would limit the thread pool to 4 threads.
-
+
#### Safety
-
+
Behavior is undefined if `circuit`, `target`, or `result`, are not valid, non-null pointers to a `QkCircuit`, `QkTarget`, or `QkTranspileResult` respectively. `options` must be a valid pointer a to a `QkTranspileOptions` or `NULL`. `error` must be a valid pointer to a `char` pointer or `NULL`.
diff --git a/docs/api/qiskit-c/dev/qk-vf-2-layout.mdx b/docs/api/qiskit-c/dev/qk-vf-2-layout.mdx
index 420800d43276..6e3eea187d60 100644
--- a/docs/api/qiskit-c/dev/qk-vf-2-layout.mdx
+++ b/docs/api/qiskit-c/dev/qk-vf-2-layout.mdx
@@ -35,11 +35,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
Free a `QkVf2LayoutConfiguration` object.
-
+
#### Safety
-
+
Behavior is undefined if `config` is a non-null pointer, but does not point to a valid, aligned `QkVF2LayoutConfiguration` object.
@@ -55,11 +55,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
The VF2 algorithm keeps track of the number of steps it has taken, and terminates when it reaches the limit. After the first match is found, the limit swaps from the “before” limit to the “after” limit without resetting the number of steps taken.
-
+
#### Safety
-
+
Behavior is undefined if `config` is not a valid, aligned, non-null pointer to a `QkVF2LayoutConfiguration`.
@@ -77,11 +77,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
This is not a hard limit; it is only checked when an improved layout is encountered. Using this option also makes the pass non-deterministic. It is generally recommended to use `qk_vf2_layout_configuration_set_call_limit` instead.
-
+
#### Safety
-
+
Behavior is undefined if `config` is not a valid, aligned, non-null pointer to a `QkVF2LayoutConfiguration`.
@@ -98,11 +98,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
Since the VF2 search tree is pruned on-the-fly based on scoring in the `QkTarget`, this limit is not especially powerful. See `qk_vf2_layout_configuration_set_call_limit` for a tighter bound.
-
+
#### Safety
-
+
Behavior is undefined if `config` is not a valid, aligned, non-null pointer to a `QkVF2LayoutConfiguration`.
@@ -121,11 +121,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
If this function was not called, no node shuffling takes place.
-
+
#### Safety
-
+
Behavior is undefined if `config` is not a valid, aligned, non-null pointer to a `QkVF2LayoutConfiguration`.
@@ -142,11 +142,11 @@ The configuration for the VF2 layout passes. This is an encapsulated configurati
You typically want to set this `true` if you are using the VF2 passes to improve a circuit that is already lowered to hardware, in order to set a baseline for the score-based pruning. If not, you can leave this as `false` (the default), to avoid a calculation that likely will not have any impact.
-
+
#### Safety
-
+
Behavior is undefined if `config` is not a valid, aligned, non-null pointer to a `VF2LayoutConfiguration`.
@@ -173,11 +173,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns
A `true` value includes the situation where the configuration specified to try the “trivial” layout and it was found to be the best (and consequently no qubit relabelling is necessary, other than ancilla expansion if appropriate). See `qk_vf2_layout_result_has_improvement` to distinguish whether an explicit remapping is stored.
-
+
##### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2LayoutResult`.
@@ -195,11 +195,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns
Check whether the result is an improvement to the trivial layout.
-
+
##### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2LayoutResult`.
@@ -217,11 +217,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns
Get the physical qubit for a given virtual qubit
-
+
##### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2LayoutResult` containing a result, or if the qubit is out of range for the initial circuit.
@@ -240,7 +240,7 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns
Free a `QkVF2LayoutResult` object
-
+
##### Example
@@ -248,11 +248,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns
QkCircuit *qc = qk_circuit_new(1, 0);
```
-
+
##### Safety
-
+
Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2Layout`.
diff --git a/docs/api/qiskit-ibm-runtime/dev/options-models-post-selection-options.mdx b/docs/api/qiskit-ibm-runtime/dev/options-models-post-selection-options.mdx
index 93b6df0cfaf5..548c8727daa1 100644
--- a/docs/api/qiskit-ibm-runtime/dev/options-models-post-selection-options.mdx
+++ b/docs/api/qiskit-ibm-runtime/dev/options-models-post-selection-options.mdx
@@ -39,7 +39,7 @@ python_api_name: qiskit_ibm_runtime.options_models.PostSelectionOptions
**Constraints**
- * **func** = \
+ * **func** = \
### strategy
diff --git a/docs/api/qiskit-ibm-runtime/dev/results-quantum-program-item-result.mdx b/docs/api/qiskit-ibm-runtime/dev/results-quantum-program-item-result.mdx
index 848fc24f9941..09206f0d0924 100644
--- a/docs/api/qiskit-ibm-runtime/dev/results-quantum-program-item-result.mdx
+++ b/docs/api/qiskit-ibm-runtime/dev/results-quantum-program-item-result.mdx
@@ -16,7 +16,7 @@ python_api_name: qiskit_ibm_runtime.results.QuantumProgramItemResult
**Parameters**
* **result** (*dict\[str, np.ndarray]*) – A dictionary with array-valued data.
- * **metadata** ([*ItemMetadata*](results-item-metadata "qiskit_ibm_runtime.results.ItemMetadata") *| None*) – The metadata produced for the individual item.
+ * **metadata** ([*ItemMetadata*](results-item-metadata "qiskit_ibm_runtime.results.ItemMetadata") *| dict | None*) – The metadata produced for the individual item.
## Methods
diff --git a/docs/api/qiskit/dev/qpy.mdx b/docs/api/qiskit/dev/qpy.mdx
index 26c12996405d..804ada250549 100644
--- a/docs/api/qiskit/dev/qpy.mdx
+++ b/docs/api/qiskit/dev/qpy.mdx
@@ -104,7 +104,7 @@ with open('twenty_bells.qpy', 'rb') as fd:
### dump
-
+
Write QPY binary data to a file
This function is used to save a circuit to a file for later use or transfer between machines. The QPY format is backwards compatible and can be loaded with future versions of Qiskit.
@@ -398,6 +398,14 @@ Changed in version QPY: 12 `STANDALONE_VARS` was added between `REGISTERS` and `
There is a circuit payload for each circuit (where the total number is dictated by `num_circuits` in the file header). There is no padding between the circuits in the data.
+
+
+### Version 18
+
+Version 18 removes the `CalibrationsPack` field from the circuit payload. Pulse gate calibrations were removed from Qiskit in version 2.0, and since then the field has always been written as an empty placeholder (`num_cals = 0`). Dropping it saves 2 bytes per circuit and cleans up the format.
+
+Version 18 also corrects the encoding of integer and float `INSTRUCTION_PARAM` values to big-endian byte order, consistent with the rest of the QPY specification. In versions 1–17 these were mistakenly written in little-endian.
+
### Version 17
diff --git a/public/docs/api/qiskit-c/dev/objects.inv b/public/docs/api/qiskit-c/dev/objects.inv
index abe95a0de192..221b8be52408 100644
Binary files a/public/docs/api/qiskit-c/dev/objects.inv and b/public/docs/api/qiskit-c/dev/objects.inv differ
diff --git a/public/docs/api/qiskit/dev/objects.inv b/public/docs/api/qiskit/dev/objects.inv
index 2ad6d4d4d07b..2effa2a1b7bd 100644
Binary files a/public/docs/api/qiskit/dev/objects.inv and b/public/docs/api/qiskit/dev/objects.inv differ
diff --git a/public/docs/images/api/qiskit-ibm-runtime/dev/fake_provider-3.avif b/public/docs/images/api/qiskit-ibm-runtime/dev/fake_provider-3.avif
index 0d63332c5087..b3d89885f931 100644
Binary files a/public/docs/images/api/qiskit-ibm-runtime/dev/fake_provider-3.avif and b/public/docs/images/api/qiskit-ibm-runtime/dev/fake_provider-3.avif differ
diff --git a/public/docs/images/api/qiskit-ibm-runtime/dev/twirling_strategy_options.avif b/public/docs/images/api/qiskit-ibm-runtime/dev/twirling_strategy_options.avif
index b3453632d3af..127544ba158f 100644
Binary files a/public/docs/images/api/qiskit-ibm-runtime/dev/twirling_strategy_options.avif and b/public/docs/images/api/qiskit-ibm-runtime/dev/twirling_strategy_options.avif differ
diff --git a/public/docs/images/api/qiskit/dev/circuit_random-1.avif b/public/docs/images/api/qiskit/dev/circuit_random-1.avif
index d1582af459b8..a44e99110489 100644
Binary files a/public/docs/images/api/qiskit/dev/circuit_random-1.avif and b/public/docs/images/api/qiskit/dev/circuit_random-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/circuit_random-3.avif b/public/docs/images/api/qiskit/dev/circuit_random-3.avif
index 9be5ce593686..55e814bd9821 100644
Binary files a/public/docs/images/api/qiskit/dev/circuit_random-3.avif and b/public/docs/images/api/qiskit/dev/circuit_random-3.avif differ
diff --git a/public/docs/images/api/qiskit/dev/providers_fake_provider-1_01.avif b/public/docs/images/api/qiskit/dev/providers_fake_provider-1_01.avif
index d504166ad31c..35ffcba0dd92 100644
Binary files a/public/docs/images/api/qiskit/dev/providers_fake_provider-1_01.avif and b/public/docs/images/api/qiskit/dev/providers_fake_provider-1_01.avif differ
diff --git a/public/docs/images/api/qiskit/dev/providers_fake_provider-1_02.avif b/public/docs/images/api/qiskit/dev/providers_fake_provider-1_02.avif
index e29e3c525e21..d556a14a0626 100644
Binary files a/public/docs/images/api/qiskit/dev/providers_fake_provider-1_02.avif and b/public/docs/images/api/qiskit/dev/providers_fake_provider-1_02.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.avif
index 07de283b64c2..0f6eaa89afe1 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-2.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_00.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_00.avif
index 1d499a2e90bf..cc108f024ef1 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_00.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_00.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-31.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-31.avif
index cab87570ab07..25c20ae8c724 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-31.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-31.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-1.avif
index 0141eb9026a1..f631d74b6030 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-2.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-2.avif
index f0c109d3d691..6c9b2c651570 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-2.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-AndGate-2.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-BitwiseXorGate-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-BitwiseXorGate-1.avif
index 6fd47107f43c..f661a747f770 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-BitwiseXorGate-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-BitwiseXorGate-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProductGate-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProductGate-1.avif
index bcf03437eff0..bc00c2df553f 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProductGate-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProductGate-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-1.avif
index fffa830c1b70..c15cc0410afa 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-2.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-2.avif
index e05aa5a82a31..b49182f77450 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-2.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-OrGate-2.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.avif
index d5a90da3711c..3ab762254184 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PermutationGate-2.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.avif
index de27a33c0db8..943f045bfb81 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-PhaseEstimation-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-random_iqp-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-random_iqp-1.avif
index c64a6b29408b..4183a9e87df4 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-random_iqp-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-random_iqp-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-unitary_overlap-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-unitary_overlap-1.avif
index 452547ac8976..6834974adcda 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-unitary_overlap-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-unitary_overlap-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-quantum_info-Statevector-1.avif b/public/docs/images/api/qiskit/dev/qiskit-quantum_info-Statevector-1.avif
index 5af1f49cb788..932d6e69a5cd 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-quantum_info-Statevector-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-quantum_info-Statevector-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-FilterOpNodes-1.avif b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-FilterOpNodes-1.avif
index 7eabded6f91e..4bc1b475365a 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-FilterOpNodes-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-FilterOpNodes-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-RemoveBarriers-1.avif b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-RemoveBarriers-1.avif
index 31bf46049beb..974973478939 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-RemoveBarriers-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-RemoveBarriers-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-TwoQubitPeepholeOptimization-1.avif b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-TwoQubitPeepholeOptimization-1.avif
index 51c8d374956a..7bc1aebb28ac 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-TwoQubitPeepholeOptimization-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-transpiler-passes-TwoQubitPeepholeOptimization-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-circuit_drawer-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-circuit_drawer-1.avif
index 94ab8f652830..15e2f8025603 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-circuit_drawer-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-circuit_drawer-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.avif
index 81dbd86c10cb..52a3df230be8 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_circuit_layout-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.avif
index 1dfa1f44470b..cc0d2b5525eb 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_error_map-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_01.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_01.avif
index e697509b2434..f1301ec7373c 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_01.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_01.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_hinton-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_hinton-1.avif
index 5da725c925b3..0d6d46b851a2 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_hinton-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_hinton-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.avif
index e806b7c7dfc1..919826c8ca0c 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.avif
index a18fac8d5272..f7434da1c065 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-2.avif differ
diff --git a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.avif
index e2489daaa442..a7ea831a83f9 100644
Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-timeline_drawer-3.avif differ
diff --git a/public/docs/images/api/qiskit/dev/transpiler-10.avif b/public/docs/images/api/qiskit/dev/transpiler-10.avif
index 3e6893929109..78fe8f78dc62 100644
Binary files a/public/docs/images/api/qiskit/dev/transpiler-10.avif and b/public/docs/images/api/qiskit/dev/transpiler-10.avif differ
diff --git a/public/docs/images/api/qiskit/dev/transpiler-9.avif b/public/docs/images/api/qiskit/dev/transpiler-9.avif
index ebbd4d2895d0..dc7cbd8dd8aa 100644
Binary files a/public/docs/images/api/qiskit/dev/transpiler-9.avif and b/public/docs/images/api/qiskit/dev/transpiler-9.avif differ
diff --git a/public/docs/images/api/qiskit/dev/visualization-1.avif b/public/docs/images/api/qiskit/dev/visualization-1.avif
index f5f20edcf9c0..c8cac64f6ad8 100644
Binary files a/public/docs/images/api/qiskit/dev/visualization-1.avif and b/public/docs/images/api/qiskit/dev/visualization-1.avif differ
diff --git a/public/docs/images/api/qiskit/dev/visualization-3.avif b/public/docs/images/api/qiskit/dev/visualization-3.avif
index 66d496e85bda..05584d2bf9a1 100644
Binary files a/public/docs/images/api/qiskit/dev/visualization-3.avif and b/public/docs/images/api/qiskit/dev/visualization-3.avif differ
diff --git a/scripts/config/api-html-artifacts.json b/scripts/config/api-html-artifacts.json
index 129f92eb5fe2..05e8d951ad9c 100644
--- a/scripts/config/api-html-artifacts.json
+++ b/scripts/config/api-html-artifacts.json
@@ -1,6 +1,6 @@
{
"qiskit": {
- "dev": "https://api.github.com/repos/Qiskit/qiskit/actions/artifacts/9261835064/zip",
+ "dev": "https://api.github.com/repos/Qiskit/qiskit/actions/artifacts/9318205039/zip",
"2.5": "https://ibm.box.com/shared/static/ligi67e8hfsr6qjwpifcmjx2f4mibrj2.zip",
"2.4": "https://ibm.box.com/shared/static/8dug8a79f1xdohccyasfaazxn0tejzg9.zip",
"2.3": "https://ibm.box.com/shared/static/hu6gvj4857vb5sew5k98rr9yd7pxasqy.zip",
@@ -37,7 +37,7 @@
"0.19": "https://ibm.box.com/shared/static/wjoea4x5tnxd0l4lgo2v3kxnx6btxvvl.zip"
},
"qiskit-ibm-runtime": {
- "dev": "https://api.github.com/repos/Qiskit/qiskit-ibm-runtime/actions/artifacts/9260196314/zip",
+ "dev": "https://api.github.com/repos/Qiskit/qiskit-ibm-runtime/actions/artifacts/9341815663/zip",
"0.49": "https://ibm.box.com/shared/static/5ou5thet1qfmzs9ch8cuvn4jrfj30gu8.zip",
"0.48": "https://ibm.box.com/shared/static/w5yy54rxg8zspe8bxueknastn9cw8nfe.zip",
"0.47": "https://ibm.box.com/shared/static/68x7u8qpr72id254w6hnjbgo7317hwjk.zip",
diff --git a/scripts/config/historical-pages-to-latest.json b/scripts/config/historical-pages-to-latest.json
index 53ef338ea934..0da04ead19e3 100644
--- a/scripts/config/historical-pages-to-latest.json
+++ b/scripts/config/historical-pages-to-latest.json
@@ -1541,7 +1541,6 @@
"0.17": {}
},
"qiskit-c": {
- "1.4": {},
"2.0": {},
"2.1": {},
"2.2": {