diff --git a/docs/api/qiskit-c/dev/_toc.json b/docs/api/qiskit-c/dev/_toc.json index 60616db84ce..c27c9338bbb 100644 --- a/docs/api/qiskit-c/dev/_toc.json +++ b/docs/api/qiskit-c/dev/_toc.json @@ -21,6 +21,10 @@ "title": "QkComplex64", "url": "/docs/api/qiskit-c/dev/qk-complex-64" }, + { + "title": "QkElidePermutationsResult", + "url": "/docs/api/qiskit-c/dev/qk-elide-permutations-result" + }, { "title": "QkExitCode", "url": "/docs/api/qiskit-c/dev/qk-exit-code" diff --git a/docs/api/qiskit-c/dev/index.mdx b/docs/api/qiskit-c/dev/index.mdx index 36a50cf31b4..93c921914f1 100644 --- a/docs/api/qiskit-c/dev/index.mdx +++ b/docs/api/qiskit-c/dev/index.mdx @@ -34,8 +34,9 @@ As this interface is still new in Qiskit it should be considered experimental an Using the transpiler from the C API is intended to only cover circuits created solely via the C API. If you are in a hybrid mode where you’re using the C API with Python you should invoke the transpiler via the Python [`qiskit.transpiler`](/docs/api/qiskit/dev/transpiler#module-qiskit.transpiler "qiskit.transpiler") module instead; the functionality is the same Rust internals they just offer different entrypoints. The C API for transpilation makes assumptions about the input only using constructs exposed to the C Quantum Circuit API and you will potentially get incomplete results transpiling circuits from Python via the C API. -* [Transpiler Passes](qk-transpiler-passes) -* [QkVF2LayoutResult](qk-vf-2-layout-result) * [QkTarget](qk-target) * [QkTargetEntry](qk-target-entry) +* [Transpiler Passes](qk-transpiler-passes) +* [QkVF2LayoutResult](qk-vf-2-layout-result) +* [QkElidePermutationsResult](qk-elide-permutations-result) diff --git a/docs/api/qiskit-c/dev/qk-circuit.mdx b/docs/api/qiskit-c/dev/qk-circuit.mdx index fac4a268ce3..e6b5b97eb22 100644 --- a/docs/api/qiskit-c/dev/qk-circuit.mdx +++ b/docs/api/qiskit-c/dev/qk-circuit.mdx @@ -26,11 +26,11 @@ $$ // Create a circuit with three qubits and 3 classical bits QkCircuit *qc = qk_circuit_new(3, 0); // H gate on qubit 0, putting this qubit in a superposition of |0> + |1>. -qk_circuit_gate(qc, QkGate_H, {0}, NULL); +qk_circuit_gate(qc, QkGate_H, (uint32_t[]){0}, NULL); // A CX (CNOT) gate on control qubit 0 and target qubit 1 generating a Bell state. -qk_circuit_gate(qc, QkGate_CX, {0, 1}, NULL); +qk_circuit_gate(qc, QkGate_CX, (uint32_t[]){0, 1}, NULL); // A CX (CNOT) gate on control qubit 0 and target qubit 2 generating a GHZ state. -qk_circuit_gate(qc, QkGate_CX, {0, 2}, NULL); +qk_circuit_gate(qc, QkGate_CX, (uint32_t[]){0, 2}, NULL); // Free the created circuit. qk_circuit_free(qc); ``` @@ -202,7 +202,7 @@ The circuit C API currently only supports creating circuits that contain operati QkQuantumRegister *qr = qk_quantum_register_new(1024, "my_little_register"); qk_circuit_add_quantum_register(qc, qr); qk_quantum_register_free(qr); - qk_circuit_free(qc) + qk_circuit_free(qc); ``` @@ -233,7 +233,7 @@ The circuit C API currently only supports creating circuits that contain operati QkClassicalRegister *cr = qk_classical_register_new(24, "my_big_register"); qk_circuit_add_classical_register(qc, cr); qk_classical_register_free(cr); - qk_circuit_free(qc) + qk_circuit_free(qc); ``` @@ -391,7 +391,7 @@ The circuit C API currently only supports creating circuits that contain operati - The `qubits` and `params` types are expected to be a pointer to an array of `uint32_t` and `double` respectively where the length is matching the expectations for the standard gate. If the array is insufficently long the behavior of this function is undefined as this will read outside the bounds of the array. It can be a null pointer if there are no qubits or params for a given gate. You can check `qk_gate_num_qubits` and `qk_gate_num_params` to determine how many qubits and params are required for a given gate. + 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. Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`. @@ -562,17 +562,16 @@ The circuit C API currently only supports creating circuits that contain operati #### Example ```c - QkComplex64 c0 = qk_complex64_from_native(0); // 0+0i - QkComplex64 c1 = qk_complex64_from_native(1); // 1+0i + QkComplex64 c0 = {0, 0}; // 0+0i + QkComplex64 c1 = {1, 0}; // 1+0i const uint32_t num_qubits = 1; - const uint32_t dim = 2; - QkComplex64[dim * dim] unitary = {c0, c1, // row 0 + QkComplex64 unitary[2*2] = {c0, c1, // row 0 c1, c0}; // row 1 QkCircuit *circuit = qk_circuit_new(1, 0); // 1 qubit circuit - uint32_t qubit = {0}; // qubit to apply the unitary on - qk_circuit_unitary(circuit, unitary, qubit, num_qubits); + uint32_t qubit[1] = {0}; // qubit to apply the unitary on + qk_circuit_unitary(circuit, unitary, qubit, num_qubits, true); ``` @@ -607,7 +606,7 @@ The circuit C API currently only supports creating circuits that contain operati ```c QkCircuit *qc = qk_circuit_new(100, 0); - uint32_t qubit[1] = {0}; + uint32_t qubits[1] = {0}; qk_circuit_gate(qc, QkGate_H, qubits, NULL); QkOpCounts counts = qk_circuit_count_ops(qc); ``` @@ -675,7 +674,7 @@ The circuit C API currently only supports creating circuits that contain operati ```c QkCircuitInstruction inst; - QkCircuit *qc = qk_circuit_new(100); + QkCircuit *qc = qk_circuit_new(100, 0); uint32_t qubit[1] = {0}; qk_circuit_gate(qc, QkGate_H, qubit, NULL); qk_circuit_get_instruction(qc, 0, &inst); @@ -709,8 +708,8 @@ The circuit C API currently only supports creating circuits that contain operati ```c QkCircuitInstruction *inst = malloc(sizeof(QkCircuitInstruction)); - QkCircuit *qc = qk_circuit_new(100); - uint32_t q0 = {0}; + QkCircuit *qc = qk_circuit_new(100, 0); + uint32_t q0[1] = {0}; qk_circuit_gate(qc, QkGate_H, q0, NULL); qk_circuit_get_instruction(qc, 0, inst); qk_circuit_instruction_clear(inst); // free the data diff --git a/docs/api/qiskit-c/dev/qk-classical-register.mdx b/docs/api/qiskit-c/dev/qk-classical-register.mdx index e2b8e525ab7..f9d2b96e74e 100644 --- a/docs/api/qiskit-c/dev/qk-classical-register.mdx +++ b/docs/api/qiskit-c/dev/qk-classical-register.mdx @@ -12,14 +12,26 @@ python_api_name: QkClassicalRegister typedef struct QkClassicalRegister QkClassicalRegister ``` -A common way to instantiate several bits at once is to create a register. A register is a named collection of bits. Creating a register enables giving a collection of bits a name which can be use as metadata around specific bits in a circuit. This name will also typically be preseserved when exporting the circuit to interchange languages. +A common way to instantiate several bits at once is to create a register. A register is a named collection of bits. Creating a register enables giving a collection of bits a name which can be use as metadata around specific bits in a circuit. This name will also typically be preserved when exporting the circuit to interchange languages. You can create a register by calling `qk_classical_register_new()`, for example: +```c +#include + +QkClassicalRegister *creg = qk_classical_register_new(5, "my_creg"); +``` + Which creates a new 5 classical bit register named `"my_creg"`. Then to add the register to a circuit you use the `qk_circuit_add_classical_register()` function: +```c +QkCircuit *qc = qk_circuit_new(0, 0); +qk_circuit_add_classical_register(qc, creg); +uint32_t num_qubits = qk_circuit_num_qubits(qc); // 5 +``` + While circuits track registers, the registers themselves impart almost no behavioral differences on circuits. ## Functions diff --git a/docs/api/qiskit-c/dev/qk-complex-64.mdx b/docs/api/qiskit-c/dev/qk-complex-64.mdx index 5c21017b5e1..43b2554fbc5 100644 --- a/docs/api/qiskit-c/dev/qk-complex-64.mdx +++ b/docs/api/qiskit-c/dev/qk-complex-64.mdx @@ -8,7 +8,7 @@ python_api_name: QkComplex64 # QkComplex64 -A complex, double-precision number representation. This data type is used to safely use complex numbers within Qiskit, but is not necessarily designed for easy manipulation on user-side. Instead, we provide functions to convert from compiler-native representation (e.g. `double complex` for GNU or Clang compilers), which allow for ergonomic handling, to Qiskit’s `QkComplex64` representation, which is meant for passing into Qiskit functions and structs. +A complex, double-precision number representation. This data type is used to safely use complex numbers within Qiskit, but is not necessarily designed for easy manipulation on user-side. Instead, we provide functions to convert from compiler-native representation (e.g. `complex double` for GNU or Clang compilers), which allow for ergonomic handling, to Qiskit’s `QkComplex64` representation, which is meant for passing into Qiskit functions and structs. Explicitly, Qiskit assumes the compiler-native complex number type in C to be `_Dcomplex` for Windows MSVC (if `_MSC_VER` is defined) and `double _Complex` otherwise. In C++ (if `__cplusplus` is defined), the complex number type is always `std::complex`. @@ -38,11 +38,11 @@ Convert a `QkComplex64` to a compiler-native complex number representation. Note ### Example -Assuming a GNU/clang compiler with `double complex` as native complex number, we have +Assuming a GNU/clang compiler with `complex double` as native complex number, we have ```c QkComplex64 qk_value = {1, 1}; // represents 1 + i -double complex value = qk_complex64_to_native(&qk_value); +complex double value = qk_complex64_to_native(&qk_value); ``` ### Safety @@ -65,10 +65,10 @@ Convert a compiler-native complex number to a `QkComplex64`. Note that `CMPLX_DO ### Example -Assuming a GNU/clang compiler with `double complex` as native complex number, we have +Assuming a GNU/clang compiler with `complex double` as native complex number, we have ```c -double complex value = 1 + I; +complex double value = 1 + I; QkComplex64 qk_value = qk_complex64_from_native(&value); ``` diff --git a/docs/api/qiskit-c/dev/qk-elide-permutations-result.mdx b/docs/api/qiskit-c/dev/qk-elide-permutations-result.mdx new file mode 100644 index 00000000000..76889e89fea --- /dev/null +++ b/docs/api/qiskit-c/dev/qk-elide-permutations-result.mdx @@ -0,0 +1,102 @@ +--- +title: QkElidePermutationsResult (dev version) +description: API reference for QkElidePermutationsResult in the dev version of qiskit-c +in_page_toc_min_heading_level: 2 +python_api_type: module +python_api_name: QkElidePermutationsResult +--- + +# QkElidePermutationsResult + +```c +typedef struct QkElidePermutationsResult QkElidePermutationsResult +``` + +When running the `qk_transpiler_pass_standalone_elide_permutations` function it returns a modified circuit and a permutation array as a QkElidePermutationsResult object. This object contains the outcome of the transpiler pass, whether the pass was able to elide any gates or not, and what the results of that elision were. + +## Functions + +### qk\_elide\_permutations\_result\_elided\_gates + + + Check whether the elide permutations was able to elide anything + + + + #### Safety + + + + Behavior is undefined if `result` is not a valid, non-null pointer to a `QkElidePermutationsResult`. + + **Parameters** + + **result** – a pointer to the result + + **Returns** + + `true` if the `qk_transpiler_pass_standalone_elide_permutations()` run elided any gates + + +### qk\_elide\_permutations\_result\_circuit + + + Get the circuit from the elide permutations result + + + + #### Safety + + + + Behavior is undefined if `result` is not a valid, non-null pointer to a `QkElidePermutationsResult`. The pointer to the returned circuit is owned by the result object, it should not be passed to `qk_circuit_free()` as it will be freed by `qk_elide_permutations_result_free()`. + + **Parameters** + + **result** – a pointer to the result of the pass. It must have elided gates as checked by `qk_elide_permutations_result_elided_gates()` + + **Returns** + + A pointer to the circuit with the permutation gates elided + + +### qk\_elide\_permutations\_result\_permutation + + + Get the permutation array for the elided gates + + + + #### Safety + + + + Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkElidePermutationsResult`. Also qubit must be a valid qubit for the circuit and there must be a result found. The pointer to the permutation array is owned by the result object, it should not be passed to `free()` as it will be freed by `qk_elide_permutations_result_free()` when that is called. + + **Parameters** + + **result** – a pointer to the result of the pass. It must have elided gates as checked by `qk_elide_permutations_result_elided_gates()` + + **Returns** + + A pointer to the permutation array caused by the swap elision performed by the pass. This array has a length equal to the number of qubits of the circuit returned by `qk_elide_permutations_result_elided_gates()` (or the circuit passed into `qk_transpiler_pass_standalone_elide_permutations()`). The permutation array maps the virtual qubit in the original circuit at each index to its new output position after all the elision performed by the pass. For example, and array of `[2, 1, 0]` means that qubit 0 is now in qubit 2 on the output of the circuit and qubit 2’s is now at 0 (qubit 1 remains unchanged) + + +### qk\_elide\_permutations\_result\_free + + + Free a `QkElidePermutationsResult` object + + + + #### Safety + + + + Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkElidePermutationsResult`. + + **Parameters** + + **result** – a pointer to the result object to free + + diff --git a/docs/api/qiskit-c/dev/qk-obs.mdx b/docs/api/qiskit-c/dev/qk-obs.mdx index a4d5f3ad998..c3d2c752df6 100644 --- a/docs/api/qiskit-c/dev/qk-obs.mdx +++ b/docs/api/qiskit-c/dev/qk-obs.mdx @@ -72,26 +72,26 @@ These cases are not special, they’re fully consistent with the rules and shoul For any given mathematical observable, there are several ways of representing it with `QkObs`. For example, the same set of single-bit terms and their corresponding indices might appear multiple times in the observable. Mathematically, this is equivalent to having only a single term with all the coefficients summed. Similarly, the terms of the sum in a `QkObs` can be in any order while representing the same observable, since addition is commutative (although while floating-point addition is not associative, `QkObs` makes no guarantees about the summation order). -These two categories of representation degeneracy can cause the operator equality, `qk_obs_equal`, to claim that two observables are not equal, despite representating the same object. In these cases, it can be convenient to define some *canonical form*, which allows observables to be compared structurally. You can put a `QkObs` in canonical form by using the `qk_obs_canonicalize` function. The precise ordering of terms in canonical ordering is not specified, and may change between versions of Qiskit. Within the same version of Qiskit, however, you can compare two observables structurally by comparing their simplified forms. +These two categories of representation degeneracy can cause the operator equality, `qk_obs_equal`, to claim that two observables are not equal, despite representing the same object. In these cases, it can be convenient to define some *canonical form*, which allows observables to be compared structurally. You can put a `QkObs` in canonical form by using the `qk_obs_canonicalize` function. The precise ordering of terms in canonical ordering is not specified, and may change between versions of Qiskit. Within the same version of Qiskit, however, you can compare two observables structurally by comparing their simplified forms. If you wish to account for floating-point tolerance in the comparison, it is safest to use a recipe such as: ```c bool equivalent(QkObs *left, QkObs *right, double tol) { - // compare a canonicalized version of left - right to the zero observable - QkObs *neg_right = qk_obs_mul(right, -1); - QkObs *diff = qk_obs_add(left, neg_right); - QkObs *canonical = qk_obs_canonicalize(diff, tol); - - QkObs *zero = qk_obs_zero(qk_obs_num_qubits(left)); - bool equiv = qk_obs_equal(diff, zero); - // free all temporary variables - qk_obs_free(neg_right); - qk_obs_free(diff); - qk_obs_free(canonical); - qk_obs_free(zero); - return equiv; + // compare a canonicalized version of left - right to the zero observable + QkObs *neg_right = qk_obs_multiply(right, &(QkComplex64){-1, 0}); + QkObs *diff = qk_obs_add(left, neg_right); + QkObs *canonical = qk_obs_canonicalize(diff, tol); + + QkObs *zero = qk_obs_zero(qk_obs_num_qubits(left)); + bool equiv = qk_obs_equal(diff, zero); + // free all temporary variables + qk_obs_free(neg_right); + qk_obs_free(diff); + qk_obs_free(canonical); + qk_obs_free(zero); + return equiv; } ``` @@ -197,14 +197,13 @@ for (size_t i = 0; i < num_terms; i++) { uint32_t num_qubits = 100; uint64_t num_terms = 2; // we have 2 terms: |01><01|, -1 * |+-><+-| uint64_t num_bits = 4; // we have 4 non-identity bits: 0, 1, +, - - - complex double coeffs[2] = {1, -1}; + QkComplex64 coeffs = {1, -1}; QkBitTerm bits[4] = {QkBitTerm_Zero, QkBitTerm_One, QkBitTerm_Plus, QkBitTerm_Minus}; + uint32_t indices[4] = {0, 1, 98, 99}; // <-- e.g. {1, 0, 99, 98} would be invalid size_t boundaries[3] = {0, 2, 4}; - QkObs *obs = qk_obs_new( - num_qubits, num_terms, num_bits, coeffs, bits, indices, boundaries + num_qubits, num_terms, num_bits, &coeffs, bits, indices, boundaries ); ``` @@ -216,7 +215,7 @@ for (size_t i = 0; i < num_terms; i++) { Behavior is undefined if any of the following conditions are violated: - * `coeffs` is a pointer to a `complex double` array of length `num_terms` + * `coeffs` is a pointer to a `QkComplex64` array of length `num_terms` * `bit_terms` is a pointer to an array of valid `QkBitTerm` elements of length `num_bits` * `indices` is a pointer to a `uint32_t` array of length `num_bits`, which is term-wise sorted in strict ascending order, and every element is smaller than `num_qubits` * `boundaries` is a pointer to a `size_t` array of length `num_terms + 1`, which is sorted in ascending order, the first element is 0 and the last element is smaller than `num_terms` @@ -276,10 +275,10 @@ for (size_t i = 0; i < num_terms; i++) { uint32_t num_qubits = 100; QkObs *obs = qk_obs_zero(num_qubits); - complex double coeff = 1; + QkComplex64 coeff = {1, 0}; QkBitTerm bit_terms[3] = {QkBitTerm_X, QkBitTerm_Y, QkBitTerm_Z}; uint32_t indices[3] = {0, 1, 2}; - QkObsTerm term = {&coeff, 3, bit_terms, indices, num_qubits}; + QkObsTerm term = {coeff, 3, bit_terms, indices, num_qubits}; int exit_code = qk_obs_add_term(obs, &term); ``` @@ -444,7 +443,7 @@ for (size_t i = 0; i < num_terms; i++) { Get a pointer to the coefficients. - 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 `complex double`. + 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`. @@ -453,10 +452,10 @@ for (size_t i = 0; i < num_terms; i++) { ```c QkObs *obs = qk_obs_identity(100); size_t num_terms = qk_obs_num_terms(obs); - complex double *coeffs = qk_obs_coeffs(obs); + QkComplex64 *coeffs = qk_obs_coeffs(obs); for (size_t i = 0; i < num_terms; i++) { - printf("%f + i%f\n", creal(coeffs[i]), cimag(coeffs[i])); + printf("%f + i%f\n", coeffs[i].re, coeffs[i].im); } ``` @@ -488,14 +487,16 @@ for (size_t i = 0; i < num_terms; i++) { #### Example + + ```c uint32_t num_qubits = 100; QkObs *obs = qk_obs_zero(num_qubits); - complex double coeff = 1; + QkComplex64 coeff = {1, 0}; QkBitTerm bit_terms[3] = {QkBitTerm_X, QkBitTerm_Y, QkBitTerm_Z}; - uint32_t indices[3] = {0, 1, 2}; - QkObsTerm term = {&coeff, 3, bit_terms, indices, num_qubits}; + uint32_t term_indices[3] = {0, 1, 2}; + QkObsTerm term = {coeff, 3, bit_terms, term_indices, num_qubits}; qk_obs_add_term(obs, &term); size_t len = qk_obs_len(obs); @@ -504,7 +505,9 @@ for (size_t i = 0; i < num_terms; i++) { for (size_t i = 0; i < len; i++) { printf("index %i: %i\n", i, indices[i]); } + ``` + ```c qk_obs_free(obs); ``` @@ -540,14 +543,14 @@ for (size_t i = 0; i < num_terms; i++) { uint32_t num_qubits = 100; QkObs *obs = qk_obs_zero(num_qubits); - complex double coeff = 1; + QkComplex64 coeff = {1, 0}; QkBitTerm bit_terms[3] = {QkBitTerm_X, QkBitTerm_Y, QkBitTerm_Z}; uint32_t indices[3] = {0, 1, 2}; - QkObsTerm term = {&coeff, 3, bit_terms, indices, num_qubits}; + QkObsTerm term = {coeff, 3, bit_terms, indices, num_qubits}; qk_obs_add_term(obs, &term); size_t num_terms = qk_obs_num_terms(obs); - uint32_t *boundaries = qk_obs_boundaries(obs); + uintptr_t *boundaries = qk_obs_boundaries(obs); for (size_t i = 0; i < num_terms + 1; i++) { printf("boundary %i: %i\n", i, boundaries[i]); @@ -586,10 +589,10 @@ for (size_t i = 0; i < num_terms; i++) { uint32_t num_qubits = 100; QkObs *obs = qk_obs_zero(num_qubits); - complex double coeff = 1; + QkComplex64 coeff = {1, 0}; QkBitTerm bit_terms[3] = {QkBitTerm_X, QkBitTerm_Y, QkBitTerm_Z}; uint32_t indices[3] = {0, 1, 2}; - QkObsTerm term = {&coeff, 3, bit_terms, indices, num_qubits}; + QkObsTerm term = {coeff, 3, bit_terms, indices, num_qubits}; qk_obs_add_term(obs, &term); size_t len = qk_obs_len(obs); @@ -630,7 +633,7 @@ for (size_t i = 0; i < num_terms; i++) { ```c QkObs *obs = qk_obs_identity(100); - complex double coeff = 2; + QkComplex64 coeff = {2, 0}; QkObs *result = qk_obs_multiply(obs, &coeff); ``` @@ -643,7 +646,7 @@ for (size_t i = 0; i < num_terms; i++) { Behavior is undefined if any of the following is violated * `obs` is a valid, non-null pointer to a `QkObs` - * `coeff` is a valid, non-null pointer to a `complex double` + * `coeff` is a valid, non-null pointer to a `QkComplex64` **Parameters** @@ -770,7 +773,7 @@ for (size_t i = 0; i < num_terms; i++) { QkObs *two = qk_obs_add(iden, iden); double tol = 1e-6; - QkObs *canonical = qk_obs_canonicalize(two); + QkObs *canonical = qk_obs_canonicalize(two, tol); ``` diff --git a/docs/api/qiskit-c/dev/qk-quantum-register.mdx b/docs/api/qiskit-c/dev/qk-quantum-register.mdx index 882e9418f47..29d24ba39e2 100644 --- a/docs/api/qiskit-c/dev/qk-quantum-register.mdx +++ b/docs/api/qiskit-c/dev/qk-quantum-register.mdx @@ -16,10 +16,22 @@ A common way to instantiate several bits at once is to create a register. A regi You can create a register by calling `qk_quantum_register_new()`, for example: +```c +#include + +QkQuantumRegister *qreg = qk_quantum_register_new(5, "my_qreg"); +``` + Which creates a new 5 qubit register named `"my_qreg"`. Then to add the register to a circuit you use the `qk_circuit_add_quantum_register()` function: +```c +QkCircuit *qc = qk_circuit_new(0, 0); +qk_circuit_add_quantum_register(qc, qreg); +uint32_t num_qubits = qk_circuit_num_qubits(qc); // 5 +``` + While circuits track registers, the registers themselves impart almost no behavioral differences on circuits. ## Functions diff --git a/docs/api/qiskit-c/dev/qk-target-entry.mdx b/docs/api/qiskit-c/dev/qk-target-entry.mdx index e233cb11fd8..379e2da0ad1 100644 --- a/docs/api/qiskit-c/dev/qk-target-entry.mdx +++ b/docs/api/qiskit-c/dev/qk-target-entry.mdx @@ -25,10 +25,10 @@ QkTargetEntry *entry = qk_target_entry_new(QkGate_CX); // Add mapping between (0,1) and properties duration of 10e-9 and unknown error. uint32_t qargs[2] = {0, 1}; -qk_target_entry_add(entry, qargs, 2, 10e-9, NAN); +qk_target_entry_add_property(entry, qargs, 2, 10e-9, NAN); // Add mapping between Global, and no set duration NAN and error of 0.003) -qk_target_entry_add(entry, NULL, 0, NAN, 0.003); +qk_target_entry_add_property(entry, NULL, 0, NAN, 0.003); ``` ## Functions @@ -36,9 +36,9 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); ### qk\_target\_entry\_new - Creates an entry to the `QkTarget` based on a `QkGate` instance with no parameters. + Creates an entry to the `QkTarget` based on a `QkGate` instance. - + #### Example @@ -46,13 +46,9 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); QkTargetEntry *entry = qk_target_entry_new(QkGate_H); ``` - - If the instance of `QkGate` uses fixed parameters, use `qk_target_entry_new_fixed`. Regular parameters are not currently supported. - - **Parameters** - **operation** – The `QkGate` whose properties this target entry defines. + **operation** – The `QkGate` whose properties this target entry defines. If the `QkGate` takes parameters (which can be checked with `qk_gate_num_params`) it will be added as a an instruction on the target which accepts any parameter value. If the gate only accepts a fixed parameter value you can use `qk_target_entry_new_fixed` instead. **Returns** @@ -64,7 +60,7 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); Creates a new entry for adding a measurement instruction to a `QkTarget`. - + #### Example @@ -92,7 +88,7 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); Creates a new entry for adding a reset instruction to a `QkTarget`. - + #### Example @@ -118,24 +114,24 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); ### qk\_target\_entry\_new\_fixed - Creates an entry to the `QkTarget` based on a `QkGate` instance with no parameters. + Creates an entry in the `QkTarget` based on a `QkGate` instance with no parameters. - + #### Example ```c double crx_params[1] = {3.14}; - QkTargetEntry *entry = qk_target_entry_new(QkGate_CRX, crx_params); + QkTargetEntry *entry = qk_target_entry_new_fixed(QkGate_CRX, crx_params); ``` - + #### Safety - + - The `params` type is expected to be a pointer to an array of `double` where the length matches the the expectations of the `QkGate`. If the array is insufficently long the behavior of this function is undefined as this will read outside the bounds of the array. It can be a null pointer if there are no params for a given gate. You can check `qk_gate_num_params` to determine how many qubits are required for a given gate. + 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. Adding a `QkGate` with regular parameters is not currently supported. @@ -156,7 +152,7 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); Retrieves the number of properties stored in the target entry. - + #### Example @@ -166,11 +162,11 @@ qk_target_entry_add(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. @@ -188,7 +184,7 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); Frees the entry. - + #### Example @@ -197,11 +193,11 @@ qk_target_entry_add(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. @@ -219,7 +215,7 @@ qk_target_entry_add(entry, NULL, 0, NAN, 0.003); Adds an instruction property instance based on its assigned qargs. - + #### Example @@ -229,11 +225,11 @@ qk_target_entry_add(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. diff --git a/docs/api/qiskit-c/dev/qk-target.mdx b/docs/api/qiskit-c/dev/qk-target.mdx index 775df13638d..40a9675b21e 100644 --- a/docs/api/qiskit-c/dev/qk-target.mdx +++ b/docs/api/qiskit-c/dev/qk-target.mdx @@ -12,7 +12,7 @@ python_api_name: QkTarget typedef struct QkTarget QkTarget ``` -A mapping of instructions and properties representing the partiucular constraints of a backend. Its purpose is to provide the compiler with information that allows it to compile an input circuit into another that is optimized taking in consideration the `QkTarget`’s specifications. This structure represents a low level interface to the main Target data structure in Rust, which represents the base class for its Python counterpart, [`Target`](/docs/api/qiskit/dev/qiskit.transpiler.Target#qiskit.transpiler.Target "qiskit.transpiler.Target"). +A mapping of instructions and properties representing the particular constraints of a backend. Its purpose is to provide the compiler with information that allows it to compile an input circuit into another that is optimized taking in consideration the `QkTarget`’s specifications. This structure represents a low level interface to the main Target data structure in Rust, which represents the base class for its Python counterpart, [`Target`](/docs/api/qiskit/dev/qiskit.transpiler.Target#qiskit.transpiler.Target "qiskit.transpiler.Target"). Here’s an example of how this structure works: @@ -27,7 +27,7 @@ QkTarget *target = qk_target_new(2); // error = NaN uint32_t qargs[2] = {0, 1}; QkTargetEntry *entry = qk_target_entry_new(QkGate_CX); -qk_target_entry_add(entry, qargs, 2, 0.0123, NAN); +qk_target_entry_add_property(entry, qargs, 2, 0.0123, NAN); // Add a CX Gate to the target qk_target_add_instruction(target, entry); @@ -48,7 +48,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 @@ -70,7 +70,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the number of qubits of this `QkTarget`. - + #### Example @@ -79,11 +79,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`. @@ -101,7 +101,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the dt value of this `QkTarget`. - + #### Example @@ -111,11 +111,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`. @@ -125,7 +125,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei **Returns** - The dt value of this `QkTarget` or `NaN` if not assigned. + The dt value of this `QkTarget` or `NAN` if not assigned. ### qk\_target\_granularity @@ -133,7 +133,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the granularity value of this `QkTarget`. - + #### Example @@ -143,11 +143,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`. @@ -165,7 +165,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the `min_length` value of this `QkTarget`. - + #### Example @@ -175,11 +175,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`. @@ -197,7 +197,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the `pulse_alignment` value of this `QkTarget`. - + #### Example @@ -207,11 +207,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`. @@ -229,7 +229,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the `acquire_alignment` value of this `QkTarget`. - + #### Example @@ -239,11 +239,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`. @@ -261,7 +261,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Sets the dt value of this `QkTarget`. - + #### Example @@ -270,11 +270,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`. @@ -293,7 +293,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Sets the `granularity` value of this `QkTarget`. - + #### Example @@ -303,11 +303,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`. @@ -326,7 +326,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Sets the `min_length` value of this `QkTarget`. - + #### Example @@ -336,11 +336,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`. @@ -359,7 +359,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the `pulse_alignment` value of this `QkTarget`. - + #### Example @@ -369,11 +369,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`. @@ -392,19 +392,21 @@ The Target C API currently only supports additions of `QkGate` instances with ei Sets the `acquire_alignment` value of this `QkTarget`. - + #### Example - - - QkTarget \*target = qk\_target\_new(5); // The value defaults to 0 qk\_target\_set\_acquire\_alignment(target, 5); + ```c + QkTarget *target = qk_target_new(5); + // The value defaults to 0 + qk_target_set_acquire_alignment(target, 5); + ``` - + #### Safety - + Behavior is undefined if `QkTarget` is not a valid, non-null pointer to a `QkTarget`. @@ -423,7 +425,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Creates a copy of the `QkTarget`. - + #### Example @@ -437,11 +439,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`. @@ -459,7 +461,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Free the `QkTarget`. - + #### Example @@ -468,11 +470,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`. @@ -486,7 +488,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Adds a gate to the `QkTarget` through a `QkTargetEntry`. - + #### Example @@ -498,11 +500,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`. @@ -523,7 +525,7 @@ The Target C API currently only supports additions of `QkGate` instances with ei Modifies the properties of a gate in the `QkTarget`. - + #### Example @@ -535,18 +537,18 @@ The Target C API currently only supports additions of `QkGate` instances with ei qk_target_entry_add_property(entry, qargs, 2, 0.0, 0.1); qk_target_add_instruction(target, entry); - qk_target_update_property(target, QkGate_CRX, qargs, 2, 0.0012, 1.1) + 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`. - The `qargs` type is expected to be a pointer to an array of `uint32_t` where the length matches is specified by `num_qubits` and has to match the expectation of the gate. If the array is insufficently long the behavior of this function is undefined as this will read outside the bounds of the array. It can be a null pointer if there are no qubits for a given gate. You can check `qk_gate_num_qubits` to determine how many qubits are required for a given gate. + The `qargs` type is expected to be a pointer to an array of `uint32_t` where the length matches is specified by `num_qubits` and has to match the expectation of the 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 for a given gate. You can check `qk_gate_num_qubits` to determine how many qubits are required for a given gate. **Parameters** @@ -567,23 +569,23 @@ The Target C API currently only supports additions of `QkGate` instances with ei Returns the number of instructions tracked by a `QkTarget`. - + #### Example ```c QkTarget *target = qk_target_new(5); - QkTargetEntry *target_enty = qk_target_entry_new(QkGate_H); + QkTargetEntry *target_entry = qk_target_entry_new(QkGate_H); qk_target_add_instruction(target, target_entry); 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`. diff --git a/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx b/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx index c562042800d..a40d8604643 100644 --- a/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx +++ b/docs/api/qiskit-c/dev/qk-transpiler-passes.mdx @@ -18,6 +18,109 @@ The Qiskit C API provides functions that execute transpiler passes in a standalo ## Functions +### qk\_transpiler\_pass\_standalone\_elide\_permutations + + + Run the ElidePermutations transpiler pass on a circuit. + + The ElidePermutations transpiler pass removes any permutation operations from a pre-layout circuit. + + 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 circuit and when a Swap gate is encountered it permutes the virtual qubits in the circuit and removes the swap gate. This will effectively remove any swap gates in the circuit prior to running layout. This optimization is not valid after a layout has been set and should not be run in this case. + + + + #### Example + + ```c + QkCircuit *qc = qk_circuit_new(4, 0); + for (uint32_t i = 0; i < qk_circuit_num_qubits(qc) - 1; i++) { + uint32_t qargs[2] = {i, i + 1}; + for (uint32_t j = 0; j + + #### Safety + + + + Behavior is undefined if `circuit` is not a valid, non-null pointer to a `QkCircuit`. + + **Parameters** + + **circuit** – A pointer to the circuit to run ElidePermutations on + + **Returns** + + QkElidePermutationsResult object that contains the results of the pass + + +### qk\_transpiler\_pass\_standalone\_remove\_identity\_equivalent + + + Run the RemoveIdentityEquivalent transpiler pass on a circuit. + + Removes gates whose effect is close to an identity operation up to a global phase and up to the specified tolerance. Parameterized gates are not considered by this pass. + + For a cutoff fidelity $f$, this pass removes gates whose average gate fidelity with respect to the identity is below $f$. Concretely, a gate $G$ is removed if $\bar F < f$ where + +$$ + +bar{F} = \frac{1 + d F_{\text{process}}}{1 + d},\ + +F_{\text{process}} = \frac{|\mathrm{Tr}(G)|^2}{d^2} + +$$ + + where $d = 2^n$ is the dimension of the gate for $n$ qubits. + + + + #### Example + + ```c + QkTarget *target = qk_target_new(5); + uint32_t current_num_qubits = qk_target_num_qubits(target); + QkTargetEntry *cx_entry = qk_target_entry_new(QkGate_CX); + for (uint32_t i = 0; i < current_num_qubits - 1; i++) { + uint32_t qargs[2] = {i, i + 1}; + double inst_error = 0.0090393 * (current_num_qubits - i); + double inst_duration = 0.020039; + qk_target_entry_add_property(cx_entry, qargs, 2, inst_duration, inst_error); + } + QkExitCode result_cx = qk_target_add_instruction(target, cx_entry); + QkCircuit *qc = qk_circuit_new(4, 0); + for (uint32_t i = 0; i < qk_circuit_num_qubits(qc) - 1; i++) { + uint32_t qargs[2] = {i, i + 1}; + for (uint32_t j = 0; j + + #### Safety + + + + Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`. + + **Parameters** + + * **circuit** – A pointer to the circuit to run RemoveIdentityEquivalent on. This circuit pointed to will be updated with the modified circuit if the pass is able to remove any gates. + * **target** – The target for the RemoveIdentityEquivalent pass. If `approximation_degree` is set to `NAN` the tolerance for determining whether an operation is equivalent to identity will be set to the reported error rate in the target. Otherwise the `target` is not used as the tolerance is independent of the target. + * **approximation\_degree** – The degree to approximate for the equivalence check. This can be a floating point value between 0 and 1, or `NAN`. If the value is 1 this does not approximate above the floating point precision. For a value \< 1 this is used as a scaling factor for the cutoff fidelity. If the value is `NAN` this approximates up to the fidelity for the gate specified in `target`. + + ### qk\_transpiler\_pass\_standalone\_vf2\_layout @@ -29,12 +132,13 @@ The Qiskit C API provides functions that execute transpiler passes in a standalo By default, this pass will construct a heuristic scoring map based on the error rates in the provided `target` argument. The function will continue searching for layouts and use the heuristic scoring to return the layout which will run with the best estimated fidelity. - + #### Example ```c - QkTarget *target = qk_target_new(5) + QkTarget *target = qk_target_new(5); + uint32_t current_num_qubits = qk_target_num_qubits(target); QkTargetEntry *cx_entry = qk_target_entry_new(QkGate_CX); for (uint32_t i = 0; i < current_num_qubits - 1; i++) { uint32_t qargs[2] = {i, i + 1}; @@ -54,11 +158,11 @@ The Qiskit C API provides functions that execute transpiler passes in a standalo qk_vf2_layout_result_free(layout_result); ``` - + #### Safety - + Behavior is undefined if `circuit` or `target` is not a valid, non-null pointer to a `QkCircuit` and `QkTarget`. @@ -66,7 +170,7 @@ The Qiskit C API provides functions that execute transpiler passes in a standalo * **circuit** – A pointer to the circuit to run VF2Layout on * **target** – A pointer to the target to run the VF2Layout pass on - * **strict\_direction** – If true the pass will consider the edge direction in the connectivity described in the `target`. Typically setting this to `false` is desireable as an undirected search has more degrees of freedom and is more likely to find a layout (or a better layout if there are multiple choices) and correcting directionality is a simple operation for later transpilation stages. + * **strict\_direction** – If true the pass will consider the edge direction in the connectivity described in the `target`. Typically setting this to `false` is desirable as an undirected search has more degrees of freedom and is more likely to find a layout (or a better layout if there are multiple choices) and correcting directionality is a simple operation for later transpilation stages. * **call\_limit** – The number of state visits to attempt in each execution of the VF2 algorithm. If the value is set to a negative value the VF2 algorithm will run without any limit. * **time\_limit** – The total time in seconds to run for `VF2Layout`. This is checked after each layout search so it is not a hard time limit, but a soft limit that when checked if the set time has elapsed the function will return the best layout it has found so far. Set this to a value less than or equal to 0.0 to run without any time limit. * **max\_trials** – The maximum number of trials to run the VF2 algorithm to try and find layouts. If the value is negative this will be treated as unbounded which means the algorithm will run until all possible layouts are scored. If the value is 0 the number of trials will be limited based on the number of edges in the interaction or the coupling graph (whichever is larger). diff --git a/docs/api/qiskit-c/dev/qk-vf-2-layout-result.mdx b/docs/api/qiskit-c/dev/qk-vf-2-layout-result.mdx index 49b4838ca84..add6e944ab4 100644 --- a/docs/api/qiskit-c/dev/qk-vf-2-layout-result.mdx +++ b/docs/api/qiskit-c/dev/qk-vf-2-layout-result.mdx @@ -21,11 +21,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns Check whether a result was found. - + #### Safety - + Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2LayoutResult`. @@ -43,11 +43,11 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns Get the number of virtual qubits in the layout. - + #### Safety - + Behavior is undefined if `layout` is not a valid, non-null pointer to a `QkVF2LayoutResult`. The result must have a layout found. @@ -65,11 +65,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`. Also qubit must be a valid qubit for the circuit and there must be a result found. @@ -88,7 +88,7 @@ When running the `qk_transpiler_pass_standalone_vf2_layout` function it returns Free a `QkVF2LayoutResult` object - + #### Example @@ -96,11 +96,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/execution-span-double-slice-span.mdx b/docs/api/qiskit-ibm-runtime/dev/execution-span-double-slice-span.mdx index 659ec9a74c5..a40284d933b 100644 --- a/docs/api/qiskit-ibm-runtime/dev/execution-span-double-slice-span.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/execution-span-double-slice-span.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.DoubleSliceSpan # DoubleSliceSpan - + Bases: [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.execution_span.ExecutionSpan") An [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.ExecutionSpan") for data stored in a sliceable format. @@ -53,7 +53,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.DoubleSliceSpan ### contains\_pub - + Return whether the pub with the given index has data with dependence on this span. **Parameters** @@ -71,7 +71,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.DoubleSliceSpan ### filter\_by\_pub - + Return a new span whose slices are filtered to the provided pub indices. For example, if this span contains slice information for pubs with indices 1, 3, 4 and `[1, 4]` is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise. @@ -91,7 +91,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.DoubleSliceSpan ### mask - + Return an array-valued mask specifying which parts of a pub result depend on this span. **Parameters** @@ -102,6 +102,10 @@ python_api_name: qiskit_ibm_runtime.execution_span.DoubleSliceSpan An array with the same shape as the pub data. + **Raises** + + **KeyError** – if the pub is not included in the span + **Return type** [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)")\[*Any*, [*dtype*](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype "(in NumPy v2.3)")\[[*bool*](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.bool "(in NumPy v2.3)")]] diff --git a/docs/api/qiskit-ibm-runtime/dev/execution-span-execution-span.mdx b/docs/api/qiskit-ibm-runtime/dev/execution-span-execution-span.mdx index 8337b23d430..feec9309710 100644 --- a/docs/api/qiskit-ibm-runtime/dev/execution-span-execution-span.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/execution-span-execution-span.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan # ExecutionSpan - + Bases: `ABC` Abstract parent for classes that store an execution time span for a subset of job data. @@ -66,7 +66,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan ### contains\_pub - + Return whether the pub with the given index has data with dependence on this span. **Parameters** @@ -84,7 +84,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan ### filter\_by\_pub - + Return a new span whose slices are filtered to the provided pub indices. For example, if this span contains slice information for pubs with indices 1, 3, 4 and `[1, 4]` is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise. @@ -104,7 +104,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan ### mask - + Return an array-valued mask specifying which parts of a pub result depend on this span. **Parameters** @@ -115,6 +115,10 @@ python_api_name: qiskit_ibm_runtime.execution_span.ExecutionSpan An array with the same shape as the pub data. + **Raises** + + **KeyError** – if the pub is not included in the span + **Return type** [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)")\[*Any*, [*dtype*](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype "(in NumPy v2.3)")\[[*bool*](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.bool "(in NumPy v2.3)")]] diff --git a/docs/api/qiskit-ibm-runtime/dev/execution-span-slice-span.mdx b/docs/api/qiskit-ibm-runtime/dev/execution-span-slice-span.mdx index 0abc0fd67c7..ba38b3d53cb 100644 --- a/docs/api/qiskit-ibm-runtime/dev/execution-span-slice-span.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/execution-span-slice-span.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.SliceSpan # SliceSpan - + Bases: [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.execution_span.ExecutionSpan") An [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.ExecutionSpan") for data stored in a sliceable format. @@ -53,7 +53,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.SliceSpan ### contains\_pub - + Return whether the pub with the given index has data with dependence on this span. **Parameters** @@ -71,7 +71,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.SliceSpan ### filter\_by\_pub - + Return a new span whose slices are filtered to the provided pub indices. For example, if this span contains slice information for pubs with indices 1, 3, 4 and `[1, 4]` is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise. @@ -91,7 +91,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.SliceSpan ### mask - + Return an array-valued mask specifying which parts of a pub result depend on this span. **Parameters** @@ -102,6 +102,10 @@ python_api_name: qiskit_ibm_runtime.execution_span.SliceSpan An array with the same shape as the pub data. + **Raises** + + **KeyError** – if the pub is not included in the span + **Return type** [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)")\[*Any*, [*dtype*](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype "(in NumPy v2.3)")\[[*bool*](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.bool "(in NumPy v2.3)")]] diff --git a/docs/api/qiskit-ibm-runtime/dev/execution-span-twirled-slice-span.mdx b/docs/api/qiskit-ibm-runtime/dev/execution-span-twirled-slice-span.mdx index f8f7e2d55b3..3b6cc71807d 100644 --- a/docs/api/qiskit-ibm-runtime/dev/execution-span-twirled-slice-span.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/execution-span-twirled-slice-span.mdx @@ -8,12 +8,12 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan # TwirledSliceSpan - + Bases: [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.execution_span.ExecutionSpan") An [`ExecutionSpan`](execution-span-execution-span "qiskit_ibm_runtime.execution_span.ExecutionSpan") for data stored in a sliceable format when twirling. - This type of execution span references pub result data that came from a twirled sampler experiment which was executed by either prepending or appending an axis to paramater values to account for twirling. Concretely, `data_slices` is a map from pub slices to tuples `(twirled_shape, at_front, shape_slice, shots_slice)` where + This type of execution span references pub result data that came from a twirled sampler experiment which was executed by either prepending or appending an axis to parameter values to account for twirling. Concretely, `data_slices` is a map from pub slices to tuples `(twirled_shape, at_front, shape_slice, shots_slice)` where * `twirled_shape` is the shape tuple including a twirling axis, and where the last axis is shots per randomization, * `at_front` is whether `num_randomizations` is at the front of the tuple, as opposed to right before the `shots` axis at the end, @@ -24,7 +24,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan * **start** (*datetime*) – The start time of the span, in UTC. * **stop** (*datetime*) – The stop time of the span, in UTC. - * **data\_slices** (*dict\[int, tuple\[ShapeType, bool, slice, slice]]*) – A map from pub indices to length-4 tuples described above. + * **data\_slices** (*Mapping\[int, tuple\[ShapeType, bool, slice, slice]]*) – A map from pub indices to length-4 tuples described above. ## Attributes @@ -58,7 +58,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan ### contains\_pub - + Return whether the pub with the given index has data with dependence on this span. **Parameters** @@ -76,7 +76,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan ### filter\_by\_pub - + Return a new span whose slices are filtered to the provided pub indices. For example, if this span contains slice information for pubs with indices 1, 3, 4 and `[1, 4]` is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise. @@ -96,7 +96,7 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan ### mask - + Return an array-valued mask specifying which parts of a pub result depend on this span. **Parameters** @@ -107,6 +107,10 @@ python_api_name: qiskit_ibm_runtime.execution_span.TwirledSliceSpan An array with the same shape as the pub data. + **Raises** + + **KeyError** – if the pub is not included in the span + **Return type** [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)")\[*Any*, [*dtype*](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype "(in NumPy v2.3)")\[[*bool*](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.bool "(in NumPy v2.3)")]] diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-algiers.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-algiers.mdx index 833c02a3d17..b3bc9b497f0 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-algiers.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-algiers.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers # FakeAlgiers - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlgiers ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-almaden-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-almaden-v2.mdx index 46c46f3bafd..00da1b5bde2 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-almaden-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-almaden-v2.mdx @@ -41,10 +41,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -191,7 +187,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -209,7 +205,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 ### configuration - + Return the backend configuration. **Return type** @@ -217,27 +213,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -279,7 +257,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -292,7 +270,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -306,7 +285,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -347,7 +326,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAlmadenV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-armonk-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-armonk-v2.mdx index 1d792739f85..433e8592558 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-armonk-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-armonk-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 # FakeArmonkV2 - + Bases: `FakeBackendV2` A fake 1 qubit backend. @@ -35,10 +35,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -185,7 +181,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -203,7 +199,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 ### configuration - + Return the backend configuration. **Return type** @@ -211,27 +207,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -273,7 +251,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -286,7 +264,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -300,7 +279,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -341,7 +320,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeArmonkV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-athens-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-athens-v2.mdx index 7b336533326..9222a99ee80 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-athens-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-athens-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 # FakeAthensV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAthensV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-auckland.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-auckland.mdx index e380ceb6be5..3c71ab59909 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-auckland.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-auckland.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland # FakeAuckland - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeAuckland ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-belem-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-belem-v2.mdx index 31a05bfff4c..48d19afae84 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-belem-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-belem-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 # FakeBelemV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBelemV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-boeblingen-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-boeblingen-v2.mdx index a75e9c1774f..b508752133e 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-boeblingen-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-boeblingen-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 # FakeBoeblingenV2 - + Bases: `FakeBackendV2` A fake Boeblingen V2 backend. @@ -41,10 +41,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -191,7 +187,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -209,7 +205,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 ### configuration - + Return the backend configuration. **Return type** @@ -217,27 +213,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -279,7 +257,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -292,7 +270,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -306,7 +285,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -347,7 +326,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBoeblingenV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-bogota-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-bogota-v2.mdx index a901473ff4e..a4784842cf9 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-bogota-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-bogota-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 # FakeBogotaV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBogotaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brisbane.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brisbane.mdx index deda2c8baf2..8e478255e28 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brisbane.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brisbane.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane # FakeBrisbane - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrisbane ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brooklyn-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brooklyn-v2.mdx index 3a30c520cee..9e02870b8b3 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brooklyn-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-brooklyn-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 # FakeBrooklynV2 - + Bases: `FakeBackendV2` A fake Brooklyn V2 backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBrooklynV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-burlington-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-burlington-v2.mdx index 8777d55254d..36329f4bcf6 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-burlington-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-burlington-v2.mdx @@ -37,10 +37,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -187,7 +183,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -205,7 +201,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 ### configuration - + Return the backend configuration. **Return type** @@ -213,27 +209,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -275,7 +253,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -288,7 +266,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -302,7 +281,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -343,7 +322,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeBurlingtonV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cairo-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cairo-v2.mdx index 82d001430ec..ae0e51136b4 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cairo-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cairo-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 # FakeCairoV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCairoV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cambridge-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cambridge-v2.mdx index 7ef60ed0ddc..f36cd5bb425 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cambridge-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cambridge-v2.mdx @@ -43,10 +43,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -193,7 +189,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -211,7 +207,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 ### configuration - + Return the backend configuration. **Return type** @@ -219,27 +215,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -281,7 +259,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -294,7 +272,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -308,7 +287,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -349,7 +328,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCambridgeV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-casablanca-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-casablanca-v2.mdx index 978f335f135..42f07f6f171 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-casablanca-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-casablanca-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 # FakeCasablancaV2 - + Bases: `FakeBackendV2` A fake 7 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCasablancaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cusco.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cusco.mdx index e65c7acfc60..8cc557943d2 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cusco.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-cusco.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco # FakeCusco - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeCusco ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-essex-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-essex-v2.mdx index 160f6642cae..f453a74697b 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-essex-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-essex-v2.mdx @@ -39,10 +39,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -189,7 +185,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -207,7 +203,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 ### configuration - + Return the backend configuration. **Return type** @@ -215,27 +211,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -277,7 +255,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -290,7 +268,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -304,7 +283,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -345,7 +324,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeEssexV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fez.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fez.mdx index 91423d0db07..bb29bab450d 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fez.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fez.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez # FakeFez - + Bases: `FakeBackendV2` A fake 156 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFez ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fractional-backend.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fractional-backend.mdx index 11722d79070..04d98ac37fe 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fractional-backend.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-fractional-backend.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend # FakeFractionalBackend - + Bases: `FakeBackendV2` A fake 5 qubit backend with dynamic and fractional feature modeled based on FakeLima. @@ -38,10 +38,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -188,7 +184,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -206,7 +202,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend ### configuration - + Return the backend configuration. **Return type** @@ -214,27 +210,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -276,7 +254,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -289,7 +267,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -303,7 +282,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -344,7 +323,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeFractionalBackend ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-geneva.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-geneva.mdx index 17ab9bf8c5d..c861a1f9f3b 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-geneva.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-geneva.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva # FakeGeneva - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGeneva ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-guadalupe-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-guadalupe-v2.mdx index d96adaa3664..e9e18acdbe1 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-guadalupe-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-guadalupe-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 # FakeGuadalupeV2 - + Bases: `FakeBackendV2` A fake 16 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeGuadalupeV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-hanoi-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-hanoi-v2.mdx index 167cfb54a70..4498590f1af 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-hanoi-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-hanoi-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 # FakeHanoiV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeHanoiV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-jakarta-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-jakarta-v2.mdx index 32369bf232e..552b2f927f7 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-jakarta-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-jakarta-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 # FakeJakartaV2 - + Bases: `FakeBackendV2` A fake 7 qubit V2 backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJakartaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-johannesburg-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-johannesburg-v2.mdx index d2c94d0edd5..3bb07024ae0 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-johannesburg-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-johannesburg-v2.mdx @@ -41,10 +41,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -191,7 +187,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -209,7 +205,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 ### configuration - + Return the backend configuration. **Return type** @@ -217,27 +213,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -279,7 +257,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -292,7 +270,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -306,7 +285,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -347,7 +326,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeJohannesburgV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kawasaki.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kawasaki.mdx index 1bb8306a054..ccbbdfeed2e 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kawasaki.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kawasaki.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki # FakeKawasaki - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKawasaki ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kolkata-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kolkata-v2.mdx index 8329eb4db98..014e9404c35 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kolkata-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kolkata-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 # FakeKolkataV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKolkataV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyiv.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyiv.mdx index 2a489054f19..046d4a931c1 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyiv.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyiv.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv # FakeKyiv - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyiv ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyoto.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyoto.mdx index ab982092ab2..4e5dae5bda7 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyoto.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-kyoto.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto # FakeKyoto - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeKyoto ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lagos-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lagos-v2.mdx index 8b97bed77f9..39dde54d524 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lagos-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lagos-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 # FakeLagosV2 - + Bases: `FakeBackendV2` A fake 7 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLagosV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lima-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lima-v2.mdx index eed7b06a817..258e8db9bcb 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lima-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-lima-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 # FakeLimaV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLimaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-london-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-london-v2.mdx index 25a6195c0e5..802230cb627 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-london-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-london-v2.mdx @@ -39,10 +39,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -189,7 +185,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -207,7 +203,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 ### configuration - + Return the backend configuration. **Return type** @@ -215,27 +211,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -277,7 +255,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -290,7 +268,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -304,7 +283,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -345,7 +324,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeLondonV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manhattan-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manhattan-v2.mdx index ee2d652e3f1..2cfd6637503 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manhattan-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manhattan-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 # FakeManhattanV2 - + Bases: `FakeBackendV2` A fake Manhattan backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManhattanV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manila-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manila-v2.mdx index eba13d875ff..33b310388b0 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manila-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-manila-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 # FakeManilaV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeManilaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-marrakesh.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-marrakesh.mdx index d6720a2b927..f3a3719b277 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-marrakesh.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-marrakesh.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh # FakeMarrakesh - + Bases: `FakeBackendV2` A fake 156 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMarrakesh ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-melbourne-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-melbourne-v2.mdx index 470d7a65fcc..e5648b6f857 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-melbourne-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-melbourne-v2.mdx @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMelbourneV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-montreal-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-montreal-v2.mdx index 6b54d87a5d5..4f552623e34 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-montreal-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-montreal-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 # FakeMontrealV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMontrealV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-mumbai-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-mumbai-v2.mdx index 85140f64429..f5cbeaec1eb 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-mumbai-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-mumbai-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 # FakeMumbaiV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeMumbaiV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-nairobi-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-nairobi-v2.mdx index a7fc300e9ce..a86798c3031 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-nairobi-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-nairobi-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 # FakeNairobiV2 - + Bases: `FakeBackendV2` A fake 7 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeNairobiV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-osaka.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-osaka.mdx index 5090c03dda9..a56fbba5cf7 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-osaka.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-osaka.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka # FakeOsaka - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOsaka ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-oslo.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-oslo.mdx index 23b59c2aede..fa4f07d594b 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-oslo.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-oslo.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo # FakeOslo - + Bases: `FakeBackendV2` A fake 7 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOslo ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-ourense-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-ourense-v2.mdx index 813a3f090d4..599775003a5 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-ourense-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-ourense-v2.mdx @@ -37,10 +37,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -187,7 +183,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -205,7 +201,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 ### configuration - + Return the backend configuration. **Return type** @@ -213,27 +209,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -275,7 +253,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -288,7 +266,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -302,7 +281,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -343,7 +322,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeOurenseV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-paris-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-paris-v2.mdx index 1ef58fbf916..cef17606c9c 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-paris-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-paris-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 # FakeParisV2 - + Bases: `FakeBackendV2` A fake Paris backend. @@ -43,10 +43,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -193,7 +189,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -211,7 +207,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 ### configuration - + Return the backend configuration. **Return type** @@ -219,27 +215,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -281,7 +259,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -294,7 +272,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -308,7 +287,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -349,7 +328,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeParisV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-peekskill.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-peekskill.mdx index 1fd91ed4be8..17fda667e20 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-peekskill.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-peekskill.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill # FakePeekskill - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePeekskill ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-perth.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-perth.mdx index de36a70105c..50f4dc63ebe 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-perth.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-perth.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth # FakePerth - + Bases: `FakeBackendV2` A fake 7 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePerth ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-poughkeepsie-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-poughkeepsie-v2.mdx index 88fdab56315..ba7fa264da1 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-poughkeepsie-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-poughkeepsie-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 # FakePoughkeepsieV2 - + Bases: `FakeBackendV2` A fake Poughkeepsie backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePoughkeepsieV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-prague.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-prague.mdx index 82ab8ea9429..0903960ea01 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-prague.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-prague.mdx @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakePrague ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quebec.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quebec.mdx index fbacfcf8def..edf796099e0 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quebec.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quebec.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec # FakeQuebec - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuebec ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quito-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quito-v2.mdx index 932c6dafaf2..75cb6bf5e36 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quito-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-quito-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 # FakeQuitoV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeQuitoV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rochester-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rochester-v2.mdx index dd755fae780..b6b1c7abde3 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rochester-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rochester-v2.mdx @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRochesterV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rome-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rome-v2.mdx index bd86aff7bdf..11949615116 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rome-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-rome-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 # FakeRomeV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeRomeV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-santiago-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-santiago-v2.mdx index 2186a6df85a..2a71e032ac6 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-santiago-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-santiago-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 # FakeSantiagoV2 - + Bases: `FakeBackendV2` A fake Santiago backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSantiagoV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sherbrooke.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sherbrooke.mdx index 3aa44c2fe01..6af8cdcc330 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sherbrooke.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sherbrooke.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke # FakeSherbrooke - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSherbrooke ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-singapore-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-singapore-v2.mdx index fb6dfc95524..f5d882fd8e9 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-singapore-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-singapore-v2.mdx @@ -41,10 +41,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -191,7 +187,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -209,7 +205,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 ### configuration - + Return the backend configuration. **Return type** @@ -217,27 +213,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -279,7 +257,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -292,7 +270,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -306,7 +285,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -347,7 +326,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSingaporeV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sydney-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sydney-v2.mdx index 7336b292c9d..857fb852e54 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sydney-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-sydney-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 # FakeSydneyV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeSydneyV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-torino.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-torino.mdx index e3564280a66..4d99a9d2dfb 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-torino.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-torino.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino # FakeTorino - + Bases: `FakeBackendV2` A fake 133 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorino ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-toronto-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-toronto-v2.mdx index 84ed49be7b2..97489d2eb92 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-toronto-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-toronto-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 # FakeTorontoV2 - + Bases: `FakeBackendV2` A fake 27 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeTorontoV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-valencia-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-valencia-v2.mdx index 3acd6913217..01841a79f8d 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-valencia-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-valencia-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 # FakeValenciaV2 - + Bases: `FakeBackendV2` A fake 5 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeValenciaV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-vigo-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-vigo-v2.mdx index 242fc942ae9..1b48a593821 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-vigo-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-vigo-v2.mdx @@ -37,10 +37,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -187,7 +183,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -205,7 +201,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 ### configuration - + Return the backend configuration. **Return type** @@ -213,27 +209,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -275,7 +253,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -288,7 +266,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -302,7 +281,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -343,7 +322,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeVigoV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-washington-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-washington-v2.mdx index ad914424523..2d6d0e7f2c6 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-washington-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-washington-v2.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 # FakeWashingtonV2 - + Bases: `FakeBackendV2` A fake 127 qubit backend. @@ -31,10 +31,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -181,7 +177,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -199,7 +195,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 ### configuration - + Return the backend configuration. **Return type** @@ -207,27 +203,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -269,7 +247,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -282,7 +260,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -296,7 +275,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -337,7 +316,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeWashingtonV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-yorktown-v2.mdx b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-yorktown-v2.mdx index c4337ba74a6..b8dd8f1ab29 100644 --- a/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-yorktown-v2.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/fake-provider-fake-yorktown-v2.mdx @@ -39,10 +39,6 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 Return the [`CouplingMap`](/docs/api/qiskit/qiskit.transpiler.CouplingMap "(in Qiskit v2.1)") object - ### defs\_filename - - - ### dirname @@ -189,7 +185,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -207,7 +203,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 ### configuration - + Return the backend configuration. **Return type** @@ -215,27 +211,9 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED)Return the pulse defaults for the backend - - **Parameters** - - **refresh** (*bool*) – If `True`, re-retrieve the backend defaults from the local file. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* - - ### properties - + Return the backend properties **Parameters** @@ -277,7 +255,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 ### refresh - + Update the data files from its real counterpart This method pulls the latest backend data files from their real counterpart and overwrites the corresponding files in the local installation: @@ -290,7 +268,8 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 **Parameters** - **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **service** ([*QiskitRuntimeService*](qiskit-runtime-service "qiskit_ibm_runtime.qiskit_runtime_service.QiskitRuntimeService")) – A `QiskitRuntimeService` instance + * **use\_fractional\_gates** (*bool*) – Set True to allow for the backends to include fractional gates. **Raises** @@ -304,7 +283,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 ### run - + Run on the fake backend using a simulator. This method runs circuit jobs (an individual or a list of QuantumCircuit) using BasicSimulator or Aer simulator and returns a [`Job`](/docs/api/qiskit/qiskit.providers.Job "(in Qiskit v2.1)") object. @@ -345,7 +324,7 @@ python_api_name: qiskit_ibm_runtime.fake_provider.FakeYorktownV2 ### status - + Return the backend status. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/ibm-backend.mdx b/docs/api/qiskit-ibm-runtime/dev/ibm-backend.mdx index 5218b4a27e1..9bffe71c65e 100644 --- a/docs/api/qiskit-ibm-runtime/dev/ibm-backend.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/ibm-backend.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend # IBMBackend - + Bases: [`BackendV2`](/docs/api/qiskit/qiskit.providers.BackendV2 "(in Qiskit v2.1)") Backend class interfacing with an IBM Quantum backend. @@ -296,7 +296,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### \_\_call\_\_ - + Call self as a function. **Return type** @@ -306,7 +306,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### check\_faulty - + Check if the input circuit uses faulty qubits or edges. **Parameters** @@ -324,7 +324,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### configuration - + Return the backend configuration. Backend configuration contains fixed information about the backend, such as its name, number of qubits, basis gates, coupling map, quantum volume, etc. @@ -352,29 +352,9 @@ python_api_name: qiskit_ibm_runtime.IBMBackend *QasmBackendConfiguration* - ### defaults - - - (DEPRECATED) Return the pulse defaults for the backend. - - The schema for default pulse configuration can be found in [Qiskit/ibm-quantum-schemas/default\_pulse\_configuration](https://github.com/Qiskit/ibm-quantum-schemas/blob/main/schemas/default_pulse_configuration_schema.json). - - **Parameters** - - **refresh** (*bool*) – If `True`, re-query the server for the backend pulse defaults. Otherwise, return a cached version. - - **Returns** - - The backend pulse defaults or `None` if the backend does not support pulse. - - **Return type** - - *PulseDefaults* | None - - ### get\_translation\_stage\_plugin - + Return the default translation stage plugin name for IBM backends. **Return type** @@ -384,7 +364,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### properties - + Return the backend properties, subject to optional filtering. This data describes qubits properties (such as T1 and T2), gates properties (such as gate length and error), and other general properties of the backend. @@ -436,7 +416,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### refresh - + Retrieve the newest backend configuration and refresh the current backend target. **Return type** @@ -446,7 +426,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### run - + **Raises** **IBMBackendError** – The run() method is no longer supported. @@ -474,7 +454,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### status - + Return the backend status. @@ -496,7 +476,7 @@ python_api_name: qiskit_ibm_runtime.IBMBackend ### target\_history - + A [`qiskit.transpiler.Target`](/docs/api/qiskit/qiskit.transpiler.Target "(in Qiskit v2.1)") object for the backend. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/qiskit-runtime-service.mdx b/docs/api/qiskit-ibm-runtime/dev/qiskit-runtime-service.mdx index c0d61f96cd0..a71df9f09b0 100644 --- a/docs/api/qiskit-ibm-runtime/dev/qiskit-runtime-service.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/qiskit-runtime-service.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService # QiskitRuntimeService - + Bases: `object` Class for interacting with the Qiskit Runtime service. @@ -87,6 +87,16 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService *Dict*\[str, str] | None + ### active\_instance + + + Return the crn of the current active instance. + + **Return type** + + str + + ### backend @@ -174,7 +184,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### check\_pending\_jobs - + (DEPRECATED) Check the number of pending jobs and wait for the oldest pending job if the maximum number of pending jobs has been reached. **Return type** @@ -204,7 +214,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### delete\_job - + (DEPRECATED) Delete a runtime job. Note that this operation cannot be reversed. @@ -225,7 +235,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### instances - + **Return a list that contains a series of dictionaries with the** following instance identifiers per instance: “crn”, “plan”, “name”. @@ -264,7 +274,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### jobs - + Retrieve all runtime jobs, subject to optional filtering. **Parameters** @@ -274,7 +284,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService * **backend\_name** (*str | None*) – Name of the backend to retrieve jobs from. * **pending** (*bool | None*) – Filter by job pending state. If `True`, ‘QUEUED’ and ‘RUNNING’ jobs are included. If `False`, ‘DONE’, ‘CANCELLED’ and ‘ERROR’ jobs are included. * **program\_id** (*str | None*) – Filter by Program ID. - * **instance** (*str | None*) – (DEPRECATED) This is parameter is no longer supported on the new IBM Quantum Platform. It will be removed in a future release. + * **instance** (*str | None*) – Filter by IBM Cloud instance crn. * **job\_tags** (*List\[str] | None*) – Filter by tags assigned to jobs. Matched jobs are associated with all tags. * **session\_id** (*str | None*) – Filter by session id. All jobs in the session will be returned in desceding order of the job creation date. * **created\_after** (*datetime | None*) – Filter by the given start date, in local time. This is used to find jobs whose creation dates are after (greater than or equal to) this local date/time. @@ -296,7 +306,7 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### least\_busy - + Return the least busy available backend. **Parameters** @@ -382,8 +392,8 @@ python_api_name: qiskit_ibm_runtime.QiskitRuntimeService ### usage - - For the ibm\_quantum channel return monthly open plan usage information. For the ibm\_cloud and ibm\_quantum\_platform channels return usage information for the current active instance. + + Return usage information for the current active instance. **Returns** diff --git a/docs/api/qiskit-ibm-runtime/dev/runtime-decoder.mdx b/docs/api/qiskit-ibm-runtime/dev/runtime-decoder.mdx index 10b71575692..bcfd494705f 100644 --- a/docs/api/qiskit-ibm-runtime/dev/runtime-decoder.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/runtime-decoder.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeDecoder # RuntimeDecoder - + Bases: `JSONDecoder` JSON Decoder used by runtime service. @@ -40,7 +40,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeDecoder ### object\_hook - + Called to decode object. **Parameters** diff --git a/docs/api/qiskit-ibm-runtime/dev/runtime-encoder.mdx b/docs/api/qiskit-ibm-runtime/dev/runtime-encoder.mdx index 3151e7c3f81..2af82f45282 100644 --- a/docs/api/qiskit-ibm-runtime/dev/runtime-encoder.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/runtime-encoder.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeEncoder # RuntimeEncoder - + Bases: `JSONEncoder` JSON Encoder used by runtime service. @@ -45,7 +45,7 @@ python_api_name: qiskit_ibm_runtime.RuntimeEncoder ### default - + Implement this method in a subclass such that it returns a serializable object for `o`, or calls the base implementation (to raise a `TypeError`). For example, to support arbitrary iterators, you could implement default like this: diff --git a/docs/api/qiskit-ibm-runtime/dev/transpiler-passes-fold-rzz-angle.mdx b/docs/api/qiskit-ibm-runtime/dev/transpiler-passes-fold-rzz-angle.mdx index 612a499eaa6..0cd952f23ff 100644 --- a/docs/api/qiskit-ibm-runtime/dev/transpiler-passes-fold-rzz-angle.mdx +++ b/docs/api/qiskit-ibm-runtime/dev/transpiler-passes-fold-rzz-angle.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit_ibm_runtime.transpiler.passes.FoldRzzAngle # FoldRzzAngle - + Bases: [`TransformationPass`](/docs/api/qiskit/qiskit.transpiler.TransformationPass "(in Qiskit v2.1)") Fold Rzz gate angle into calibrated range of 0-pi/2 with local gate tweaks. @@ -92,7 +92,7 @@ python_api_name: qiskit_ibm_runtime.transpiler.passes.FoldRzzAngle ### run - + Run a pass on the DAGCircuit. This is implemented by the pass developer. **Parameters** diff --git a/docs/api/qiskit/dev/_toc.json b/docs/api/qiskit/dev/_toc.json index 3fb689da4e9..fdb217da8a0 100644 --- a/docs/api/qiskit/dev/_toc.json +++ b/docs/api/qiskit/dev/_toc.json @@ -1332,6 +1332,10 @@ "title": "EnlargeWithAncilla", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.EnlargeWithAncilla" }, + { + "title": "Error", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.Error" + }, { "title": "FilterOpNodes", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.FilterOpNodes" @@ -1440,6 +1444,10 @@ "title": "Layout2qDistance", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.Layout2qDistance" }, + { + "title": "LayoutTransformation", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.LayoutTransformation" + }, { "title": "LinearFunctionsToPermutations", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.LinearFunctionsToPermutations" @@ -1460,6 +1468,10 @@ "title": "MCMTSynthesisVChain", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain" }, + { + "title": "MCMTSynthesisXGate", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate" + }, { "title": "MCXSynthesis1CleanB95", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95" @@ -1496,6 +1508,10 @@ "title": "MCXSynthesisNDirtyI15", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15" }, + { + "title": "MCXSynthesisNoAuxHP24", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24" + }, { "title": "MCXSynthesisNoAuxV24", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24" @@ -1556,6 +1572,14 @@ "title": "OptimizeCliffords", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeCliffords" }, + { + "title": "OptimizeCliffordT", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeCliffordT" + }, + { + "title": "OptimizeSwapBeforeMeasure", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeSwapBeforeMeasure" + }, { "title": "PadDelay", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDelay" @@ -1612,6 +1636,10 @@ "title": "ResetAfterMeasureSimplification", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.ResetAfterMeasureSimplification" }, + { + "title": "ResourceEstimation", + "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.ResourceEstimation" + }, { "title": "SabreLayout", "url": "/docs/api/qiskit/dev/qiskit.transpiler.passes.SabreLayout" diff --git a/docs/api/qiskit/dev/circuit.mdx b/docs/api/qiskit/dev/circuit.mdx index 8ffab3cacfc..28dd623429c 100644 --- a/docs/api/qiskit/dev/circuit.mdx +++ b/docs/api/qiskit/dev/circuit.mdx @@ -583,10 +583,10 @@ A circuit can contain manual classical storage locations, represented internally Various parametric [`Instruction`](qiskit.circuit.Instruction "qiskit.circuit.Instruction") instances in Qiskit can be parametrized in ways that are designed to be resolved at compile time. These are characterized by the use of the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") and [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") classes. -| | | -| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")(name, \*\[, uuid]) | A compile-time symbolic parameter. | -| [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression")(symbol\_map, expr, \*\[, ...]) | ParameterExpression class to enable creating expressions of Parameters. | +| | | +| ------------------------------------------------------------------------------------------------ | ---------------------------------- | +| [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") | A compile-time symbolic parameter. | +| [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") | A parameter expression. | The main way that this differs from the `expr.Var` variables used in real-time classical computation is that [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") is a symbolic representation of a mathematical expression. The semantics of the expression are those of regular mathematics over the continuous real numbers (and, in limited cases, over the complex numbers). In contrast, [`Var`](circuit_classical#qiskit.circuit.classical.expr.Var "qiskit.circuit.classical.expr.Var") is a handle to a variable stored on a classical computer, such as a floating-point value or an fixed-width integer, which are always discrete. @@ -596,10 +596,10 @@ The “compile-time” part of these parameters means that you typically will wa You may want to use many parameters that are related to each other. To make this easier (and to avoid you needing to come up with many names), you can use the convenience constructor [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector"). The elements of the vector are all valid [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances, of a special subclass [`ParameterVectorElement`](qiskit.circuit.ParameterVectorElement "qiskit.circuit.ParameterVectorElement"). -| | | -| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector")(name\[, length]) | A container of many related [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects. | -| [`ParameterVectorElement`](qiskit.circuit.ParameterVectorElement "qiskit.circuit.ParameterVectorElement")(vector, index\[, uuid]) | An element of a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector"). | +| | | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector")(name\[, length]) | A container of many related [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects. | +| [`ParameterVectorElement`](qiskit.circuit.ParameterVectorElement "qiskit.circuit.ParameterVectorElement") | An element of a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector"). | diff --git a/docs/api/qiskit/dev/qasm3.mdx b/docs/api/qiskit/dev/qasm3.mdx index 638425987a6..947cdcc2873 100644 --- a/docs/api/qiskit/dev/qasm3.mdx +++ b/docs/api/qiskit/dev/qasm3.mdx @@ -94,7 +94,7 @@ Both of these exporter functions are single-use wrappers around the main [`Expor If `True`, then bits may be contained in more than one register. If so, the registers will be emitted using “alias” definitions, which might not be well supported by consumers of OpenQASM 3. Defaults to `False` or the value of `alias_classical_registers`. - New in version 0.25.0. + * **indent** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – the indentation string to use for each level within an indented block. Can be set to the empty string to disable indentation. @@ -249,7 +249,9 @@ Currently only two high-level functions are offered, as Qiskit support for impor [**QASM3ImporterError**](#qiskit.qasm3.QASM3ImporterError "qiskit.qasm3.QASM3ImporterError") – if the OpenQASM 3 file is invalid, or cannot be represented by a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). - New in version 2.1: The `annotation_handlers` argument. This requires `qiskit_qasm3_import>=0.6.0`. + + The `annotation_handlers` argument. This requires `qiskit_qasm3_import>=0.6.0`. + ### loads @@ -274,7 +276,9 @@ Currently only two high-level functions are offered, as Qiskit support for impor [**QASM3ImporterError**](#qiskit.qasm3.QASM3ImporterError "qiskit.qasm3.QASM3ImporterError") – if the OpenQASM 3 file is invalid, or cannot be represented by a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). - New in version 2.1: The `annotation_handlers` argument. This requires `qiskit_qasm3_import>=0.6.0`. + + The `annotation_handlers` argument. This requires `qiskit_qasm3_import>=0.6.0`. + Both of these two functions raise [`QASM3ImporterError`](#qiskit.qasm3.QASM3ImporterError "qiskit.qasm3.QASM3ImporterError") on failure. diff --git a/docs/api/qiskit/dev/qiskit.circuit.AnnotatedOperation.mdx b/docs/api/qiskit/dev/qiskit.circuit.AnnotatedOperation.mdx index 19a18d6d0b8..8fe703046bb 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.AnnotatedOperation.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.AnnotatedOperation.mdx @@ -156,11 +156,11 @@ python_api_name: qiskit.circuit.AnnotatedOperation **Parameters** - **parameter** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + **parameter** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – **Return type** - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") + [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") diff --git a/docs/api/qiskit/dev/qiskit.circuit.CommutationChecker.mdx b/docs/api/qiskit/dev/qiskit.circuit.CommutationChecker.mdx index d417c5d7af5..4fe0da62612 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.CommutationChecker.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.CommutationChecker.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.circuit.CommutationChecker # CommutationChecker - + Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)") Check commutations of two operations. @@ -39,7 +39,7 @@ $$ ### check\_commutation\_entries - + Returns stored commutation relation if any **Parameters** @@ -60,23 +60,23 @@ $$ ### clear\_cached\_commutations - + Clears the dictionary holding cached commutations ### commute - + Checks if two Operations commute. The return value of True means that the operations truly commute, and the return value of False means that either the operations do not commute or that the commutation check was skipped (for example, when the operations have conditions or have too many qubits). **Parameters** - * **op1** ([*Operation*](qiskit.circuit.Operation "qiskit.circuit.operation.Operation")) – first operation. - * **qargs1** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")) – first operation’s qubits. - * **cargs1** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")) – first operation’s clbits. - * **op2** ([*Operation*](qiskit.circuit.Operation "qiskit.circuit.operation.Operation")) – second operation. - * **qargs2** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")) – second operation’s qubits. - * **cargs2** ([*List*](https://docs.python.org/3/library/typing.html#typing.List "(in Python v3.13)")) – second operation’s clbits. + * **op1** ([*Operation*](qiskit.circuit.Operation "qiskit.circuit.Operation")) – first operation. + * **qargs1** (*Sequence\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – first operation’s qubits. + * **cargs1** (*Sequence\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – first operation’s clbits. + * **op2** ([*Operation*](qiskit.circuit.Operation "qiskit.circuit.Operation")) – second operation. + * **qargs2** (*Sequence\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – second operation’s qubits. + * **cargs2** (*Sequence\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – second operation’s clbits. * **max\_num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – the maximum number of qubits to consider, the check may be skipped if the number of qubits for either operation exceeds this amount. * **approximation\_degree** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – If the average gate fidelity in between the two operations is above this number (up to `1e-12`) they are assumed to commute. @@ -91,7 +91,7 @@ $$ ### commute\_nodes - + Checks if two DAGOpNodes commute. **Parameters** @@ -106,7 +106,7 @@ $$ ### num\_cached\_entries - + Returns number of cached entries diff --git a/docs/api/qiskit/dev/qiskit.circuit.Parameter.mdx b/docs/api/qiskit/dev/qiskit.circuit.Parameter.mdx index aba15f352b5..d707d2a7c2c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.Parameter.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.Parameter.mdx @@ -8,8 +8,8 @@ python_api_name: qiskit.circuit.Parameter # Parameter - - Bases: [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + + Bases: [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") A compile-time symbolic parameter. @@ -25,28 +25,23 @@ python_api_name: qiskit.circuit.Parameter from qiskit.circuit import QuantumCircuit, Parameter # create the parameter - phi = Parameter('phi') + phi = Parameter("phi") qc = QuantumCircuit(1) # parameterize the rotation qc.rx(phi, 0) - qc.draw('mpl') + qc.draw("mpl") # bind the parameters after circuit to create a bound circuit bc = qc.assign_parameters({phi: 3.14}) bc.measure_all() - bc.draw('mpl') + bc.draw("mpl") ``` ![Circuit diagram output by the previous code.](/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_00.avif) ![Circuit diagram output by the previous code.](/docs/images/api/qiskit/dev/qiskit-circuit-Parameter-1_01.avif) - **Parameters** - - * **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – name of the `Parameter`, used for visual representation. This can be any Unicode string, e.g. “ϕ”. - * **uuid** (*UUID | None*) – For advanced usage only. Override the UUID of this parameter, in order to make it compare equal to some other parameter object. By default, two parameters with the same name do not compare equal to help catch shadowing bugs when two circuits containing the same named parameters are spurious combined. Setting the `uuid` field when creating two parameters to the same thing (along with the same name) allows them to be equal. This is useful during serialization and deserialization. - ## Attributes ### name @@ -58,7 +53,11 @@ python_api_name: qiskit.circuit.Parameter ### parameters - Returns a set of the unbound Parameters in the expression. + Get the parameters present in the expression. + + + Qiskit guarantees equality (via `==`) of parameters retrieved from an expression with the original [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects used to create this expression, but does **not guarantee** `is` comparisons to succeed. + ### uuid @@ -73,36 +72,36 @@ python_api_name: qiskit.circuit.Parameter ### abs - - Absolute of a ParameterExpression + + Take the absolute value of the expression. ### arccos - - Arccos of a ParameterExpression + + Arccosine of the expression. ### arcsin - - Arcsin of a ParameterExpression + + Arcsine of the expression. ### arctan - - Arctan of a ParameterExpression + + Arctangent of the expression. ### assign - + Assign one parameter to a value, which can either be numeric or another parameter expression. **Parameters** - * **parameter** ([*Parameter*](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – A parameter in this expression whose value will be updated. + * **parameter** – A parameter in this expression whose value will be updated. * **value** – The new value to bind to. **Returns** @@ -112,19 +111,19 @@ python_api_name: qiskit.circuit.Parameter ### bind - + Binds the provided set of parameters to their corresponding values. **Parameters** - * **parameter\_values** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – Mapping of Parameter instances to the numeric value to which they will be bound. - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – If `False`, raises an error if `parameter_values` contains Parameters in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + * **parameter\_values** – Mapping of [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances to the numeric value to which they will be bound. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_values` contains [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. **Raises** * [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – - * If parameter\_values contains Parameters outside those in self. - If a non-numeric value is passed in parameter\_values. + * If parameter\_values contains parameters outside those in self. - If a non-numeric value is passed in `parameter_values`. * [**ZeroDivisionError**](https://docs.python.org/3/library/exceptions.html#ZeroDivisionError "(in Python v3.13)") – @@ -132,128 +131,122 @@ python_api_name: qiskit.circuit.Parameter **Returns** - A new expression parameterized by any parameters which were not bound by parameter\_values. - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + A new expression parameterized by any parameters which were not bound by `parameter_values`. ### conjugate - - Return the conjugate. - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + + Return the complex conjugate of the expression. ### cos - - Cosine of a ParameterExpression + + Cosine of the expression. ### exp - - Exponential of a ParameterExpression + + Exponentiate the expression. ### gradient - - Get the derivative of a real parameter expression w\.r.t. a specified parameter. - - - This method assumes that the parameter expression represents a **real expression only**. Calling this method on a parameter expression that contains complex values, or binding complex values to parameters in the expression is undefined behavior. - + + Return derivative of this expression with respect to the input parameter. **Parameters** - **param** ([*Parameter*](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – Parameter w\.r.t. which we want to take the derivative + **param** – The parameter with respect to which the derivative is calculated. **Returns** - ParameterExpression representing the gradient of param\_expr w\.r.t. param or complex or float number - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + The derivative. ### is\_real - - Return whether the expression is real - + + Check whether the expression represents a real number. - ### log - - - Logarithm of a ParameterExpression + Note that this will return `None` if there are unbound parameters, in which case it cannot be determined whether the expression is real. - ### numeric + ### is\_symbol - - Return a Python number representing this object, using the most restrictive of [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"), [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") and [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") that is valid for this object. + + Check if the expression corresponds to a plain symbol. - In general, an [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") is only returned if the expression only involved symbolic integers. If floating-point values were used during the evaluation, the return value will be a [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") regardless of whether the represented value is an integer. This is because floating-point values “infect” symbolic computations by their inexact nature, and symbolic libraries will use inexact floating-point semantics not exact real-number semantics when they are involved. If you want to assert that all floating-point calculations *were* carried out at infinite precision (i.e. [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") could represent every intermediate value exactly), you can use [`float.is_integer()`](https://docs.python.org/3/library/stdtypes.html#float.is_integer "(in Python v3.13)") to check if the return float represents an integer and cast it using [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") if so. This would be an unusual pattern; typically one requires this by only ever using explicitly [`Rational`](https://docs.python.org/3/library/numbers.html#numbers.Rational "(in Python v3.13)") objects while working with symbolic expressions. + **Returns** - This is more reliable and performant than using [`is_real()`](#qiskit.circuit.Parameter.is_real "qiskit.circuit.Parameter.is_real") followed by calling [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") or [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)"), as in some cases [`is_real()`](#qiskit.circuit.Parameter.is_real "qiskit.circuit.Parameter.is_real") needs to force a floating-point evaluation to determine an accurate result to work around bugs in the upstream symbolic libraries. + `True` is this expression corresponds to a symbol, `False` otherwise. + - **Returns** + ### log - A Python number representing the object. + + Take the natural logarithm of the expression. + - **Raises** + ### numeric - [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") – if there are unbound parameters. + + Cast this expression to a numeric value. - **Return type** + **Parameters** - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + **strict** – If `True` (default) this function raises an error if there are any unbound symbols in the expression. If `False`, this allows casting if the expression represents a numeric value, regardless of unbound symbols. For example `(0 * Parameter("x"))` is 0 but has the symbol `x` present. ### sign - - Sign of a ParameterExpression + + Return the sign of the expression. ### sin - - Sine of a ParameterExpression + + Sine of the expression. ### subs - - Substitute self with the corresponding parameter in `parameter_map`. + + Returns a new expression with replacement parameters. **Parameters** - * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – + * **parameter\_map** – Mapping from [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in `self` to the [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") instances with which they should be replaced. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_map` contains [`Parameter`](#qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + + **Raises** + + [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – + + * If parameter\_map contains parameters outside those in self. - If the replacement parameters in `parameter_map` would result in a name conflict in the generated expression. + + **Returns** + + A new expression with the specified parameters replaced. ### sympify - - Return symbolic expression as a raw Sympy object. + + Return a SymPy equivalent of this expression. - - This is for interoperability only. Qiskit will not accept or work with raw Sympy or Symegine expressions in its parameters, because they do not contain the tracking information used in circuit-parameter binding and assignment. - + **Returns** + + A SymPy equivalent of this expression. ### tan - - Tangent of a ParameterExpression + + Tangent of the expression. diff --git a/docs/api/qiskit/dev/qiskit.circuit.ParameterExpression.mdx b/docs/api/qiskit/dev/qiskit.circuit.ParameterExpression.mdx index 48746af5c4f..dbc13ec3b93 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.ParameterExpression.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.ParameterExpression.mdx @@ -8,88 +8,81 @@ python_api_name: qiskit.circuit.ParameterExpression # ParameterExpression - + Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)") - ParameterExpression class to enable creating expressions of Parameters. + A parameter expression. - Create a new [`ParameterExpression`](#qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression"). - - Not intended to be called directly, but to be instantiated via operations on other [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") or [`ParameterExpression`](#qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") objects. The constructor of this object is **not** a public interface and should not ever be used directly. - - **Parameters** - - * **symbol\_map** (*Dict\[*[*Parameter*](qiskit.circuit.Parameter "qiskit.circuit.Parameter")*, \[*[*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression")*,* [*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")*, or* [*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – Mapping of [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances to the `sympy.Symbol` serving as their placeholder in expr. - * **expr** (*SymbolExpr or* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – Expression with Rust’s SymbolExprPy or string + This is backed by Qiskit’s symbolic expression engine and a cache for the parameters inside the expression. ## Attributes ### parameters - Returns a set of the unbound Parameters in the expression. + Get the parameters present in the expression. + + + Qiskit guarantees equality (via `==`) of parameters retrieved from an expression with the original [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects used to create this expression, but does **not guarantee** `is` comparisons to succeed. + ## Methods ### abs - - Absolute of a ParameterExpression + + Take the absolute value of the expression. ### arccos - - Arccos of a ParameterExpression + + Arccosine of the expression. ### arcsin - - Arcsin of a ParameterExpression + + Arcsine of the expression. ### arctan - - Arctan of a ParameterExpression + + Arctangent of the expression. ### assign - + Assign one parameter to a value, which can either be numeric or another parameter expression. **Parameters** - * **parameter** ([*Parameter*](qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – A parameter in this expression whose value will be updated. - * **value** ([*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The new value to bind to. + * **parameter** – A parameter in this expression whose value will be updated. + * **value** – The new value to bind to. **Returns** A new expression parameterized by any parameters which were not bound by assignment. - - **Return type** - - [*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") ### bind - + Binds the provided set of parameters to their corresponding values. **Parameters** - * **parameter\_values** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – Mapping of Parameter instances to the numeric value to which they will be bound. - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – If `False`, raises an error if `parameter_values` contains Parameters in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + * **parameter\_values** – Mapping of [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances to the numeric value to which they will be bound. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_values` contains [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. **Raises** * [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – - * If parameter\_values contains Parameters outside those in self. - If a non-numeric value is passed in parameter\_values. + * If parameter\_values contains parameters outside those in self. - If a non-numeric value is passed in `parameter_values`. * [**ZeroDivisionError**](https://docs.python.org/3/library/exceptions.html#ZeroDivisionError "(in Python v3.13)") – @@ -97,142 +90,122 @@ python_api_name: qiskit.circuit.ParameterExpression **Returns** - A new expression parameterized by any parameters which were not bound by parameter\_values. - - **Return type** - - [*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + A new expression parameterized by any parameters which were not bound by `parameter_values`. ### conjugate - - Return the conjugate. - - **Return type** - - [*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + + Return the complex conjugate of the expression. ### cos - - Cosine of a ParameterExpression + + Cosine of the expression. ### exp - - Exponential of a ParameterExpression + + Exponentiate the expression. ### gradient - - Get the derivative of a real parameter expression w\.r.t. a specified parameter. - - - This method assumes that the parameter expression represents a **real expression only**. Calling this method on a parameter expression that contains complex values, or binding complex values to parameters in the expression is undefined behavior. - + + Return derivative of this expression with respect to the input parameter. **Parameters** - **param** ([*Parameter*](qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – Parameter w\.r.t. which we want to take the derivative + **param** – The parameter with respect to which the derivative is calculated. **Returns** - ParameterExpression representing the gradient of param\_expr w\.r.t. param or complex or float number - - **Return type** - - [*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + The derivative. ### is\_real - - Return whether the expression is real - + + Check whether the expression represents a real number. - ### log - - - Logarithm of a ParameterExpression + Note that this will return `None` if there are unbound parameters, in which case it cannot be determined whether the expression is real. - ### numeric + ### is\_symbol - - Return a Python number representing this object, using the most restrictive of [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"), [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") and [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") that is valid for this object. + + Check if the expression corresponds to a plain symbol. - In general, an [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") is only returned if the expression only involved symbolic integers. If floating-point values were used during the evaluation, the return value will be a [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") regardless of whether the represented value is an integer. This is because floating-point values “infect” symbolic computations by their inexact nature, and symbolic libraries will use inexact floating-point semantics not exact real-number semantics when they are involved. If you want to assert that all floating-point calculations *were* carried out at infinite precision (i.e. [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") could represent every intermediate value exactly), you can use [`float.is_integer()`](https://docs.python.org/3/library/stdtypes.html#float.is_integer "(in Python v3.13)") to check if the return float represents an integer and cast it using [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") if so. This would be an unusual pattern; typically one requires this by only ever using explicitly [`Rational`](https://docs.python.org/3/library/numbers.html#numbers.Rational "(in Python v3.13)") objects while working with symbolic expressions. + **Returns** - This is more reliable and performant than using [`is_real()`](#qiskit.circuit.ParameterExpression.is_real "qiskit.circuit.ParameterExpression.is_real") followed by calling [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") or [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)"), as in some cases [`is_real()`](#qiskit.circuit.ParameterExpression.is_real "qiskit.circuit.ParameterExpression.is_real") needs to force a floating-point evaluation to determine an accurate result to work around bugs in the upstream symbolic libraries. + `True` is this expression corresponds to a symbol, `False` otherwise. + - **Returns** + ### log - A Python number representing the object. + + Take the natural logarithm of the expression. + - **Raises** + ### numeric - [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") – if there are unbound parameters. + + Cast this expression to a numeric value. - **Return type** + **Parameters** - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + **strict** – If `True` (default) this function raises an error if there are any unbound symbols in the expression. If `False`, this allows casting if the expression represents a numeric value, regardless of unbound symbols. For example `(0 * Parameter("x"))` is 0 but has the symbol `x` present. ### sign - - Sign of a ParameterExpression + + Return the sign of the expression. ### sin - - Sine of a ParameterExpression + + Sine of the expression. ### subs - - Returns a new Expression with replacement Parameters. + + Returns a new expression with replacement parameters. **Parameters** - * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – Mapping from Parameters in self to the ParameterExpression instances with which they should be replaced. - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – If `False`, raises an error if `parameter_map` contains Parameters in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + * **parameter\_map** – Mapping from [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in `self` to the [`ParameterExpression`](#qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") instances with which they should be replaced. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_map` contains [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. **Raises** [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – - * If parameter\_map contains Parameters outside those in self. - If the replacement Parameters in parameter\_map would result in a name conflict in the generated expression. + * If parameter\_map contains parameters outside those in self. - If the replacement parameters in `parameter_map` would result in a name conflict in the generated expression. **Returns** A new expression with the specified parameters replaced. - - **Return type** - - [*ParameterExpression*](#qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") ### sympify - - Return symbolic expression as a raw Sympy object. + + Return a SymPy equivalent of this expression. - - This is for interoperability only. Qiskit will not accept or work with raw Sympy or Symegine expressions in its parameters, because they do not contain the tracking information used in circuit-parameter binding and assignment. - + **Returns** + + A SymPy equivalent of this expression. ### tan - - Tangent of a ParameterExpression + + Tangent of the expression. diff --git a/docs/api/qiskit/dev/qiskit.circuit.ParameterVector.mdx b/docs/api/qiskit/dev/qiskit.circuit.ParameterVector.mdx index 2d99cac7af0..6b46981ab47 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.ParameterVector.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.ParameterVector.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.circuit.ParameterVector # ParameterVector - + Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)") A container of many related [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects. @@ -39,7 +39,7 @@ python_api_name: qiskit.circuit.ParameterVector ### index - + Find the index of a [`ParameterVectorElement`](qiskit.circuit.ParameterVectorElement "qiskit.circuit.ParameterVectorElement") within the list. It is typically much faster to use the [`ParameterVectorElement.index`](qiskit.circuit.ParameterVectorElement#index "qiskit.circuit.ParameterVectorElement.index") property. @@ -47,7 +47,7 @@ python_api_name: qiskit.circuit.ParameterVector ### resize - + Resize the parameter vector. If necessary, new elements are generated. Note that the UUID of each [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") element will be generated deterministically given the root UUID of the `ParameterVector` and the index of the element. In particular, if a `ParameterVector` is resized to be smaller and then later resized to be larger, the UUID of the later generated element at a given index will be the same as the UUID of the previous element at that index. This is to ensure that the parameter instances do not change. diff --git a/docs/api/qiskit/dev/qiskit.circuit.ParameterVectorElement.mdx b/docs/api/qiskit/dev/qiskit.circuit.ParameterVectorElement.mdx index a9ba9a9ac02..673ed1ad722 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.ParameterVectorElement.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.ParameterVectorElement.mdx @@ -8,8 +8,8 @@ python_api_name: qiskit.circuit.ParameterVectorElement # ParameterVectorElement - - Bases: [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.parameter.Parameter") + + Bases: [`Parameter`](qiskit.circuit.Parameter "qiskit._accelerate.circuit.Parameter") An element of a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector"). @@ -17,11 +17,6 @@ python_api_name: qiskit.circuit.ParameterVectorElement There is very little reason to ever construct this class directly. Objects of this type are automatically constructed efficiently as part of creating a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector"). - **Parameters** - - * **name** – name of the `Parameter`, used for visual representation. This can be any Unicode string, e.g. “ϕ”. - * **uuid** – For advanced usage only. Override the UUID of this parameter, in order to make it compare equal to some other parameter object. By default, two parameters with the same name do not compare equal to help catch shadowing bugs when two circuits containing the same named parameters are spurious combined. Setting the `uuid` field when creating two parameters to the same thing (along with the same name) allows them to be equal. This is useful during serialization and deserialization. - ## Attributes ### index @@ -39,7 +34,11 @@ python_api_name: qiskit.circuit.ParameterVectorElement ### parameters - Returns a set of the unbound Parameters in the expression. + Get the parameters present in the expression. + + + Qiskit guarantees equality (via `==`) of parameters retrieved from an expression with the original [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects used to create this expression, but does **not guarantee** `is` comparisons to succeed. + ### uuid @@ -60,36 +59,36 @@ python_api_name: qiskit.circuit.ParameterVectorElement ### abs - - Absolute of a ParameterExpression + + Take the absolute value of the expression. ### arccos - - Arccos of a ParameterExpression + + Arccosine of the expression. ### arcsin - - Arcsin of a ParameterExpression + + Arcsine of the expression. ### arctan - - Arctan of a ParameterExpression + + Arctangent of the expression. ### assign - + Assign one parameter to a value, which can either be numeric or another parameter expression. **Parameters** - * **parameter** ([*Parameter*](qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – A parameter in this expression whose value will be updated. + * **parameter** – A parameter in this expression whose value will be updated. * **value** – The new value to bind to. **Returns** @@ -99,19 +98,19 @@ python_api_name: qiskit.circuit.ParameterVectorElement ### bind - + Binds the provided set of parameters to their corresponding values. **Parameters** - * **parameter\_values** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – Mapping of Parameter instances to the numeric value to which they will be bound. - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – If `False`, raises an error if `parameter_values` contains Parameters in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + * **parameter\_values** – Mapping of [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") instances to the numeric value to which they will be bound. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_values` contains [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. **Raises** * [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – - * If parameter\_values contains Parameters outside those in self. - If a non-numeric value is passed in parameter\_values. + * If parameter\_values contains parameters outside those in self. - If a non-numeric value is passed in `parameter_values`. * [**ZeroDivisionError**](https://docs.python.org/3/library/exceptions.html#ZeroDivisionError "(in Python v3.13)") – @@ -119,128 +118,122 @@ python_api_name: qiskit.circuit.ParameterVectorElement **Returns** - A new expression parameterized by any parameters which were not bound by parameter\_values. - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + A new expression parameterized by any parameters which were not bound by `parameter_values`. ### conjugate - - Return the conjugate. - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") + + Return the complex conjugate of the expression. ### cos - - Cosine of a ParameterExpression + + Cosine of the expression. ### exp - - Exponential of a ParameterExpression + + Exponentiate the expression. ### gradient - - Get the derivative of a real parameter expression w\.r.t. a specified parameter. - - - This method assumes that the parameter expression represents a **real expression only**. Calling this method on a parameter expression that contains complex values, or binding complex values to parameters in the expression is undefined behavior. - + + Return derivative of this expression with respect to the input parameter. **Parameters** - **param** ([*Parameter*](qiskit.circuit.Parameter "qiskit.circuit.Parameter")) – Parameter w\.r.t. which we want to take the derivative + **param** – The parameter with respect to which the derivative is calculated. **Returns** - ParameterExpression representing the gradient of param\_expr w\.r.t. param or complex or float number - - **Return type** - - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + The derivative. ### is\_real - - Return whether the expression is real - + + Check whether the expression represents a real number. - ### log - - - Logarithm of a ParameterExpression + Note that this will return `None` if there are unbound parameters, in which case it cannot be determined whether the expression is real. - ### numeric + ### is\_symbol - - Return a Python number representing this object, using the most restrictive of [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)"), [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") and [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") that is valid for this object. + + Check if the expression corresponds to a plain symbol. - In general, an [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") is only returned if the expression only involved symbolic integers. If floating-point values were used during the evaluation, the return value will be a [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") regardless of whether the represented value is an integer. This is because floating-point values “infect” symbolic computations by their inexact nature, and symbolic libraries will use inexact floating-point semantics not exact real-number semantics when they are involved. If you want to assert that all floating-point calculations *were* carried out at infinite precision (i.e. [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") could represent every intermediate value exactly), you can use [`float.is_integer()`](https://docs.python.org/3/library/stdtypes.html#float.is_integer "(in Python v3.13)") to check if the return float represents an integer and cast it using [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") if so. This would be an unusual pattern; typically one requires this by only ever using explicitly [`Rational`](https://docs.python.org/3/library/numbers.html#numbers.Rational "(in Python v3.13)") objects while working with symbolic expressions. + **Returns** - This is more reliable and performant than using [`is_real()`](#qiskit.circuit.ParameterVectorElement.is_real "qiskit.circuit.ParameterVectorElement.is_real") followed by calling [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") or [`complex`](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)"), as in some cases [`is_real()`](#qiskit.circuit.ParameterVectorElement.is_real "qiskit.circuit.ParameterVectorElement.is_real") needs to force a floating-point evaluation to determine an accurate result to work around bugs in the upstream symbolic libraries. + `True` is this expression corresponds to a symbol, `False` otherwise. + - **Returns** + ### log - A Python number representing the object. + + Take the natural logarithm of the expression. + - **Raises** + ### numeric - [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") – if there are unbound parameters. + + Cast this expression to a numeric value. - **Return type** + **Parameters** - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") | [complex](https://docs.python.org/3/library/functions.html#complex "(in Python v3.13)") + **strict** – If `True` (default) this function raises an error if there are any unbound symbols in the expression. If `False`, this allows casting if the expression represents a numeric value, regardless of unbound symbols. For example `(0 * Parameter("x"))` is 0 but has the symbol `x` present. ### sign - - Sign of a ParameterExpression + + Return the sign of the expression. ### sin - - Sine of a ParameterExpression + + Sine of the expression. ### subs - - Substitute self with the corresponding parameter in `parameter_map`. + + Returns a new expression with replacement parameters. **Parameters** - * **parameter\_map** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")) – - * **allow\_unknown\_parameters** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – + * **parameter\_map** – Mapping from [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in `self` to the [`ParameterExpression`](qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") instances with which they should be replaced. + * **allow\_unknown\_parameters** – If `False`, raises an error if `parameter_map` contains [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter")s in the keys outside those present in the expression. If `True`, any such parameters are simply ignored. + + **Raises** + + [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – + + * If parameter\_map contains parameters outside those in self. - If the replacement parameters in `parameter_map` would result in a name conflict in the generated expression. + + **Returns** + + A new expression with the specified parameters replaced. ### sympify - - Return symbolic expression as a raw Sympy object. + + Return a SymPy equivalent of this expression. - - This is for interoperability only. Qiskit will not accept or work with raw Sympy or Symegine expressions in its parameters, because they do not contain the tracking information used in circuit-parameter binding and assignment. - + **Returns** + + A SymPy equivalent of this expression. ### tan - - Tangent of a ParameterExpression + + Tangent of the expression. diff --git a/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx b/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx index 2edf9171e79..e6977aac9f7 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.QuantumCircuit.mdx @@ -2513,7 +2513,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. * **q\_controls** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – The qubits used as the controls. * **q\_target** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit targeted by the gate. * **use\_basis\_gates** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – use p, u, cx basis gates. @@ -2541,7 +2541,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. + * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. * **q\_controls** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – The qubits used as the controls. * **q\_target** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit targeted by the gate. * **use\_basis\_gates** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – use p, u, cx basis gates. @@ -2672,7 +2672,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. * **qubits** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – The qubits to apply the gate to. **Returns** @@ -2693,7 +2693,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – THe angle of the rotation. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – THe angle of the rotation. * **qubit** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. **Returns** @@ -2828,8 +2828,8 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. - * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the axis of rotation in the x-y plane. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. + * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the axis of rotation in the x-y plane. * **qubit** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. **Returns** @@ -2915,9 +2915,9 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **vx** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – x-component of the rotation axis. - * **vy** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – y-component of the rotation axis. - * **vz** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – z-component of the rotation axis. + * **vx** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – x-component of the rotation axis. + * **vy** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – y-component of the rotation axis. + * **vz** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – z-component of the rotation axis. * **qubit** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. **Returns** @@ -2960,7 +2960,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The angle of the rotation. * **qubit1** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. * **qubit2** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. @@ -3004,7 +3004,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. * **qubit1** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. * **qubit2** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. @@ -3026,7 +3026,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. + * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. * **qubit** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. **Returns** @@ -3047,7 +3047,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. * **qubit1** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. * **qubit2** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. @@ -3069,7 +3069,7 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The rotation angle of the gate. * **qubit1** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. * **qubit2** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. @@ -3259,9 +3259,9 @@ python_api_name: qiskit.circuit.QuantumCircuit **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\theta$ rotation angle of the gate. - * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\phi$ rotation angle of the gate. - * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\lambda$ rotation angle of the gate. + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\theta$ rotation angle of the gate. + * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\phi$ rotation angle of the gate. + * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The $\lambda$ rotation angle of the gate. * **qubit** ([*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*QuantumRegister*](circuit#qiskit.circuit.QuantumRegister "qiskit.circuit.QuantumRegister") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *|*[*slice*](https://docs.python.org/3/library/functions.html#slice "(in Python v3.13)") *|*[*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.13)")*\[*[*Qubit*](circuit#qiskit.circuit.Qubit "qiskit.circuit.Qubit") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The qubit(s) to apply the gate to. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx index 65435a14287..5b11f3df579 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.AND.mdx @@ -37,470 +37,6 @@ python_api_name: qiskit.circuit.library.AND ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.AND.unit "qiskit.circuit.library.AND.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.AND.num_input_vars "qiskit.circuit.library.AND.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.AND.num_input_vars "qiskit.circuit.library.AND.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.AND.num_vars "qiskit.circuit.library.AND.num_vars") + [`num_stretches()`](#qiskit.circuit.library.AND.num_stretches "qiskit.circuit.library.AND.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.AND.num_captured_vars "qiskit.circuit.library.AND.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.AND.duration "qiskit.circuit.library.AND.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx index 603bd8f08d8..d94d3acd46e 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.CDKMRippleCarryAdder.mdx @@ -95,480 +95,6 @@ python_api_name: qiskit.circuit.library.CDKMRippleCarryAdder ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.CDKMRippleCarryAdder.unit "qiskit.circuit.library.CDKMRippleCarryAdder.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.CDKMRippleCarryAdder.num_input_vars "qiskit.circuit.library.CDKMRippleCarryAdder.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.CDKMRippleCarryAdder.num_input_vars "qiskit.circuit.library.CDKMRippleCarryAdder.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.CDKMRippleCarryAdder.num_vars "qiskit.circuit.library.CDKMRippleCarryAdder.num_vars") + [`num_stretches()`](#qiskit.circuit.library.CDKMRippleCarryAdder.num_stretches "qiskit.circuit.library.CDKMRippleCarryAdder.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.CDKMRippleCarryAdder.num_captured_vars "qiskit.circuit.library.CDKMRippleCarryAdder.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits, i.e. the number of bits in each input register. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.CDKMRippleCarryAdder.duration "qiskit.circuit.library.CDKMRippleCarryAdder.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.Diagonal.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.Diagonal.mdx index f860ab18ec2..ee89257896a 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.Diagonal.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.Diagonal.mdx @@ -27,470 +27,6 @@ python_api_name: qiskit.circuit.library.Diagonal ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.Diagonal.unit "qiskit.circuit.library.Diagonal.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.Diagonal.num_input_vars "qiskit.circuit.library.Diagonal.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.Diagonal.num_input_vars "qiskit.circuit.library.Diagonal.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.Diagonal.num_vars "qiskit.circuit.library.Diagonal.num_vars") + [`num_stretches()`](#qiskit.circuit.library.Diagonal.num_stretches "qiskit.circuit.library.Diagonal.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.Diagonal.num_captured_vars "qiskit.circuit.library.Diagonal.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.Diagonal.duration "qiskit.circuit.library.Diagonal.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.DraperQFTAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.DraperQFTAdder.mdx index d8e573e94cd..b91c68d4610 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.DraperQFTAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.DraperQFTAdder.mdx @@ -62,480 +62,6 @@ python_api_name: qiskit.circuit.library.DraperQFTAdder ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.DraperQFTAdder.unit "qiskit.circuit.library.DraperQFTAdder.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.DraperQFTAdder.num_input_vars "qiskit.circuit.library.DraperQFTAdder.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.DraperQFTAdder.num_input_vars "qiskit.circuit.library.DraperQFTAdder.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.DraperQFTAdder.num_vars "qiskit.circuit.library.DraperQFTAdder.num_vars") + [`num_stretches()`](#qiskit.circuit.library.DraperQFTAdder.num_stretches "qiskit.circuit.library.DraperQFTAdder.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.DraperQFTAdder.num_captured_vars "qiskit.circuit.library.DraperQFTAdder.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits, i.e. the number of bits in each input register. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.DraperQFTAdder.duration "qiskit.circuit.library.DraperQFTAdder.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.EfficientSU2.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.EfficientSU2.mdx index 72bbc5d77d2..21cdd3e3dd5 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.EfficientSU2.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.EfficientSU2.mdx @@ -86,476 +86,6 @@ python_api_name: qiskit.circuit.library.EfficientSU2 ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.EfficientSU2.unit "qiskit.circuit.library.EfficientSU2.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.EfficientSU2.num_input_vars "qiskit.circuit.library.EfficientSU2.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.EfficientSU2.num_input_vars "qiskit.circuit.library.EfficientSU2.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.EfficientSU2.num_vars "qiskit.circuit.library.EfficientSU2.num_vars") + [`num_stretches()`](#qiskit.circuit.library.EfficientSU2.num_stretches "qiskit.circuit.library.EfficientSU2.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.EfficientSU2.num_captured_vars "qiskit.circuit.library.EfficientSU2.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - ### parameter\_bounds @@ -566,120 +96,6 @@ python_api_name: qiskit.circuit.library.EfficientSU2 The parameter bounds. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.EfficientSU2.duration "qiskit.circuit.library.EfficientSU2.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.EvolvedOperatorAnsatz.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.EvolvedOperatorAnsatz.mdx index 4a35a836dea..def7d20e759 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.EvolvedOperatorAnsatz.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.EvolvedOperatorAnsatz.mdx @@ -26,90 +26,6 @@ python_api_name: qiskit.circuit.library.EvolvedOperatorAnsatz ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.EvolvedOperatorAnsatz.unit "qiskit.circuit.library.EvolvedOperatorAnsatz.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - ### evolution @@ -124,260 +40,6 @@ python_api_name: qiskit.circuit.library.EvolvedOperatorAnsatz [EvolutionSynthesis](qiskit.synthesis.EvolutionSynthesis "qiskit.synthesis.EvolutionSynthesis") - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.EvolvedOperatorAnsatz.num_input_vars "qiskit.circuit.library.EvolvedOperatorAnsatz.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.EvolvedOperatorAnsatz.num_input_vars "qiskit.circuit.library.EvolvedOperatorAnsatz.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.EvolvedOperatorAnsatz.num_vars "qiskit.circuit.library.EvolvedOperatorAnsatz.num_vars") + [`num_stretches()`](#qiskit.circuit.library.EvolvedOperatorAnsatz.num_stretches "qiskit.circuit.library.EvolvedOperatorAnsatz.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.EvolvedOperatorAnsatz.num_captured_vars "qiskit.circuit.library.EvolvedOperatorAnsatz.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - ### num\_qubits @@ -388,102 +50,6 @@ python_api_name: qiskit.circuit.library.EvolvedOperatorAnsatz The number of qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - ### operators @@ -498,152 +64,12 @@ python_api_name: qiskit.circuit.library.EvolvedOperatorAnsatz [list](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - ### preferred\_init\_points Getter of preferred initial points based on the given initial state. - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.EvolvedOperatorAnsatz.duration "qiskit.circuit.library.EvolvedOperatorAnsatz.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.ExactReciprocal.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.ExactReciprocal.mdx index 18c579ec719..4842d768488 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.ExactReciprocal.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.ExactReciprocal.mdx @@ -34,470 +34,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.ExactReciprocal.unit "qiskit.circuit.library.ExactReciprocal.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ExactReciprocal.num_input_vars "qiskit.circuit.library.ExactReciprocal.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ExactReciprocal.num_input_vars "qiskit.circuit.library.ExactReciprocal.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.ExactReciprocal.num_vars "qiskit.circuit.library.ExactReciprocal.num_vars") + [`num_stretches()`](#qiskit.circuit.library.ExactReciprocal.num_stretches "qiskit.circuit.library.ExactReciprocal.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.ExactReciprocal.num_captured_vars "qiskit.circuit.library.ExactReciprocal.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.ExactReciprocal.duration "qiskit.circuit.library.ExactReciprocal.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.ExcitationPreserving.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.ExcitationPreserving.mdx index 0f7cba29d51..973587bce3f 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.ExcitationPreserving.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.ExcitationPreserving.mdx @@ -104,476 +104,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.ExcitationPreserving.unit "qiskit.circuit.library.ExcitationPreserving.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ExcitationPreserving.num_input_vars "qiskit.circuit.library.ExcitationPreserving.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ExcitationPreserving.num_input_vars "qiskit.circuit.library.ExcitationPreserving.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.ExcitationPreserving.num_vars "qiskit.circuit.library.ExcitationPreserving.num_vars") + [`num_stretches()`](#qiskit.circuit.library.ExcitationPreserving.num_stretches "qiskit.circuit.library.ExcitationPreserving.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.ExcitationPreserving.num_captured_vars "qiskit.circuit.library.ExcitationPreserving.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - ### parameter\_bounds @@ -584,120 +114,6 @@ $$ The parameter bounds. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.ExcitationPreserving.duration "qiskit.circuit.library.ExcitationPreserving.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.FourierChecking.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.FourierChecking.mdx index 3813095acd4..cf2b6313799 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.FourierChecking.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.FourierChecking.mdx @@ -48,470 +48,6 @@ python_api_name: qiskit.circuit.library.FourierChecking ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.FourierChecking.unit "qiskit.circuit.library.FourierChecking.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.FourierChecking.num_input_vars "qiskit.circuit.library.FourierChecking.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.FourierChecking.num_input_vars "qiskit.circuit.library.FourierChecking.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.FourierChecking.num_vars "qiskit.circuit.library.FourierChecking.num_vars") + [`num_stretches()`](#qiskit.circuit.library.FourierChecking.num_stretches "qiskit.circuit.library.FourierChecking.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.FourierChecking.num_captured_vars "qiskit.circuit.library.FourierChecking.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.FourierChecking.duration "qiskit.circuit.library.FourierChecking.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.FunctionalPauliRotations.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.FunctionalPauliRotations.mdx index d81499a7f07..bfca6b9c59e 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.FunctionalPauliRotations.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.FunctionalPauliRotations.mdx @@ -23,12 +23,6 @@ python_api_name: qiskit.circuit.library.FunctionalPauliRotations ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - ### basis @@ -41,166 +35,6 @@ python_api_name: qiskit.circuit.library.FunctionalPauliRotations The kind of Pauli rotation used in controlled rotation. - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.FunctionalPauliRotations.unit "qiskit.circuit.library.FunctionalPauliRotations.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - ### num\_ancilla\_qubits @@ -211,112 +45,6 @@ python_api_name: qiskit.circuit.library.FunctionalPauliRotations The minimal number of ancillas required. - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.FunctionalPauliRotations.num_input_vars "qiskit.circuit.library.FunctionalPauliRotations.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.FunctionalPauliRotations.num_input_vars "qiskit.circuit.library.FunctionalPauliRotations.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.FunctionalPauliRotations.num_vars "qiskit.circuit.library.FunctionalPauliRotations.num_vars") + [`num_stretches()`](#qiskit.circuit.library.FunctionalPauliRotations.num_stretches "qiskit.circuit.library.FunctionalPauliRotations.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.FunctionalPauliRotations.num_captured_vars "qiskit.circuit.library.FunctionalPauliRotations.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - ### num\_state\_qubits @@ -327,186 +55,6 @@ python_api_name: qiskit.circuit.library.FunctionalPauliRotations The number of state qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.FunctionalPauliRotations.duration "qiskit.circuit.library.FunctionalPauliRotations.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GMS.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GMS.mdx index 84fc691f64b..0c4fcbba72c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GMS.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GMS.mdx @@ -57,470 +57,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GMS.unit "qiskit.circuit.library.GMS.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GMS.num_input_vars "qiskit.circuit.library.GMS.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GMS.num_input_vars "qiskit.circuit.library.GMS.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GMS.num_vars "qiskit.circuit.library.GMS.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GMS.num_stretches "qiskit.circuit.library.GMS.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GMS.num_captured_vars "qiskit.circuit.library.GMS.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GMS.duration "qiskit.circuit.library.GMS.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GR.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GR.mdx index cd3fc6aabb3..44261df1b6e 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GR.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GR.mdx @@ -47,470 +47,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GR.unit "qiskit.circuit.library.GR.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GR.num_input_vars "qiskit.circuit.library.GR.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GR.num_input_vars "qiskit.circuit.library.GR.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GR.num_vars "qiskit.circuit.library.GR.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GR.num_stretches "qiskit.circuit.library.GR.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GR.num_captured_vars "qiskit.circuit.library.GR.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GR.duration "qiskit.circuit.library.GR.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GRX.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GRX.mdx index e0783f3091a..4629773d338 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GRX.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GRX.mdx @@ -46,470 +46,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GRX.unit "qiskit.circuit.library.GRX.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRX.num_input_vars "qiskit.circuit.library.GRX.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRX.num_input_vars "qiskit.circuit.library.GRX.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GRX.num_vars "qiskit.circuit.library.GRX.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GRX.num_stretches "qiskit.circuit.library.GRX.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GRX.num_captured_vars "qiskit.circuit.library.GRX.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GRX.duration "qiskit.circuit.library.GRX.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GRY.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GRY.mdx index 4c340a60928..4ddf9298e44 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GRY.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GRY.mdx @@ -46,470 +46,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GRY.unit "qiskit.circuit.library.GRY.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRY.num_input_vars "qiskit.circuit.library.GRY.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRY.num_input_vars "qiskit.circuit.library.GRY.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GRY.num_vars "qiskit.circuit.library.GRY.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GRY.num_stretches "qiskit.circuit.library.GRY.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GRY.num_captured_vars "qiskit.circuit.library.GRY.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GRY.duration "qiskit.circuit.library.GRY.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GRZ.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GRZ.mdx index 79d9ca3adbb..88c4a00aae0 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GRZ.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GRZ.mdx @@ -46,470 +46,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GRZ.unit "qiskit.circuit.library.GRZ.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRZ.num_input_vars "qiskit.circuit.library.GRZ.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GRZ.num_input_vars "qiskit.circuit.library.GRZ.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GRZ.num_vars "qiskit.circuit.library.GRZ.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GRZ.num_stretches "qiskit.circuit.library.GRZ.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GRZ.num_captured_vars "qiskit.circuit.library.GRZ.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GRZ.duration "qiskit.circuit.library.GRZ.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GlobalPhaseGate.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GlobalPhaseGate.mdx index 653e3ad4942..c9dd88e8163 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GlobalPhaseGate.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GlobalPhaseGate.mdx @@ -28,7 +28,7 @@ $$ **Parameters** - * **phase** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The value of phase it takes. + * **phase** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – The value of phase it takes. * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *| None*) – An optional label for the gate. ## Attributes diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GraphState.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GraphState.mdx index 55c06216c80..93929118a0e 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GraphState.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GraphState.mdx @@ -55,470 +55,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GraphState.unit "qiskit.circuit.library.GraphState.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GraphState.num_input_vars "qiskit.circuit.library.GraphState.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GraphState.num_input_vars "qiskit.circuit.library.GraphState.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GraphState.num_vars "qiskit.circuit.library.GraphState.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GraphState.num_stretches "qiskit.circuit.library.GraphState.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GraphState.num_captured_vars "qiskit.circuit.library.GraphState.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GraphState.duration "qiskit.circuit.library.GraphState.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.GroverOperator.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.GroverOperator.mdx index 3a36833dec0..2f5eaf4a0e9 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.GroverOperator.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.GroverOperator.mdx @@ -170,466 +170,12 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.GroverOperator.unit "qiskit.circuit.library.GroverOperator.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GroverOperator.num_input_vars "qiskit.circuit.library.GroverOperator.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.GroverOperator.num_input_vars "qiskit.circuit.library.GroverOperator.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.GroverOperator.num_vars "qiskit.circuit.library.GroverOperator.num_vars") + [`num_stretches()`](#qiskit.circuit.library.GroverOperator.num_stretches "qiskit.circuit.library.GroverOperator.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.GroverOperator.num_captured_vars "qiskit.circuit.library.GroverOperator.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - ### oracle The oracle implementing a reflection about the bad state. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### reflection\_qubits @@ -642,16 +188,6 @@ $$ The subcircuit implementing the A operator or Hadamards. - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.GroverOperator.duration "qiskit.circuit.library.GroverOperator.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### zero\_reflection diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.HRSCumulativeMultiplier.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.HRSCumulativeMultiplier.mdx index d6786eb055e..c70b35611f3 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.HRSCumulativeMultiplier.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.HRSCumulativeMultiplier.mdx @@ -67,490 +67,6 @@ python_api_name: qiskit.circuit.library.HRSCumulativeMultiplier ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.HRSCumulativeMultiplier.unit "qiskit.circuit.library.HRSCumulativeMultiplier.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.HRSCumulativeMultiplier.num_input_vars "qiskit.circuit.library.HRSCumulativeMultiplier.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.HRSCumulativeMultiplier.num_input_vars "qiskit.circuit.library.HRSCumulativeMultiplier.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.HRSCumulativeMultiplier.num_vars "qiskit.circuit.library.HRSCumulativeMultiplier.num_vars") + [`num_stretches()`](#qiskit.circuit.library.HRSCumulativeMultiplier.num_stretches "qiskit.circuit.library.HRSCumulativeMultiplier.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.HRSCumulativeMultiplier.num_captured_vars "qiskit.circuit.library.HRSCumulativeMultiplier.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_result\_qubits - - - The number of result qubits to limit the output to. - - **Returns** - - The number of result qubits. - - - ### num\_state\_qubits - - - The number of state qubits, i.e. the number of bits in each input register. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.HRSCumulativeMultiplier.duration "qiskit.circuit.library.HRSCumulativeMultiplier.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.HiddenLinearFunction.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.HiddenLinearFunction.mdx index 9048b2c8cea..a2848d7777e 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.HiddenLinearFunction.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.HiddenLinearFunction.mdx @@ -57,470 +57,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.HiddenLinearFunction.unit "qiskit.circuit.library.HiddenLinearFunction.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.HiddenLinearFunction.num_input_vars "qiskit.circuit.library.HiddenLinearFunction.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.HiddenLinearFunction.num_input_vars "qiskit.circuit.library.HiddenLinearFunction.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.HiddenLinearFunction.num_vars "qiskit.circuit.library.HiddenLinearFunction.num_vars") + [`num_stretches()`](#qiskit.circuit.library.HiddenLinearFunction.num_stretches "qiskit.circuit.library.HiddenLinearFunction.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.HiddenLinearFunction.num_captured_vars "qiskit.circuit.library.HiddenLinearFunction.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.HiddenLinearFunction.duration "qiskit.circuit.library.HiddenLinearFunction.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.IQP.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.IQP.mdx index fe82e898c16..9f5ea6a5982 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.IQP.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.IQP.mdx @@ -45,470 +45,6 @@ python_api_name: qiskit.circuit.library.IQP ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.IQP.unit "qiskit.circuit.library.IQP.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.IQP.num_input_vars "qiskit.circuit.library.IQP.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.IQP.num_input_vars "qiskit.circuit.library.IQP.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.IQP.num_vars "qiskit.circuit.library.IQP.num_vars") + [`num_stretches()`](#qiskit.circuit.library.IQP.num_stretches "qiskit.circuit.library.IQP.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.IQP.num_captured_vars "qiskit.circuit.library.IQP.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.IQP.duration "qiskit.circuit.library.IQP.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.InnerProduct.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.InnerProduct.mdx index 100169fb628..f3828d82c6a 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.InnerProduct.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.InnerProduct.mdx @@ -56,470 +56,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.InnerProduct.unit "qiskit.circuit.library.InnerProduct.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.InnerProduct.num_input_vars "qiskit.circuit.library.InnerProduct.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.InnerProduct.num_input_vars "qiskit.circuit.library.InnerProduct.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.InnerProduct.num_vars "qiskit.circuit.library.InnerProduct.num_vars") + [`num_stretches()`](#qiskit.circuit.library.InnerProduct.num_stretches "qiskit.circuit.library.InnerProduct.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.InnerProduct.num_captured_vars "qiskit.circuit.library.InnerProduct.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.InnerProduct.duration "qiskit.circuit.library.InnerProduct.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.IntegerComparator.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.IntegerComparator.mdx index 5a212b3085c..dc88b1c2377 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.IntegerComparator.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.IntegerComparator.mdx @@ -32,70 +32,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.IntegerComparator.unit "qiskit.circuit.library.IntegerComparator.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### geq @@ -106,214 +42,6 @@ $$ True, if the comparator compares `>=`, False if `<`. - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.IntegerComparator.num_input_vars "qiskit.circuit.library.IntegerComparator.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.IntegerComparator.num_input_vars "qiskit.circuit.library.IntegerComparator.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.IntegerComparator.num_vars "qiskit.circuit.library.IntegerComparator.num_vars") + [`num_stretches()`](#qiskit.circuit.library.IntegerComparator.num_stretches "qiskit.circuit.library.IntegerComparator.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.IntegerComparator.num_captured_vars "qiskit.circuit.library.IntegerComparator.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - ### num\_state\_qubits @@ -324,186 +52,6 @@ $$ The number of state qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.IntegerComparator.duration "qiskit.circuit.library.IntegerComparator.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### value diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.LinearAmplitudeFunction.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.LinearAmplitudeFunction.mdx index 1f147cd2855..c4dc7792435 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.LinearAmplitudeFunction.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.LinearAmplitudeFunction.mdx @@ -71,470 +71,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.LinearAmplitudeFunction.unit "qiskit.circuit.library.LinearAmplitudeFunction.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.LinearAmplitudeFunction.num_input_vars "qiskit.circuit.library.LinearAmplitudeFunction.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.LinearAmplitudeFunction.num_input_vars "qiskit.circuit.library.LinearAmplitudeFunction.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.LinearAmplitudeFunction.num_vars "qiskit.circuit.library.LinearAmplitudeFunction.num_vars") + [`num_stretches()`](#qiskit.circuit.library.LinearAmplitudeFunction.num_stretches "qiskit.circuit.library.LinearAmplitudeFunction.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.LinearAmplitudeFunction.num_captured_vars "qiskit.circuit.library.LinearAmplitudeFunction.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.LinearAmplitudeFunction.duration "qiskit.circuit.library.LinearAmplitudeFunction.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.LinearPauliRotations.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.LinearPauliRotations.mdx index 953e2f363ee..e2d56408538 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.LinearPauliRotations.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.LinearPauliRotations.mdx @@ -46,326 +46,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### basis - - - The kind of Pauli rotation to be used. - - Set the basis to ‘X’, ‘Y’ or ‘Z’ for controlled-X, -Y, or -Z rotations respectively. - - **Returns** - - The kind of Pauli rotation used in controlled rotation. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.LinearPauliRotations.unit "qiskit.circuit.library.LinearPauliRotations.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancilla\_qubits - - - The minimum number of ancilla qubits in the circuit. - - **Returns** - - The minimal number of ancillas required. - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.LinearPauliRotations.num_input_vars "qiskit.circuit.library.LinearPauliRotations.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.LinearPauliRotations.num_input_vars "qiskit.circuit.library.LinearPauliRotations.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.LinearPauliRotations.num_vars "qiskit.circuit.library.LinearPauliRotations.num_vars") + [`num_stretches()`](#qiskit.circuit.library.LinearPauliRotations.num_stretches "qiskit.circuit.library.LinearPauliRotations.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.LinearPauliRotations.num_captured_vars "qiskit.circuit.library.LinearPauliRotations.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits representing the state $|x\rangle$. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - ### offset @@ -378,160 +58,6 @@ $$ The offset angle. - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### slope @@ -544,16 +70,6 @@ $$ The rotation angle common in all controlled rotations. - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.LinearPauliRotations.duration "qiskit.circuit.library.LinearPauliRotations.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.MCMT.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.MCMT.mdx index a6e87724a92..988513a9411 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.MCMT.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.MCMT.mdx @@ -49,476 +49,12 @@ python_api_name: qiskit.circuit.library.MCMT ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.MCMT.unit "qiskit.circuit.library.MCMT.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - ### num\_ancilla\_qubits Return the number of ancillas. - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.MCMT.num_input_vars "qiskit.circuit.library.MCMT.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.MCMT.num_input_vars "qiskit.circuit.library.MCMT.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.MCMT.num_vars "qiskit.circuit.library.MCMT.num_vars") + [`num_stretches()`](#qiskit.circuit.library.MCMT.num_stretches "qiskit.circuit.library.MCMT.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.MCMT.num_captured_vars "qiskit.circuit.library.MCMT.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.MCMT.duration "qiskit.circuit.library.MCMT.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.MCMTVChain.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.MCMTVChain.mdx index e5beb7f0384..0b3cb6a5f72 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.MCMTVChain.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.MCMTVChain.mdx @@ -66,476 +66,12 @@ python_api_name: qiskit.circuit.library.MCMTVChain * **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – * **num\_target\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.MCMTVChain.unit "qiskit.circuit.library.MCMTVChain.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - ### num\_ancilla\_qubits Return the number of ancilla qubits required. - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.MCMTVChain.num_input_vars "qiskit.circuit.library.MCMTVChain.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.MCMTVChain.num_input_vars "qiskit.circuit.library.MCMTVChain.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.MCMTVChain.num_vars "qiskit.circuit.library.MCMTVChain.num_vars") + [`num_stretches()`](#qiskit.circuit.library.MCMTVChain.num_stretches "qiskit.circuit.library.MCMTVChain.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.MCMTVChain.num_captured_vars "qiskit.circuit.library.MCMTVChain.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.MCMTVChain.duration "qiskit.circuit.library.MCMTVChain.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.MCXGrayCode.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.MCXGrayCode.mdx index 9a153468934..e83a4c872f6 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.MCXGrayCode.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.MCXGrayCode.mdx @@ -17,7 +17,7 @@ python_api_name: qiskit.circuit.library.MCXGrayCode Create new MCX gate. - ## Attributes + ## Methods **Parameters** @@ -25,121 +25,6 @@ python_api_name: qiskit.circuit.library.MCXGrayCode * **label** (*Optional\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – * **ctrl\_state** (*Optional\[Union\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – - ### base\_class - - - Get the base class of this instruction. This is guaranteed to be in the inheritance tree of `self`. - - The “base class” of an instruction is the lowest class in its inheritance tree that the object should be considered entirely compatible with for \_all\_ circuit applications. This typically means that the subclass is defined purely to offer some sort of programmer convenience over the base class, and the base class is the “true” class for a behavioral perspective. In particular, you should *not* override [`base_class`](#qiskit.circuit.library.MCXGrayCode.base_class "qiskit.circuit.library.MCXGrayCode.base_class") if you are defining a custom version of an instruction that will be implemented differently by hardware, such as an alternative measurement strategy, or a version of a parametrized gate with a particular set of parameters for the purposes of distinguishing it in a [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") from the full parametrized gate. - - This is often exactly equivalent to `type(obj)`, except in the case of singleton instances of standard-library instructions. These singleton instances are special subclasses of their base class, and this property will return that base. For example: - - ```python - >>> isinstance(XGate(), XGate) - True - >>> type(XGate()) is XGate - False - >>> XGate().base_class is XGate - True - ``` - - In general, you should not rely on the precise class of an instruction; within a given circuit, it is expected that `Instruction.name` should be a more suitable discriminator in most situations. - - - ### ctrl\_state - - - Return the control state of the gate as a decimal integer. - - - ### decompositions - - - Get the decompositions of the instruction from the SessionEquivalenceLibrary. - - - ### definition - - - Return definition in terms of other basic gates. If the gate has open controls, as determined from [`ctrl_state`](#qiskit.circuit.library.MCXGrayCode.ctrl_state "qiskit.circuit.library.MCXGrayCode.ctrl_state"), the returned definition is conjugated with X without changing the internal `_definition`. - - - ### label - - - Return instruction label - - - ### mutable - - - Is this instance is a mutable unique instance or not. - - If this attribute is `False` the gate instance is a shared singleton and is not mutable. - - - ### name - - - Get name of gate. If the gate has open controls the gate name will become: - - > \ - - where \ is the gate name for the default case of closed control qubits and \ is the integer value of the control state for the gate. - - - ### num\_ancilla\_qubits - - - The number of ancilla qubits. - - - ### num\_clbits - - - Return the number of clbits. - - - ### num\_ctrl\_qubits - - - Get number of control qubits. - - **Returns** - - The number of control qubits for the gate. - - **Return type** - - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") - - - ### num\_qubits - - - Return the number of qubits. - - - ### params - - - Get parameters from base\_gate. - - **Returns** - - List of gate parameters. - - **Return type** - - [list](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") - - **Raises** - - [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – Controlled gate does not define a base gate - - - ## Methods - ### inverse diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.MCXRecursive.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.MCXRecursive.mdx index 7134e9b7bd3..f559b53a12c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.MCXRecursive.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.MCXRecursive.mdx @@ -24,7 +24,7 @@ python_api_name: qiskit.circuit.library.MCXRecursive Create new MCX gate. - ## Attributes + ## Methods **Parameters** @@ -32,121 +32,6 @@ python_api_name: qiskit.circuit.library.MCXRecursive * **label** (*Optional\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – * **ctrl\_state** (*Optional\[Union\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – - ### base\_class - - - Get the base class of this instruction. This is guaranteed to be in the inheritance tree of `self`. - - The “base class” of an instruction is the lowest class in its inheritance tree that the object should be considered entirely compatible with for \_all\_ circuit applications. This typically means that the subclass is defined purely to offer some sort of programmer convenience over the base class, and the base class is the “true” class for a behavioral perspective. In particular, you should *not* override [`base_class`](#qiskit.circuit.library.MCXRecursive.base_class "qiskit.circuit.library.MCXRecursive.base_class") if you are defining a custom version of an instruction that will be implemented differently by hardware, such as an alternative measurement strategy, or a version of a parametrized gate with a particular set of parameters for the purposes of distinguishing it in a [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") from the full parametrized gate. - - This is often exactly equivalent to `type(obj)`, except in the case of singleton instances of standard-library instructions. These singleton instances are special subclasses of their base class, and this property will return that base. For example: - - ```python - >>> isinstance(XGate(), XGate) - True - >>> type(XGate()) is XGate - False - >>> XGate().base_class is XGate - True - ``` - - In general, you should not rely on the precise class of an instruction; within a given circuit, it is expected that `Instruction.name` should be a more suitable discriminator in most situations. - - - ### ctrl\_state - - - Return the control state of the gate as a decimal integer. - - - ### decompositions - - - Get the decompositions of the instruction from the SessionEquivalenceLibrary. - - - ### definition - - - Return definition in terms of other basic gates. If the gate has open controls, as determined from [`ctrl_state`](#qiskit.circuit.library.MCXRecursive.ctrl_state "qiskit.circuit.library.MCXRecursive.ctrl_state"), the returned definition is conjugated with X without changing the internal `_definition`. - - - ### label - - - Return instruction label - - - ### mutable - - - Is this instance is a mutable unique instance or not. - - If this attribute is `False` the gate instance is a shared singleton and is not mutable. - - - ### name - - - Get name of gate. If the gate has open controls the gate name will become: - - > \ - - where \ is the gate name for the default case of closed control qubits and \ is the integer value of the control state for the gate. - - - ### num\_ancilla\_qubits - - - The number of ancilla qubits. - - - ### num\_clbits - - - Return the number of clbits. - - - ### num\_ctrl\_qubits - - - Get number of control qubits. - - **Returns** - - The number of control qubits for the gate. - - **Return type** - - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") - - - ### num\_qubits - - - Return the number of qubits. - - - ### params - - - Get parameters from base\_gate. - - **Returns** - - List of gate parameters. - - **Return type** - - [list](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") - - **Raises** - - [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – Controlled gate does not define a base gate - - - ## Methods - ### get\_num\_ancilla\_qubits diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.MCXVChain.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.MCXVChain.mdx index 99d5942161e..230af85b12c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.MCXVChain.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.MCXVChain.mdx @@ -22,121 +22,6 @@ python_api_name: qiskit.circuit.library.MCXVChain * **label** (*Optional\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – * **ctrl\_state** (*Optional\[Union\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]]*) – - ## Attributes - - ### base\_class - - - Get the base class of this instruction. This is guaranteed to be in the inheritance tree of `self`. - - The “base class” of an instruction is the lowest class in its inheritance tree that the object should be considered entirely compatible with for \_all\_ circuit applications. This typically means that the subclass is defined purely to offer some sort of programmer convenience over the base class, and the base class is the “true” class for a behavioral perspective. In particular, you should *not* override [`base_class`](#qiskit.circuit.library.MCXVChain.base_class "qiskit.circuit.library.MCXVChain.base_class") if you are defining a custom version of an instruction that will be implemented differently by hardware, such as an alternative measurement strategy, or a version of a parametrized gate with a particular set of parameters for the purposes of distinguishing it in a [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") from the full parametrized gate. - - This is often exactly equivalent to `type(obj)`, except in the case of singleton instances of standard-library instructions. These singleton instances are special subclasses of their base class, and this property will return that base. For example: - - ```python - >>> isinstance(XGate(), XGate) - True - >>> type(XGate()) is XGate - False - >>> XGate().base_class is XGate - True - ``` - - In general, you should not rely on the precise class of an instruction; within a given circuit, it is expected that `Instruction.name` should be a more suitable discriminator in most situations. - - - ### ctrl\_state - - - Return the control state of the gate as a decimal integer. - - - ### decompositions - - - Get the decompositions of the instruction from the SessionEquivalenceLibrary. - - - ### definition - - - Return definition in terms of other basic gates. If the gate has open controls, as determined from [`ctrl_state`](#qiskit.circuit.library.MCXVChain.ctrl_state "qiskit.circuit.library.MCXVChain.ctrl_state"), the returned definition is conjugated with X without changing the internal `_definition`. - - - ### label - - - Return instruction label - - - ### mutable - - - Is this instance is a mutable unique instance or not. - - If this attribute is `False` the gate instance is a shared singleton and is not mutable. - - - ### name - - - Get name of gate. If the gate has open controls the gate name will become: - - > \ - - where \ is the gate name for the default case of closed control qubits and \ is the integer value of the control state for the gate. - - - ### num\_ancilla\_qubits - - - The number of ancilla qubits. - - - ### num\_clbits - - - Return the number of clbits. - - - ### num\_ctrl\_qubits - - - Get number of control qubits. - - **Returns** - - The number of control qubits for the gate. - - **Return type** - - [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") - - - ### num\_qubits - - - Return the number of qubits. - - - ### params - - - Get parameters from base\_gate. - - **Returns** - - List of gate parameters. - - **Return type** - - [list](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") - - **Raises** - - [**CircuitError**](circuit#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") – Controlled gate does not define a base gate - - ## Methods ### get\_num\_ancilla\_qubits diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.NLocal.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.NLocal.mdx index e936d31198a..09ab12f24e1 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.NLocal.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.NLocal.mdx @@ -70,70 +70,6 @@ python_api_name: qiskit.circuit.library.NLocal ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.NLocal.unit "qiskit.circuit.library.NLocal.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### entanglement @@ -160,38 +96,6 @@ python_api_name: qiskit.circuit.library.NLocal Returns whether the circuit is wrapped in nested gates/instructions or flattened. - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - ### initial\_state @@ -212,170 +116,6 @@ python_api_name: qiskit.circuit.library.NLocal `True`, if barriers are inserted in between the layers, `False` if not. - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.NLocal.num_input_vars "qiskit.circuit.library.NLocal.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.NLocal.num_input_vars "qiskit.circuit.library.NLocal.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.NLocal.num_vars "qiskit.circuit.library.NLocal.num_vars") + [`num_stretches()`](#qiskit.circuit.library.NLocal.num_stretches "qiskit.circuit.library.NLocal.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.NLocal.num_captured_vars "qiskit.circuit.library.NLocal.num_captured_vars") must be zero. - - ### num\_layers @@ -386,12 +126,6 @@ python_api_name: qiskit.circuit.library.NLocal The number of layers in the circuit. - ### num\_parameters - - - The number of parameter objects in the circuit. - - ### num\_parameters\_settable @@ -418,102 +152,6 @@ python_api_name: qiskit.circuit.library.NLocal The number of qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - ### ordered\_parameters @@ -550,64 +188,6 @@ python_api_name: qiskit.circuit.library.NLocal A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - ### preferred\_init\_points @@ -618,22 +198,6 @@ python_api_name: qiskit.circuit.library.NLocal The initial values for the parameters, or None, if none have been set. - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### reps @@ -654,16 +218,6 @@ python_api_name: qiskit.circuit.library.NLocal The blocks in the rotation layers. - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.NLocal.duration "qiskit.circuit.library.NLocal.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.OR.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.OR.mdx index 5e20b9543ae..f14c0d5a1ac 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.OR.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.OR.mdx @@ -37,470 +37,6 @@ python_api_name: qiskit.circuit.library.OR ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.OR.unit "qiskit.circuit.library.OR.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.OR.num_input_vars "qiskit.circuit.library.OR.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.OR.num_input_vars "qiskit.circuit.library.OR.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.OR.num_vars "qiskit.circuit.library.OR.num_vars") + [`num_stretches()`](#qiskit.circuit.library.OR.num_stretches "qiskit.circuit.library.OR.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.OR.num_captured_vars "qiskit.circuit.library.OR.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.OR.duration "qiskit.circuit.library.OR.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PauliEvolutionGate.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PauliEvolutionGate.mdx index 67a0019f138..106f3447fd5 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PauliEvolutionGate.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PauliEvolutionGate.mdx @@ -396,11 +396,11 @@ $$ **Parameters** - **parameter** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + **parameter** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – **Return type** - [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") + [*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") | [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PauliFeatureMap.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PauliFeatureMap.mdx index dad29e65872..398020a24ec 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PauliFeatureMap.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PauliFeatureMap.mdx @@ -126,80 +126,6 @@ $$ The Pauli rotation factor. - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PauliFeatureMap.unit "qiskit.circuit.library.PauliFeatureMap.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see [`get_entangler_map()`](#qiskit.circuit.library.PauliFeatureMap.get_entangler_map "qiskit.circuit.library.PauliFeatureMap.get_entangler_map") for more detail on how the format is interpreted. - - ### entanglement\_blocks @@ -220,450 +146,12 @@ $$ The feature dimension of this feature map. - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PauliFeatureMap.num_input_vars "qiskit.circuit.library.PauliFeatureMap.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PauliFeatureMap.num_input_vars "qiskit.circuit.library.PauliFeatureMap.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PauliFeatureMap.num_vars "qiskit.circuit.library.PauliFeatureMap.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PauliFeatureMap.num_stretches "qiskit.circuit.library.PauliFeatureMap.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PauliFeatureMap.num_captured_vars "qiskit.circuit.library.PauliFeatureMap.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - ### num\_parameters\_settable The number of distinct parameters. - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - ### paulis @@ -674,62 +162,6 @@ $$ The Pauli strings as list. - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PauliFeatureMap.duration "qiskit.circuit.library.PauliFeatureMap.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PauliTwoDesign.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PauliTwoDesign.mdx index a8d1a77245d..c9558f8c31f 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PauliTwoDesign.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PauliTwoDesign.mdx @@ -69,328 +69,6 @@ python_api_name: qiskit.circuit.library.PauliTwoDesign ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PauliTwoDesign.unit "qiskit.circuit.library.PauliTwoDesign.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PauliTwoDesign.num_input_vars "qiskit.circuit.library.PauliTwoDesign.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PauliTwoDesign.num_input_vars "qiskit.circuit.library.PauliTwoDesign.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PauliTwoDesign.num_vars "qiskit.circuit.library.PauliTwoDesign.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PauliTwoDesign.num_stretches "qiskit.circuit.library.PauliTwoDesign.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PauliTwoDesign.num_captured_vars "qiskit.circuit.library.PauliTwoDesign.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - ### num\_parameters\_settable @@ -401,262 +79,6 @@ python_api_name: qiskit.circuit.library.PauliTwoDesign The number of possibly distinct parameters. - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PauliTwoDesign.duration "qiskit.circuit.library.PauliTwoDesign.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.Permutation.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.Permutation.mdx index 7355d157e7c..39ae2848eac 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.Permutation.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.Permutation.mdx @@ -39,470 +39,6 @@ python_api_name: qiskit.circuit.library.Permutation ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.Permutation.unit "qiskit.circuit.library.Permutation.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.Permutation.num_input_vars "qiskit.circuit.library.Permutation.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.Permutation.num_input_vars "qiskit.circuit.library.Permutation.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.Permutation.num_vars "qiskit.circuit.library.Permutation.num_vars") + [`num_stretches()`](#qiskit.circuit.library.Permutation.num_stretches "qiskit.circuit.library.Permutation.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.Permutation.num_captured_vars "qiskit.circuit.library.Permutation.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.Permutation.duration "qiskit.circuit.library.Permutation.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PhaseEstimation.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PhaseEstimation.mdx index 4afb3afbcff..8f85c9985a0 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PhaseEstimation.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PhaseEstimation.mdx @@ -56,470 +56,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PhaseEstimation.unit "qiskit.circuit.library.PhaseEstimation.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PhaseEstimation.num_input_vars "qiskit.circuit.library.PhaseEstimation.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PhaseEstimation.num_input_vars "qiskit.circuit.library.PhaseEstimation.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PhaseEstimation.num_vars "qiskit.circuit.library.PhaseEstimation.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PhaseEstimation.num_stretches "qiskit.circuit.library.PhaseEstimation.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PhaseEstimation.num_captured_vars "qiskit.circuit.library.PhaseEstimation.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PhaseEstimation.duration "qiskit.circuit.library.PhaseEstimation.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PhaseOracle.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PhaseOracle.mdx index 2103c73670e..e0e267ddec7 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PhaseOracle.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PhaseOracle.mdx @@ -36,470 +36,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PhaseOracle.unit "qiskit.circuit.library.PhaseOracle.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PhaseOracle.num_input_vars "qiskit.circuit.library.PhaseOracle.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PhaseOracle.num_input_vars "qiskit.circuit.library.PhaseOracle.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PhaseOracle.num_vars "qiskit.circuit.library.PhaseOracle.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PhaseOracle.num_stretches "qiskit.circuit.library.PhaseOracle.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PhaseOracle.num_captured_vars "qiskit.circuit.library.PhaseOracle.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PhaseOracle.duration "qiskit.circuit.library.PhaseOracle.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseChebyshev.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseChebyshev.mdx index 822f77bc68d..e06280ca55b 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseChebyshev.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseChebyshev.mdx @@ -54,12 +54,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - ### breakpoints @@ -70,54 +64,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev The breakpoints for the piecewise approximation. - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - ### degree @@ -128,16 +74,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev The degree of the polynomials. - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PiecewiseChebyshev.unit "qiskit.circuit.library.PiecewiseChebyshev.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### f\_x @@ -148,214 +84,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev The function to be approximated. - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewiseChebyshev.num_input_vars "qiskit.circuit.library.PiecewiseChebyshev.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewiseChebyshev.num_input_vars "qiskit.circuit.library.PiecewiseChebyshev.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PiecewiseChebyshev.num_vars "qiskit.circuit.library.PiecewiseChebyshev.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PiecewiseChebyshev.num_stretches "qiskit.circuit.library.PiecewiseChebyshev.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PiecewiseChebyshev.num_captured_vars "qiskit.circuit.library.PiecewiseChebyshev.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - ### num\_state\_qubits @@ -366,160 +94,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev The number of state qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - ### polynomials @@ -534,32 +108,6 @@ python_api_name: qiskit.circuit.library.PiecewiseChebyshev [**TypeError**](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.13)") – If the input function is not in the correct format. - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PiecewiseChebyshev.duration "qiskit.circuit.library.PiecewiseChebyshev.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseLinearPauliRotations.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseLinearPauliRotations.mdx index 7d36624ec8e..24de90c47c7 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseLinearPauliRotations.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewiseLinearPauliRotations.mdx @@ -37,24 +37,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### basis - - - The kind of Pauli rotation to be used. - - Set the basis to ‘X’, ‘Y’ or ‘Z’ for controlled-X, -Y, or -Z rotations respectively. - - **Returns** - - The kind of Pauli rotation used in controlled rotation. - - ### breakpoints @@ -63,34 +45,6 @@ $$ The function is linear in the intervals `[point_i, point_{i+1}]` where the last point implicitly is `2**(num_state_qubits + 1)`. - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - ### contains\_zero\_breakpoint @@ -101,116 +55,6 @@ $$ True, if 0 is the first breakpoint, otherwise False. - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.unit "qiskit.circuit.library.PiecewiseLinearPauliRotations.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - ### mapped\_offsets @@ -231,170 +75,6 @@ $$ The mapped slopes. - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancilla\_qubits - - - The minimum number of ancilla qubits in the circuit. - - **Returns** - - The minimal number of ancillas required. - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.num_input_vars "qiskit.circuit.library.PiecewiseLinearPauliRotations.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.num_input_vars "qiskit.circuit.library.PiecewiseLinearPauliRotations.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.num_vars "qiskit.circuit.library.PiecewiseLinearPauliRotations.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.num_stretches "qiskit.circuit.library.PiecewiseLinearPauliRotations.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.num_captured_vars "qiskit.circuit.library.PiecewiseLinearPauliRotations.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits representing the state $|x\rangle$. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - ### offsets @@ -403,160 +83,6 @@ $$ The function is linear in the intervals `[point_i, point_{i+1}]` where the last point implicitly is `2**(num_state_qubits + 1)`. - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### slopes @@ -565,16 +91,6 @@ $$ The function is linear in the intervals `[point_i, point_{i+1}]` where the last point implicitly is `2**(num_state_qubits + 1)`. - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PiecewiseLinearPauliRotations.duration "qiskit.circuit.library.PiecewiseLinearPauliRotations.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewisePolynomialPauliRotations.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewisePolynomialPauliRotations.mdx index bcfa8a35114..787d5d68e14 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PiecewisePolynomialPauliRotations.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PiecewisePolynomialPauliRotations.mdx @@ -83,24 +83,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### basis - - - The kind of Pauli rotation to be used. - - Set the basis to ‘X’, ‘Y’ or ‘Z’ for controlled-X, -Y, or -Z rotations respectively. - - **Returns** - - The kind of Pauli rotation used in controlled rotation. - - ### breakpoints @@ -113,34 +95,6 @@ $$ The list of breakpoints. - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - ### coeffs @@ -161,116 +115,6 @@ $$ True, if 0 is the first breakpoint, otherwise False. - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.unit "qiskit.circuit.library.PiecewisePolynomialPauliRotations.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - ### mapped\_coeffs @@ -281,334 +125,6 @@ $$ The mapped coefficients. - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancilla\_qubits - - - The minimum number of ancilla qubits in the circuit. - - **Returns** - - The minimal number of ancillas required. - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_input_vars "qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_input_vars "qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_vars "qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_stretches "qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_captured_vars "qiskit.circuit.library.PiecewisePolynomialPauliRotations.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits representing the state $|x\rangle$. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PiecewisePolynomialPauliRotations.duration "qiskit.circuit.library.PiecewisePolynomialPauliRotations.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.PolynomialPauliRotations.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.PolynomialPauliRotations.mdx index d4e22d3303d..01d4b44929a 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.PolynomialPauliRotations.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.PolynomialPauliRotations.mdx @@ -45,52 +45,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### basis - - - The kind of Pauli rotation to be used. - - Set the basis to ‘X’, ‘Y’ or ‘Z’ for controlled-X, -Y, or -Z rotations respectively. - - **Returns** - - The kind of Pauli rotation used in controlled rotation. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - ### coeffs @@ -109,26 +63,6 @@ $$ The coefficients of the polynomial. - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - ### degree @@ -139,424 +73,6 @@ $$ The degree of the polynomial. If the coefficients have not been set, return 0. - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.PolynomialPauliRotations.unit "qiskit.circuit.library.PolynomialPauliRotations.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancilla\_qubits - - - The minimum number of ancilla qubits in the circuit. - - **Returns** - - The minimal number of ancillas required. - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PolynomialPauliRotations.num_input_vars "qiskit.circuit.library.PolynomialPauliRotations.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.PolynomialPauliRotations.num_input_vars "qiskit.circuit.library.PolynomialPauliRotations.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.PolynomialPauliRotations.num_vars "qiskit.circuit.library.PolynomialPauliRotations.num_vars") + [`num_stretches()`](#qiskit.circuit.library.PolynomialPauliRotations.num_stretches "qiskit.circuit.library.PolynomialPauliRotations.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.PolynomialPauliRotations.num_captured_vars "qiskit.circuit.library.PolynomialPauliRotations.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits representing the state $|x\rangle$. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.PolynomialPauliRotations.duration "qiskit.circuit.library.PolynomialPauliRotations.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.QAOAAnsatz.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.QAOAAnsatz.mdx index bca79c21d6c..3eec7352e1d 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.QAOAAnsatz.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.QAOAAnsatz.mdx @@ -30,40 +30,6 @@ python_api_name: qiskit.circuit.library.QAOAAnsatz ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - ### cost\_operator @@ -78,194 +44,12 @@ python_api_name: qiskit.circuit.library.QAOAAnsatz BaseOperator or OperatorBase - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.QAOAAnsatz.unit "qiskit.circuit.library.QAOAAnsatz.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### evolution - - - The evolution converter used to compute the evolution. - - **Returns** - - The evolution converter used to compute the evolution. - - **Return type** - - [EvolutionSynthesis](qiskit.synthesis.EvolutionSynthesis "qiskit.synthesis.EvolutionSynthesis") - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - ### initial\_state Returns an optional initial state as a circuit - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - ### mixer\_operator @@ -280,232 +64,10 @@ python_api_name: qiskit.circuit.library.QAOAAnsatz BaseOperator or OperatorBase or [QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"), optional - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QAOAAnsatz.num_input_vars "qiskit.circuit.library.QAOAAnsatz.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QAOAAnsatz.num_input_vars "qiskit.circuit.library.QAOAAnsatz.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.QAOAAnsatz.num_vars "qiskit.circuit.library.QAOAAnsatz.num_vars") + [`num_stretches()`](#qiskit.circuit.library.QAOAAnsatz.num_stretches "qiskit.circuit.library.QAOAAnsatz.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.QAOAAnsatz.num_captured_vars "qiskit.circuit.library.QAOAAnsatz.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - ### num\_qubits - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - ### operators @@ -522,32 +84,6 @@ python_api_name: qiskit.circuit.library.QAOAAnsatz List\[Union\[BaseOperator, OperatorBase, [QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")]] - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - ### parameter\_bounds @@ -558,112 +94,12 @@ python_api_name: qiskit.circuit.library.QAOAAnsatz A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If None is returned, problem is fully unbounded. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - Getter of preferred initial points based on the given initial state. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### reps Returns the reps parameter, which determines the depth of the circuit. - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.QAOAAnsatz.duration "qiskit.circuit.library.QAOAAnsatz.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.QFT.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.QFT.mdx index 165038f1b72..eec5d96c198 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.QFT.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.QFT.mdx @@ -52,12 +52,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - ### approximation\_degree @@ -68,54 +62,6 @@ $$ The currently set approximation degree. - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - ### do\_swaps @@ -126,48 +72,6 @@ $$ True, if the final swaps are applied, False if not. - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.QFT.unit "qiskit.circuit.library.QFT.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - ### insert\_barriers @@ -178,176 +82,6 @@ $$ True, if barriers are inserted, False if not. - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QFT.num_input_vars "qiskit.circuit.library.QFT.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QFT.num_input_vars "qiskit.circuit.library.QFT.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.QFT.num_vars "qiskit.circuit.library.QFT.num_vars") + [`num_stretches()`](#qiskit.circuit.library.QFT.num_stretches "qiskit.circuit.library.QFT.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.QFT.num_captured_vars "qiskit.circuit.library.QFT.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - ### num\_qubits @@ -358,186 +92,6 @@ $$ The number of qubits in the circuit. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.QFT.duration "qiskit.circuit.library.QFT.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.QuadraticForm.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.QuadraticForm.mdx index fbe73d81371..cee3082e276 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.QuadraticForm.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.QuadraticForm.mdx @@ -58,470 +58,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.QuadraticForm.unit "qiskit.circuit.library.QuadraticForm.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QuadraticForm.num_input_vars "qiskit.circuit.library.QuadraticForm.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QuadraticForm.num_input_vars "qiskit.circuit.library.QuadraticForm.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.QuadraticForm.num_vars "qiskit.circuit.library.QuadraticForm.num_vars") + [`num_stretches()`](#qiskit.circuit.library.QuadraticForm.num_stretches "qiskit.circuit.library.QuadraticForm.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.QuadraticForm.num_captured_vars "qiskit.circuit.library.QuadraticForm.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.QuadraticForm.duration "qiskit.circuit.library.QuadraticForm.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx index 13e5b8f0e29..4303ada6187 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.QuantumVolume.mdx @@ -45,470 +45,6 @@ python_api_name: qiskit.circuit.library.QuantumVolume ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.QuantumVolume.unit "qiskit.circuit.library.QuantumVolume.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QuantumVolume.num_input_vars "qiskit.circuit.library.QuantumVolume.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.QuantumVolume.num_input_vars "qiskit.circuit.library.QuantumVolume.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.QuantumVolume.num_vars "qiskit.circuit.library.QuantumVolume.num_vars") + [`num_stretches()`](#qiskit.circuit.library.QuantumVolume.num_stretches "qiskit.circuit.library.QuantumVolume.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.QuantumVolume.num_captured_vars "qiskit.circuit.library.QuantumVolume.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.QuantumVolume.duration "qiskit.circuit.library.QuantumVolume.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx index c8bbad81a82..071473472ed 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.RGQFTMultiplier.mdx @@ -46,490 +46,6 @@ python_api_name: qiskit.circuit.library.RGQFTMultiplier ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.RGQFTMultiplier.unit "qiskit.circuit.library.RGQFTMultiplier.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.RGQFTMultiplier.num_input_vars "qiskit.circuit.library.RGQFTMultiplier.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.RGQFTMultiplier.num_input_vars "qiskit.circuit.library.RGQFTMultiplier.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.RGQFTMultiplier.num_vars "qiskit.circuit.library.RGQFTMultiplier.num_vars") + [`num_stretches()`](#qiskit.circuit.library.RGQFTMultiplier.num_stretches "qiskit.circuit.library.RGQFTMultiplier.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.RGQFTMultiplier.num_captured_vars "qiskit.circuit.library.RGQFTMultiplier.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_result\_qubits - - - The number of result qubits to limit the output to. - - **Returns** - - The number of result qubits. - - - ### num\_state\_qubits - - - The number of state qubits, i.e. the number of bits in each input register. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.RGQFTMultiplier.duration "qiskit.circuit.library.RGQFTMultiplier.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.RGate.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.RGate.mdx index 31b414ef084..e9d94c9176b 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.RGate.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.RGate.mdx @@ -41,8 +41,8 @@ $$ **Parameters** - * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – - * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + * **theta** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *| None*) – ### base\_class diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx index df4773a2304..53afcb827d0 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.RealAmplitudes.mdx @@ -125,476 +125,6 @@ python_api_name: qiskit.circuit.library.RealAmplitudes ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.RealAmplitudes.unit "qiskit.circuit.library.RealAmplitudes.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.RealAmplitudes.num_input_vars "qiskit.circuit.library.RealAmplitudes.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.RealAmplitudes.num_input_vars "qiskit.circuit.library.RealAmplitudes.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.RealAmplitudes.num_vars "qiskit.circuit.library.RealAmplitudes.num_vars") + [`num_stretches()`](#qiskit.circuit.library.RealAmplitudes.num_stretches "qiskit.circuit.library.RealAmplitudes.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.RealAmplitudes.num_captured_vars "qiskit.circuit.library.RealAmplitudes.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - ### parameter\_bounds @@ -605,120 +135,6 @@ python_api_name: qiskit.circuit.library.RealAmplitudes The parameter bounds. - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.RealAmplitudes.duration "qiskit.circuit.library.RealAmplitudes.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx index 86876c87423..3060ea33d1c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.TwoLocal.mdx @@ -132,600 +132,6 @@ python_api_name: qiskit.circuit.library.TwoLocal ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.TwoLocal.unit "qiskit.circuit.library.TwoLocal.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see [`get_entangler_map()`](#qiskit.circuit.library.TwoLocal.get_entangler_map "qiskit.circuit.library.TwoLocal.get_entangler_map") for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.TwoLocal.num_input_vars "qiskit.circuit.library.TwoLocal.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.TwoLocal.num_input_vars "qiskit.circuit.library.TwoLocal.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.TwoLocal.num_vars "qiskit.circuit.library.TwoLocal.num_vars") + [`num_stretches()`](#qiskit.circuit.library.TwoLocal.num_stretches "qiskit.circuit.library.TwoLocal.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.TwoLocal.num_captured_vars "qiskit.circuit.library.TwoLocal.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of total parameters that can be set to distinct values. - - This does not change when the parameters are bound or exchanged for same parameters, and therefore is different from `num_parameters` which counts the number of unique [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects currently in the circuit. - - **Returns** - - The number of parameters originally available in the circuit. - - - This quantity does not require the circuit to be built yet. - - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.TwoLocal.duration "qiskit.circuit.library.TwoLocal.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.U2Gate.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.U2Gate.mdx index 610a66e814d..66f903af11d 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.U2Gate.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.U2Gate.mdx @@ -77,8 +77,8 @@ $$ **Parameters** - * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – - * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit.circuit.parameterexpression.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + * **phi** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – + * **lam** ([*ParameterExpression*](qiskit.circuit.ParameterExpression "qiskit._accelerate.circuit.ParameterExpression") *|*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – * **label** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *| None*) – ### base\_class diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx index 109cfa73efa..a530ce3352c 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.UnitaryOverlap.mdx @@ -65,470 +65,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.UnitaryOverlap.unit "qiskit.circuit.library.UnitaryOverlap.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.UnitaryOverlap.num_input_vars "qiskit.circuit.library.UnitaryOverlap.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.UnitaryOverlap.num_input_vars "qiskit.circuit.library.UnitaryOverlap.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.UnitaryOverlap.num_vars "qiskit.circuit.library.UnitaryOverlap.num_vars") + [`num_stretches()`](#qiskit.circuit.library.UnitaryOverlap.num_stretches "qiskit.circuit.library.UnitaryOverlap.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.UnitaryOverlap.num_captured_vars "qiskit.circuit.library.UnitaryOverlap.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.UnitaryOverlap.duration "qiskit.circuit.library.UnitaryOverlap.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx index 0f64025cb97..013b971df1a 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.VBERippleCarryAdder.mdx @@ -67,480 +67,6 @@ python_api_name: qiskit.circuit.library.VBERippleCarryAdder ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.VBERippleCarryAdder.unit "qiskit.circuit.library.VBERippleCarryAdder.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.VBERippleCarryAdder.num_input_vars "qiskit.circuit.library.VBERippleCarryAdder.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.VBERippleCarryAdder.num_input_vars "qiskit.circuit.library.VBERippleCarryAdder.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.VBERippleCarryAdder.num_vars "qiskit.circuit.library.VBERippleCarryAdder.num_vars") + [`num_stretches()`](#qiskit.circuit.library.VBERippleCarryAdder.num_stretches "qiskit.circuit.library.VBERippleCarryAdder.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.VBERippleCarryAdder.num_captured_vars "qiskit.circuit.library.VBERippleCarryAdder.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_state\_qubits - - - The number of state qubits, i.e. the number of bits in each input register. - - **Returns** - - The number of state qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.VBERippleCarryAdder.duration "qiskit.circuit.library.VBERippleCarryAdder.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.WeightedAdder.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.WeightedAdder.mdx index 0d99b8dbbc5..c0453165710 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.WeightedAdder.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.WeightedAdder.mdx @@ -64,214 +64,6 @@ $$ ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.WeightedAdder.unit "qiskit.circuit.library.WeightedAdder.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.WeightedAdder.num_input_vars "qiskit.circuit.library.WeightedAdder.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.WeightedAdder.num_input_vars "qiskit.circuit.library.WeightedAdder.num_input_vars") must be zero. - - ### num\_carry\_qubits @@ -284,26 +76,6 @@ $$ The number of carry qubits required to compute the sum. - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - ### num\_control\_qubits @@ -316,50 +88,6 @@ $$ The number of additional control qubits required (0 or 1). - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.WeightedAdder.num_vars "qiskit.circuit.library.WeightedAdder.num_vars") + [`num_stretches()`](#qiskit.circuit.library.WeightedAdder.num_stretches "qiskit.circuit.library.WeightedAdder.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.WeightedAdder.num_captured_vars "qiskit.circuit.library.WeightedAdder.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - ### num\_state\_qubits @@ -370,14 +98,6 @@ $$ The number of state qubits. - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - ### num\_sum\_qubits @@ -388,178 +108,6 @@ $$ The number of qubits needed to represent the weighted sum of the qubits. - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.WeightedAdder.duration "qiskit.circuit.library.WeightedAdder.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### weights diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.XOR.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.XOR.mdx index 608e7aae2b9..c3fe93a079a 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.XOR.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.XOR.mdx @@ -39,470 +39,6 @@ python_api_name: qiskit.circuit.library.XOR ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.XOR.unit "qiskit.circuit.library.XOR.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.XOR.num_input_vars "qiskit.circuit.library.XOR.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.XOR.num_input_vars "qiskit.circuit.library.XOR.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.XOR.num_vars "qiskit.circuit.library.XOR.num_vars") + [`num_stretches()`](#qiskit.circuit.library.XOR.num_stretches "qiskit.circuit.library.XOR.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.XOR.num_captured_vars "qiskit.circuit.library.XOR.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.XOR.duration "qiskit.circuit.library.XOR.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.ZFeatureMap.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.ZFeatureMap.mdx index b7621635d43..ffd8f9eba3f 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.ZFeatureMap.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.ZFeatureMap.mdx @@ -85,620 +85,6 @@ python_api_name: qiskit.circuit.library.ZFeatureMap ## Attributes - ### alpha - - - The Pauli rotation factor (alpha). - - **Returns** - - The Pauli rotation factor. - - - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.ZFeatureMap.unit "qiskit.circuit.library.ZFeatureMap.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### feature\_dimension - - - Returns the feature dimension (which is equal to the number of qubits). - - **Returns** - - The feature dimension of this feature map. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ZFeatureMap.num_input_vars "qiskit.circuit.library.ZFeatureMap.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ZFeatureMap.num_input_vars "qiskit.circuit.library.ZFeatureMap.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.ZFeatureMap.num_vars "qiskit.circuit.library.ZFeatureMap.num_vars") + [`num_stretches()`](#qiskit.circuit.library.ZFeatureMap.num_stretches "qiskit.circuit.library.ZFeatureMap.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.ZFeatureMap.num_captured_vars "qiskit.circuit.library.ZFeatureMap.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of distinct parameters. - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### paulis - - - The Pauli strings used in the entanglement of the qubits. - - **Returns** - - The Pauli strings as list. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.ZFeatureMap.duration "qiskit.circuit.library.ZFeatureMap.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.circuit.library.ZZFeatureMap.mdx b/docs/api/qiskit/dev/qiskit.circuit.library.ZZFeatureMap.mdx index 00db8e3c74e..5195f098140 100644 --- a/docs/api/qiskit/dev/qiskit.circuit.library.ZZFeatureMap.mdx +++ b/docs/api/qiskit/dev/qiskit.circuit.library.ZZFeatureMap.mdx @@ -106,620 +106,6 @@ python_api_name: qiskit.circuit.library.ZZFeatureMap ## Attributes - ### alpha - - - The Pauli rotation factor (alpha). - - **Returns** - - The Pauli rotation factor. - - - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Returns** - - a list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction")s for each instruction. - - **Return type** - - QuantumCircuitData - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.circuit.library.ZZFeatureMap.unit "qiskit.circuit.library.ZZFeatureMap.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### entanglement - - - Get the entanglement strategy. - - **Returns** - - The entanglement strategy, see `get_entangler_map()` for more detail on how the format is interpreted. - - - ### entanglement\_blocks - - - The blocks in the entanglement layers. - - **Returns** - - The blocks in the entanglement layers. - - - ### feature\_dimension - - - Returns the feature dimension (which is equal to the number of qubits). - - **Returns** - - The feature dimension of this feature map. - - - ### flatten - - - Returns whether the circuit is wrapped in nested gates/instructions or flattened. - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### initial\_state - - - Return the initial state that is added in front of the n-local circuit. - - **Returns** - - The initial state. - - - ### insert\_barriers - - - If barriers are inserted in between the layers or not. - - **Returns** - - `True`, if barriers are inserted in between the layers, `False` if not. - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ZZFeatureMap.num_input_vars "qiskit.circuit.library.ZZFeatureMap.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.circuit.library.ZZFeatureMap.num_input_vars "qiskit.circuit.library.ZZFeatureMap.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.circuit.library.ZZFeatureMap.num_vars "qiskit.circuit.library.ZZFeatureMap.num_vars") + [`num_stretches()`](#qiskit.circuit.library.ZZFeatureMap.num_stretches "qiskit.circuit.library.ZZFeatureMap.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.circuit.library.ZZFeatureMap.num_captured_vars "qiskit.circuit.library.ZZFeatureMap.num_captured_vars") must be zero. - - - ### num\_layers - - - Return the number of layers in the n-local circuit. - - **Returns** - - The number of layers in the circuit. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_parameters\_settable - - - The number of distinct parameters. - - - ### num\_qubits - - - Returns the number of qubits in this circuit. - - **Returns** - - The number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### ordered\_parameters - - - The parameters used in the underlying circuit. - - This includes float values and duplicates. - - **Examples** - - ```python - >>> # prepare circuit ... - >>> print(nlocal) - ┌───────┐┌──────────┐┌──────────┐┌──────────┐ - q_0: ┤ Ry(1) ├┤ Ry(θ[1]) ├┤ Ry(θ[1]) ├┤ Ry(θ[3]) ├ - └───────┘└──────────┘└──────────┘└──────────┘ - >>> nlocal.parameters - {Parameter(θ[1]), Parameter(θ[3])} - >>> nlocal.ordered_parameters - [1, Parameter(θ[1]), Parameter(θ[1]), Parameter(θ[3])] - ``` - - **Returns** - - The parameters objects used in the circuit. - - - ### parameter\_bounds - - - The parameter bounds for the unbound parameters in the circuit. - - **Returns** - - A list of pairs indicating the bounds, as (lower, upper). None indicates an unbounded parameter in the corresponding direction. If `None` is returned, problem is fully unbounded. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### paulis - - - The Pauli strings used in the entanglement of the qubits. - - **Returns** - - The Pauli strings as list. - - - ### preferred\_init\_points - - - The initial points for the parameters. Can be stored as initial guess in optimization. - - **Returns** - - The initial values for the parameters, or None, if none have been set. - - - ### prefix - - - - ### qregs - - - A list of the quantum registers associated with the circuit. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### reps - - - The number of times rotation and entanglement block are repeated. - - **Returns** - - The number of repetitions. - - - ### rotation\_blocks - - - The blocks in the rotation layers. - - **Returns** - - The blocks in the rotation layers. - - - ### unit - - - The unit that [`duration`](#qiskit.circuit.library.ZZFeatureMap.duration "qiskit.circuit.library.ZZFeatureMap.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.passmanager.BasePassManager.mdx b/docs/api/qiskit/dev/qiskit.passmanager.BasePassManager.mdx index cf1a04e4a73..4de26e62585 100644 --- a/docs/api/qiskit/dev/qiskit.passmanager.BasePassManager.mdx +++ b/docs/api/qiskit/dev/qiskit.passmanager.BasePassManager.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.passmanager.BasePassManager # BasePassManager - + Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC "(in Python v3.13)") Pass manager base class. @@ -80,7 +80,7 @@ python_api_name: qiskit.passmanager.BasePassManager ### run - + Run all the passes on the specified `in_programs`. **Parameters** @@ -130,7 +130,7 @@ python_api_name: qiskit.passmanager.BasePassManager ### to\_flow\_controller - + Linearize this manager into a single [`FlowControllerLinear`](qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear"), so that it can be nested inside another pass manager. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.ApproximateCircuit.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.ApproximateCircuit.mdx index b1371e8de29..e339a3c7520 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.ApproximateCircuit.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.ApproximateCircuit.mdx @@ -20,460 +20,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.ApproximateCircuit ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.unit "qiskit.synthesis.unitary.aqc.ApproximateCircuit.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_input_vars "qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_input_vars "qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_vars "qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_vars") + [`num_stretches()`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_stretches "qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_captured_vars "qiskit.synthesis.unitary.aqc.ApproximateCircuit.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### thetas @@ -484,16 +30,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.ApproximateCircuit a vector of parameters of this circuit. - ### unit - - - The unit that [`duration`](#qiskit.synthesis.unitary.aqc.ApproximateCircuit.duration "qiskit.synthesis.unitary.aqc.ApproximateCircuit.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.mdx index 6eb31007d0e..14e685a369b 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.mdx @@ -26,460 +26,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.CNOTUnitCircuit ## Attributes - ### ancillas - - - A list of `AncillaQubit`s in the order that they were added. You should not mutate this. - - - ### clbits - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - **Example** - - ```python - from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit - - qr1 = QuantumRegister(2) - qr2 = QuantumRegister(1) - cr1 = ClassicalRegister(2) - cr2 = ClassicalRegister(1) - qc = QuantumCircuit(qr1, qr2, cr1, cr2) - - print("List the qubits in this circuit:", qc.qubits) - print("List the classical bits in this circuit:", qc.clbits) - ``` - - ```text - List the qubits in this circuit: [Qubit(QuantumRegister(2, 'q0'), 0), - Qubit(QuantumRegister(2, 'q0'), 1), Qubit(QuantumRegister(1, 'q1'), 0)] - List the classical bits in this circuit: [Clbit(ClassicalRegister(2, 'c0'), 0), - Clbit(ClassicalRegister(2, 'c0'), 1), Clbit(ClassicalRegister(1, 'c1'), 0)] - ``` - - - ### cregs - - - A list of `Clbit`s in the order that they were added. You should not mutate this. - - - ### data - - - The circuit data (instructions and context). - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2) - qc.measure([0], [1]) - print(qc.data) - ``` - - ```text - [CircuitInstruction(operation=Instruction(name='measure', num_qubits=1, - num_clbits=1, params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), - clbits=(Clbit(ClassicalRegister(2, 'c'), 1),))] - ``` - - **Returns** - - A list-like object containing the [`CircuitInstruction`](qiskit.circuit.CircuitInstruction "qiskit.circuit.CircuitInstruction") instances in the circuit. - - - ### duration - - - The total duration of the circuit, set by a scheduling transpiler pass. Its unit is specified by [`unit`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.unit "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.unit"). - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.duration` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - - ### global\_phase - - - The global phase of the current circuit scope in radians. - - **Example** - - ```python - from qiskit import QuantumCircuit - - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - print(circuit.global_phase) - ``` - - ```text - 0.0 - ``` - - ```python - from numpy import pi - - circuit.global_phase = pi/4 - print(circuit.global_phase) - ``` - - ```text - 0.7853981633974483 - ``` - - - ### instances - - - - ### layout - - - Return any associated layout information about the circuit. - - This attribute contains an optional [`TranspileLayout`](qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") object. This is typically set on the output from [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`PassManager.run()`](qiskit.transpiler.PassManager#run "qiskit.transpiler.PassManager.run") to retain information about the permutations caused on the input circuit by transpilation. - - There are two types of permutations caused by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function: an initial layout that permutes the qubits based on the selected physical qubits on the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), and a final layout, which is an output permutation caused by [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")s inserted during routing. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - # Create circuit to test transpiler on - qc = QuantumCircuit(3, 3) - qc.h(0) - qc.cx(0, 1) - qc.swap(1, 2) - qc.cx(0, 1) - - # Add measurements to the circuit - qc.measure([0, 1, 2], [0, 1, 2]) - - # Specify the QPU to target - backend = GenericBackendV2(3) - - # Transpile the circuit - pass_manager = generate_preset_pass_manager( - optimization_level=1, backend=backend - ) - transpiled = pass_manager.run(qc) - - # Print the layout after transpilation - print(transpiled.layout.routing_permutation()) - ``` - - ```text - [0, 1, 2] - ``` - - - ### metadata - - - Arbitrary user-defined dictionary of metadata for the circuit. - - Qiskit will not examine the content of this mapping, but it will pass it through the transpiler and reattach it to the output, so you can track your own metadata. - - **Example** - - ```python - from qiskit import QuantumCircuit - - qc = QuantumCircuit(2, 2, metadata={'experiment_type': 'Bell state experiment'}) - - print(qc.metadata) - ``` - - ```text - {'experiment_type': 'Bell state experiment'} - ``` - - - ### num\_ancillas - - - Return the number of ancilla qubits. - - **Example** - - ```python - from qiskit import QuantumCircuit, QuantumRegister, AncillaRegister - - # Create a 2-qubit quantum circuit - reg = QuantumRegister(2) - qc = QuantumCircuit(reg) - - # Create an ancilla register with 1 qubit - anc = AncillaRegister(1) - qc.add_register(anc) # Add the ancilla register to the circuit - - print("Number of ancilla qubits:", qc.num_ancillas) - ``` - - ```text - Number of ancilla qubits: 1 - ``` - - - ### num\_captured\_stretches - - - The number of stretches in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_stretches()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_input_vars "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_input_vars") must be zero. - - - ### num\_captured\_vars - - - The number of real-time classical variables in the circuit marked as captured from an enclosing scope. - - This is the length of the `iter_captured_vars()` iterable. If this is non-zero, [`num_input_vars`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_input_vars "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_input_vars") must be zero. - - - ### num\_clbits - - - Return number of classical bits. - - **Example** - - ```python - from qiskit import QuantumCircuit - - # Create a new circuit with two qubits and one classical bit - qc = QuantumCircuit(2, 1) - print("Number of classical bits:", qc.num_clbits) - ``` - - ```text - Number of classical bits: 1 - ``` - - - ### num\_declared\_stretches - - - The number of stretches in the circuit that are declared by this circuit scope, excluding captures. - - This is the length of the `iter_declared_stretches()` iterable. - - - ### num\_declared\_vars - - - The number of real-time classical variables in the circuit that are declared by this circuit scope, excluding inputs or captures. - - This is the length of the `iter_declared_vars()` iterable. - - - ### num\_identifiers - - - The number of real-time classical variables and stretches in the circuit. - - This is equal to [`num_vars()`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_vars "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_vars") + [`num_stretches()`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_stretches "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_stretches"). - - - ### num\_input\_vars - - - The number of real-time classical variables in the circuit marked as circuit inputs. - - This is the length of the `iter_input_vars()` iterable. If this is non-zero, [`num_captured_vars`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_captured_vars "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.num_captured_vars") must be zero. - - - ### num\_parameters - - - The number of parameter objects in the circuit. - - - ### num\_qubits - - - Return number of qubits. - - - ### num\_stretches - - - The number of stretches in the circuit. - - This is the length of the `iter_stretches()` iterable. - - - ### num\_vars - - - The number of real-time classical variables in the circuit. - - This is the length of the `iter_vars()` iterable. - - - ### op\_start\_times - - - Return a list of operation start times. - - - This attribute computes the estimate starting time of the operations in the scheduled circuit and only works for simple circuits that have no control flow or other classical feed-forward operations. - - - This attribute is enabled once one of scheduling analysis passes runs on the quantum circuit. - - **Example** - - ```python - from qiskit import QuantumCircuit - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.transpiler import generate_preset_pass_manager - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - qc.measure_all() - - # Print the original circuit - print("Original circuit:") - print(qc) - - # Transpile the circuit with a specific basis gates list and print the resulting circuit - backend = GenericBackendV2(2, basis_gates=['u1', 'u2', 'u3', 'cx']) - pm = generate_preset_pass_manager( - optimization_level=1, backend=backend, scheduling_method="alap" - ) - transpiled_qc = pm.run(qc) - print("Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']:") - print(transpiled_qc) - - # Print the start times of each instruction in the transpiled circuit - print("Start times of instructions in the transpiled circuit:") - for instruction, start_time in zip(transpiled_qc.data, transpiled_qc.op_start_times): - print(f"{instruction.operation.name}: {start_time}") - ``` - - ```text - Original circuit: - ┌───┐ ░ ┌─┐ - q_0: ┤ H ├──■───░─┤M├─── - └───┘┌─┴─┐ ░ └╥┘┌─┐ - q_1: ─────┤ X ├─░──╫─┤M├ - └───┘ ░ ║ └╥┘ - meas: 2/══════════════╩══╩═ - 0 1 - - Transpiled circuit with basis gates ['u1', 'u2', 'u3', 'cx']: - ┌─────────┐ ░ ┌─────────────────┐┌─┐ - q_0 -> 0 ───┤ U2(0,π) ├──────■───░─┤ Delay(1255[dt]) ├┤M├ - ┌──┴─────────┴───┐┌─┴─┐ ░ └───────┬─┬───────┘└╥┘ - q_1 -> 1 ┤ Delay(196[dt]) ├┤ X ├─░─────────┤M├─────────╫─ - └────────────────┘└───┘ ░ └╥┘ ║ - meas: 2/═══════════════════════════════════╩══════════╩═ - 1 0 - - Start times of instructions in the transpiled circuit: - u2: 0 - delay: 0 - cx: 196 - barrier: 2098 - delay: 2098 - measure: 3353 - measure: 2098 - ``` - - **Returns** - - List of integers representing instruction estimated start times. The index corresponds to the index of instruction in `QuantumCircuit.data`. - - **Raises** - - [**AttributeError**](https://docs.python.org/3/library/exceptions.html#AttributeError "(in Python v3.13)") – When circuit is not scheduled. - - - ### parameters - - - The parameters defined in the circuit. - - This attribute returns the [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit sorted alphabetically. Note that parameters instantiated with a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") are still sorted numerically. - - **Examples** - - The snippet below shows that insertion order of parameters does not matter. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> a, b, elephant = Parameter("a"), Parameter("b"), Parameter("elephant") - >>> circuit = QuantumCircuit(1) - >>> circuit.rx(b, 0) - >>> circuit.rz(elephant, 0) - >>> circuit.ry(a, 0) - >>> circuit.parameters # sorted alphabetically! - ParameterView([Parameter(a), Parameter(b), Parameter(elephant)]) - ``` - - Bear in mind that alphabetical sorting might be unintuitive when it comes to numbers. The literal “10” comes before “2” in strict alphabetical sorting. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter - >>> angles = [Parameter("angle_1"), Parameter("angle_2"), Parameter("angle_10")] - >>> circuit = QuantumCircuit(1) - >>> circuit.u(*angles, 0) - >>> circuit.draw() - ┌─────────────────────────────┐ - q: ┤ U(angle_1,angle_2,angle_10) ├ - └─────────────────────────────┘ - >>> circuit.parameters - ParameterView([Parameter(angle_1), Parameter(angle_10), Parameter(angle_2)]) - ``` - - To respect numerical sorting, a [`ParameterVector`](qiskit.circuit.ParameterVector "qiskit.circuit.ParameterVector") can be used. - - ```python - >>> from qiskit.circuit import QuantumCircuit, Parameter, ParameterVector - >>> x = ParameterVector("x", 12) - >>> circuit = QuantumCircuit(1) - >>> for x_i in x: - ... circuit.rx(x_i, 0) - >>> circuit.parameters - ParameterView([ - ParameterVectorElement(x[0]), ParameterVectorElement(x[1]), - ParameterVectorElement(x[2]), ParameterVectorElement(x[3]), - ..., ParameterVectorElement(x[11]) - ]) - ``` - - **Returns** - - The sorted [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects in the circuit. - - - ### prefix - - - - ### qregs - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - - ### qubits - - - A list of `Qubit`s in the order that they were added. You should not mutate this. - - ### thetas @@ -490,16 +36,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.CNOTUnitCircuit Parameters of the rotation gates in this circuit. - ### unit - - - The unit that [`duration`](#qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.duration "qiskit.synthesis.unitary.aqc.CNOTUnitCircuit.duration") is specified in. - - - The property `qiskit.circuit.quantumcircuit.QuantumCircuit.unit` is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0. - - - ### name diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitObjective.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitObjective.mdx index 58b8a981005..b2ef03dfe58 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitObjective.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.CNOTUnitObjective.mdx @@ -31,11 +31,5 @@ python_api_name: qiskit.synthesis.unitary.aqc.CNOTUnitObjective Returns: Number of parameters (angles) of rotation gates in this circuit. - - ### target\_matrix - - - Returns: a matrix being approximated - diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective.mdx index 6a350ab41c2..99f96bf43e5 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective.mdx @@ -18,26 +18,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective * **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – number of qubits. * **cnots** (*np.ndarray*) – a CNOT structure to be used in the optimization procedure. - ## Attributes - - ### num\_cnots - - - Returns: A number of CNOT units to be used by the approximate circuit. - - - ### num\_thetas - - - Returns: Number of parameters (angles) of rotation gates in this circuit. - - - ### target\_matrix - - - Returns: a matrix being approximated - - ## Methods ### gradient diff --git a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective.mdx b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective.mdx index 61d4db11231..6f30f37f5df 100644 --- a/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective.mdx +++ b/docs/api/qiskit/dev/qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective.mdx @@ -18,26 +18,6 @@ python_api_name: qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective * **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – number of qubits. * **cnots** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.3)")) – a CNOT structure to be used in the optimization procedure. - ## Attributes - - ### num\_cnots - - - Returns: A number of CNOT units to be used by the approximate circuit. - - - ### num\_thetas - - - Returns: Number of parameters (angles) of rotation gates in this circuit. - - - ### target\_matrix - - - Returns: a matrix being approximated - - ## Methods ### gradient diff --git a/docs/api/qiskit/dev/qiskit.transpiler.PassManager.mdx b/docs/api/qiskit/dev/qiskit.transpiler.PassManager.mdx index 8ebe298ee86..a5594abc63b 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.PassManager.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.PassManager.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.PassManager # PassManager - + Bases: [`BasePassManager`](qiskit.passmanager.BasePassManager "qiskit.passmanager.passmanager.BasePassManager") Manager for a set of Passes and their scheduling during transpilation. @@ -24,7 +24,7 @@ python_api_name: qiskit.transpiler.PassManager ### append - + Append a Pass Set to the schedule of passes. **Parameters** @@ -42,7 +42,7 @@ python_api_name: qiskit.transpiler.PassManager ### draw - + Draw the pass manager. This function needs [pydot](https://github.com/erocarrera/pydot), which in turn needs [Graphviz](https://www.graphviz.org/) to be installed. @@ -86,7 +86,7 @@ python_api_name: qiskit.transpiler.PassManager ### replace - + Replace a particular pass in the scheduler. **Parameters** @@ -101,7 +101,7 @@ python_api_name: qiskit.transpiler.PassManager ### run - + Run all the passes on the specified `circuits`. **Parameters** @@ -140,6 +140,10 @@ python_api_name: qiskit.transpiler.PassManager ... ``` + + When running transpilation with multi-processing, the callback function is invoked within the context of each sub-process, independently of the parent process. + + * **num\_processes** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The maximum number of parallel processes to launch if parallel execution is enabled. This argument overrides `num_processes` in the user configuration file, and the `QISKIT_NUM_PROCS` environment variable. If set to `None` the system default or local user configuration will be used. * **property\_set** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*object*](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)")*] | None*) – If given, the initial value to use as the [`PropertySet`](qiskit.passmanager.PropertySet "qiskit.passmanager.PropertySet") for the pass manager pipeline. This can be used to persist analysis from one run to another, in cases where you know the analysis is safe to share. Beware that some analysis will be specific to the input circuit and the particular [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), so you should take a lot of care when using this argument. @@ -155,7 +159,7 @@ python_api_name: qiskit.transpiler.PassManager ### to\_flow\_controller - + Linearize this manager into a single [`FlowControllerLinear`](qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear"), so that it can be nested inside another pass manager. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.StagedPassManager.mdx b/docs/api/qiskit/dev/qiskit.transpiler.StagedPassManager.mdx index 54f48045e44..02adaa098c5 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.StagedPassManager.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.StagedPassManager.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.StagedPassManager # StagedPassManager - + Bases: [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.passmanager.PassManager") A pass manager pipeline built from individual stages. @@ -64,7 +64,7 @@ python_api_name: qiskit.transpiler.StagedPassManager ### append - + Append a Pass Set to the schedule of passes. **Parameters** @@ -82,13 +82,13 @@ python_api_name: qiskit.transpiler.StagedPassManager ### draw - + Draw the staged pass manager. ### remove - + Removes a particular pass in the scheduler. **Parameters** @@ -106,7 +106,7 @@ python_api_name: qiskit.transpiler.StagedPassManager ### replace - + Replace a particular pass in the scheduler. **Parameters** @@ -121,7 +121,7 @@ python_api_name: qiskit.transpiler.StagedPassManager ### run - + Run all the passes on the specified `circuits`. **Parameters** @@ -160,6 +160,10 @@ python_api_name: qiskit.transpiler.StagedPassManager ... ``` + + When running transpilation with multi-processing, the callback function is invoked within the context of each sub-process, independently of the parent process. + + * **num\_processes** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The maximum number of parallel processes to launch if parallel execution is enabled. This argument overrides `num_processes` in the user configuration file, and the `QISKIT_NUM_PROCS` environment variable. If set to `None` the system default or local user configuration will be used. * **property\_set** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*object*](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)")*] | None*) – If given, the initial value to use as the [`PropertySet`](qiskit.passmanager.PropertySet "qiskit.passmanager.PropertySet") for the pass manager pipeline. This can be used to persist analysis from one run to another, in cases where you know the analysis is safe to share. Beware that some analysis will be specific to the input circuit and the particular [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target"), so you should take a lot of care when using this argument. @@ -175,7 +179,7 @@ python_api_name: qiskit.transpiler.StagedPassManager ### to\_flow\_controller - + Linearize this manager into a single [`FlowControllerLinear`](qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear"), so that it can be nested inside another pass manager. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.generate_preset_pass_manager.mdx b/docs/api/qiskit/dev/qiskit.transpiler.generate_preset_pass_manager.mdx index 599c7e337da..c95653ca03a 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.generate_preset_pass_manager.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.generate_preset_pass_manager.mdx @@ -10,7 +10,7 @@ python_api_name: qiskit.transpiler.generate_preset_pass_manager # qiskit.transpiler.generate\_preset\_pass\_manager - + Generate a preset [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") This function is used to quickly generate a preset pass manager. Preset pass managers are the default pass managers used by the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function. This function provides a convenient and simple method to construct a standalone [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") object that mirrors what the [`transpile()`](compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function internally builds and uses. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.ALAPScheduleAnalysis.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.ALAPScheduleAnalysis.mdx index c7e33d6668a..897239b2c04 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.ALAPScheduleAnalysis.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.ALAPScheduleAnalysis.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.ALAPScheduleAnalysis # ALAPScheduleAnalysis - + Bases: `BaseScheduler` ALAP Scheduling pass, which schedules the **stop** time of instructions as late as possible. @@ -78,7 +78,7 @@ python_api_name: qiskit.transpiler.passes.ALAPScheduleAnalysis ### run - + Run the ALAPSchedule pass on dag. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.Error.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.Error.mdx new file mode 100644 index 00000000000..41de6a30009 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.Error.mdx @@ -0,0 +1,102 @@ +--- +title: Error (dev version) +description: API reference for qiskit.transpiler.passes.Error in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.Error +--- + +# Error + + + Bases: [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.basepasses.AnalysisPass") + + Error pass to be called when an error happens. + + Error pass. + + **Parameters** + + * **msg** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") *| Callable\[\[*[*PropertySet*](qiskit.passmanager.PropertySet "qiskit.passmanager.PropertySet")*],* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – Error message, if not provided a generic error will be used. This can be either a raw string, or a callback function that accepts the current `property_set` and returns the desired message. + * **action** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – the action to perform. Default: ‘raise’. The options are: \* `'raise'`: Raises a `TranspilerError` exception with msg \* `'warn'`: Raises a non-fatal warning with msg \* `'log'`: logs in `logging.getLogger(__name__)` + + **Raises** + + [**TranspilerError**](transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") – if action is not valid. + + ## Attributes + + ### is\_analysis\_pass + + + Check if the pass is an analysis pass. + + If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass. + + + ### is\_transformation\_pass + + + Check if the pass is a transformation pass. + + If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read). + + + ## Methods + + ### execute + + + Execute optimization task for input Qiskit IR. + + **Parameters** + + * **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize. + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – State associated with workflow execution by the pass manager itself. + * **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)") *| None*) – A callback function which is caller per execution of optimization task. + + **Returns** + + Optimized Qiskit IR and state of the workflow. + + **Return type** + + [tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [qiskit.passmanager.compilation\_status.PassManagerState](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")] + + + ### name + + + Name of the pass. + + **Return type** + + [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") + + + ### run + + + Run the Error pass on dag. + + + ### update\_status + + + Update workflow status. + + **Parameters** + + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update. + * **run\_state** (*RunState*) – Completion status of current task. + + **Returns** + + Updated pass manager state. + + **Return type** + + [*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.InstructionDurationCheck.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.InstructionDurationCheck.mdx index 90a9ea95e64..cfe22cbc2e1 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.InstructionDurationCheck.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.InstructionDurationCheck.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.InstructionDurationCheck # InstructionDurationCheck - + Bases: [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.basepasses.AnalysisPass") Duration validation pass for reschedule. @@ -79,7 +79,7 @@ python_api_name: qiskit.transpiler.passes.InstructionDurationCheck ### run - + Run duration validation passes. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.InverseCancellation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.InverseCancellation.mdx index 220e4d18cb7..6af18d3de37 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.InverseCancellation.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.InverseCancellation.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.InverseCancellation # InverseCancellation - + Bases: [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass") Cancel specific Gates which are inverses of each other when they occur back-to- back. @@ -17,7 +17,34 @@ python_api_name: qiskit.transpiler.passes.InverseCancellation **Parameters** - **gates\_to\_cancel** – List describing the gates to cancel. Each element of the list is either a single gate or a pair of gates. If a single gate, then it should be self-inverse. If a pair of gates, then the gates in the pair should be inverses of each other. + * **gates\_to\_cancel** – + + List describing the gates to cancel. Each element of the list is either a single gate or a pair of gates. If a single gate, then it should be self-inverse. If a pair of gates, then the gates in the pair should be inverses of each other. If `None` a default list of self-inverse gates and a default list of inverse gate pairs will be used. The current default list of self-inverse gates is: + + > * [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") + > * [`ECRGate`](qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate") + > * [`CYGate`](qiskit.circuit.library.CYGate "qiskit.circuit.library.CYGate") + > * [`CZGate`](qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate") + > * [`XGate`](qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") + > * [`YGate`](qiskit.circuit.library.YGate "qiskit.circuit.library.YGate") + > * [`ZGate`](qiskit.circuit.library.ZGate "qiskit.circuit.library.ZGate") + > * [`HGate`](qiskit.circuit.library.HGate "qiskit.circuit.library.HGate") + > * [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate") + > * [`CHGate`](qiskit.circuit.library.CHGate "qiskit.circuit.library.CHGate") + > * [`CCXGate`](qiskit.circuit.library.CCXGate "qiskit.circuit.library.CCXGate") + > * [`CCZGate`](qiskit.circuit.library.CCZGate "qiskit.circuit.library.CCZGate") + > * [`RCCXGate`](qiskit.circuit.library.RCCXGate "qiskit.circuit.library.RCCXGate") + > * [`CSwapGate`](qiskit.circuit.library.CSwapGate "qiskit.circuit.library.CSwapGate") + > * [`C3XGate`](qiskit.circuit.library.C3XGate "qiskit.circuit.library.C3XGate") + + and the default list of inverse gate pairs is: + + > * [`TGate`](qiskit.circuit.library.TGate "qiskit.circuit.library.TGate") and [`TdgGate`](qiskit.circuit.library.TdgGate "qiskit.circuit.library.TdgGate") + > * [`SGate`](qiskit.circuit.library.SGate "qiskit.circuit.library.SGate") and [`SdgGate`](qiskit.circuit.library.SdgGate "qiskit.circuit.library.SdgGate") + > * [`SXGate`](qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") and [`SXdgGate`](qiskit.circuit.library.SXdgGate "qiskit.circuit.library.SXdgGate") + > * [`CSGate`](qiskit.circuit.library.CSGate "qiskit.circuit.library.CSGate") and [`CSdgGate`](qiskit.circuit.library.CSdgGate "qiskit.circuit.library.CSdgGate") + + * **run\_default** – If set to true and `gates_to_cancel` is set to a list then in addition to the gates listed in `gates_to_cancel` the default list of gate inverses (the same as when `gates_to_cancel` is set to `None`) will be run. The order of evaluation is significant in how sequences of gates are cancelled and the default gates will be evaluated after the provided gates in `gates_to_cancel`. If `gates_to_cancel` is `None` this option has no impact. **Raises** @@ -75,7 +102,7 @@ python_api_name: qiskit.transpiler.passes.InverseCancellation ### run - + Run the InverseCancellation pass on dag. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.LayoutTransformation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.LayoutTransformation.mdx new file mode 100644 index 00000000000..f3086d195ec --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.LayoutTransformation.mdx @@ -0,0 +1,119 @@ +--- +title: LayoutTransformation (dev version) +description: API reference for qiskit.transpiler.passes.LayoutTransformation in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.LayoutTransformation +--- + +# LayoutTransformation + + + Bases: [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass") + + Adds a Swap circuit for a given (partial) permutation to the circuit. + + This circuit is found by a 4-approximation algorithm for Token Swapping. More details are available in the routing code. + + LayoutTransformation initializer. + + **Parameters** + + * **coupling\_map** – Directed graph representing a coupling map. + * **from\_layout** (*Union\[*[*Layout*](qiskit.transpiler.Layout "qiskit.transpiler.Layout")*,* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – The starting layout of qubits onto physical qubits. If the type is str, look up property\_set when this pass runs. + * **to\_layout** (*Union\[*[*Layout*](qiskit.transpiler.Layout "qiskit.transpiler.Layout")*,* [*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*]*) – The final layout of qubits on physical qubits. If the type is str, look up `property_set` when this pass runs. + * **seed** (*Union\[*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*, np.random.default\_rng]*) – Seed to use for random trials. + * **trials** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – How many randomized trials to perform, taking the best circuit as output. + + ## Attributes + + ### is\_analysis\_pass + + + Check if the pass is an analysis pass. + + If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass. + + + ### is\_transformation\_pass + + + Check if the pass is a transformation pass. + + If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read). + + + ## Methods + + ### execute + + + Execute optimization task for input Qiskit IR. + + **Parameters** + + * **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize. + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – State associated with workflow execution by the pass manager itself. + * **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)") *| None*) – A callback function which is caller per execution of optimization task. + + **Returns** + + Optimized Qiskit IR and state of the workflow. + + **Return type** + + [tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [qiskit.passmanager.compilation\_status.PassManagerState](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")] + + + ### name + + + Name of the pass. + + **Return type** + + [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") + + + ### run + + + Apply the specified partial permutation to the circuit. + + **Parameters** + + **dag** ([*DAGCircuit*](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit")) – DAG to transform the layout of. + + **Returns** + + The DAG with transformed layout. + + **Return type** + + [DAGCircuit](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") + + **Raises** + + [**TranspilerError**](transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") – if the coupling map or the layout are not compatible with the DAG. Or if either of string from/to\_layout is not found in property\_set. + + + ### update\_status + + + Update workflow status. + + **Parameters** + + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update. + * **run\_state** (*RunState*) – Completion status of current task. + + **Returns** + + Updated pass manager state. + + **Return type** + + [*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeCliffordT.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeCliffordT.mdx new file mode 100644 index 00000000000..87cb5d25601 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeCliffordT.mdx @@ -0,0 +1,105 @@ +--- +title: OptimizeCliffordT (dev version) +description: API reference for qiskit.transpiler.passes.OptimizeCliffordT in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.OptimizeCliffordT +--- + +# OptimizeCliffordT + + + Bases: [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass") + + An optimization pass for Clifford+T circuits. + + Currently all the pass does is merging pairs of consecutive T-gates into S-gates, and pair of consecutive Tdg-gates into Sdg-gates. + + ## Attributes + + ### is\_analysis\_pass + + + Check if the pass is an analysis pass. + + If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass. + + + ### is\_transformation\_pass + + + Check if the pass is a transformation pass. + + If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read). + + + ## Methods + + ### execute + + + Execute optimization task for input Qiskit IR. + + **Parameters** + + * **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize. + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – State associated with workflow execution by the pass manager itself. + * **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)") *| None*) – A callback function which is caller per execution of optimization task. + + **Returns** + + Optimized Qiskit IR and state of the workflow. + + **Return type** + + [tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [qiskit.passmanager.compilation\_status.PassManagerState](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")] + + + ### name + + + Name of the pass. + + **Return type** + + [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") + + + ### run + + + Run the OptimizeCliffordT pass on dag. + + **Parameters** + + **dag** ([*DAGCircuit*](qiskit.dagcircuit.DAGCircuit "qiskit._accelerate.circuit.DAGCircuit")) – The directed acyclic graph to run on. + + **Returns** + + Transformed DAG. + + **Return type** + + [DAGCircuit](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") + + + ### update\_status + + + Update workflow status. + + **Parameters** + + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update. + * **run\_state** (*RunState*) – Completion status of current task. + + **Returns** + + Updated pass manager state. + + **Return type** + + [*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeSwapBeforeMeasure.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeSwapBeforeMeasure.mdx new file mode 100644 index 00000000000..9ec59a75332 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.OptimizeSwapBeforeMeasure.mdx @@ -0,0 +1,105 @@ +--- +title: OptimizeSwapBeforeMeasure (dev version) +description: API reference for qiskit.transpiler.passes.OptimizeSwapBeforeMeasure in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.OptimizeSwapBeforeMeasure +--- + +# OptimizeSwapBeforeMeasure + + + Bases: [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.basepasses.TransformationPass") + + Remove the swaps followed by measurement (and adapt the measurement). + + Transpiler pass to remove swaps in front of measurements by re-targeting the classical bit of the measure instruction. + + ## Attributes + + ### is\_analysis\_pass + + + Check if the pass is an analysis pass. + + If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass. + + + ### is\_transformation\_pass + + + Check if the pass is a transformation pass. + + If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read). + + + ## Methods + + ### execute + + + Execute optimization task for input Qiskit IR. + + **Parameters** + + * **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize. + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – State associated with workflow execution by the pass manager itself. + * **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)") *| None*) – A callback function which is caller per execution of optimization task. + + **Returns** + + Optimized Qiskit IR and state of the workflow. + + **Return type** + + [tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [qiskit.passmanager.compilation\_status.PassManagerState](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")] + + + ### name + + + Name of the pass. + + **Return type** + + [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") + + + ### run + + + Run the OptimizeSwapBeforeMeasure pass on dag. + + **Parameters** + + **dag** ([*DAGCircuit*](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit")) – the DAG to be optimized. + + **Returns** + + the optimized DAG. + + **Return type** + + [DAGCircuit](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") + + + ### update\_status + + + Update workflow status. + + **Parameters** + + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update. + * **run\_state** (*RunState*) – Completion status of current task. + + **Returns** + + Updated pass manager state. + + **Return type** + + [*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDelay.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDelay.mdx index f34e2e2bdb8..c59a364af58 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDelay.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDelay.mdx @@ -90,7 +90,7 @@ python_api_name: qiskit.transpiler.passes.PadDelay ### get\_duration - + Get duration of a given node in the circuit. @@ -106,7 +106,7 @@ python_api_name: qiskit.transpiler.passes.PadDelay ### run - + Run the padding pass on `dag`. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDynamicalDecoupling.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDynamicalDecoupling.mdx index cc858d98520..c9c5b2bca21 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDynamicalDecoupling.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.PadDynamicalDecoupling.mdx @@ -154,7 +154,7 @@ python_api_name: qiskit.transpiler.passes.PadDynamicalDecoupling ### get\_duration - + Get duration of a given node in the circuit. @@ -170,7 +170,7 @@ python_api_name: qiskit.transpiler.passes.PadDynamicalDecoupling ### run - + Run the padding pass on `dag`. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.ResourceEstimation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.ResourceEstimation.mdx new file mode 100644 index 00000000000..9912b334007 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.ResourceEstimation.mdx @@ -0,0 +1,93 @@ +--- +title: ResourceEstimation (dev version) +description: API reference for qiskit.transpiler.passes.ResourceEstimation in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.ResourceEstimation +--- + +# ResourceEstimation + + + Bases: [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.basepasses.AnalysisPass") + + Automatically require analysis passes for resource estimation. + + An analysis pass for automatically running: \* Depth() \* Width() \* Size() \* CountOps() \* NumTensorFactors() + + ## Attributes + + ### is\_analysis\_pass + + + Check if the pass is an analysis pass. + + If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass. + + + ### is\_transformation\_pass + + + Check if the pass is a transformation pass. + + If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read). + + + ## Methods + + ### execute + + + Execute optimization task for input Qiskit IR. + + **Parameters** + + * **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)")) – Qiskit IR to optimize. + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – State associated with workflow execution by the pass manager itself. + * **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable "(in Python v3.13)") *| None*) – A callback function which is caller per execution of optimization task. + + **Returns** + + Optimized Qiskit IR and state of the workflow. + + **Return type** + + [tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.13)"), [qiskit.passmanager.compilation\_status.PassManagerState](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")] + + + ### name + + + Name of the pass. + + **Return type** + + [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)") + + + ### run + + + Run the ResourceEstimation pass on dag. + + + ### update\_status + + + Update workflow status. + + **Parameters** + + * **state** ([*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState")) – Pass manager state to update. + * **run\_state** (*RunState*) – Completion status of current task. + + **Returns** + + Updated pass manager state. + + **Return type** + + [*PassManagerState*](qiskit.passmanager.PassManagerState "qiskit.passmanager.compilation_status.PassManagerState") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPermutation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPermutation.mdx index 329f489ee19..bd2aa8e8936 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPermutation.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPermutation.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPerm # ACGSynthesisPermutation - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The permutation synthesis plugin based on the Alon, Chung, Graham method. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ACGSynthesisPerm ### run - + Run synthesis for the given Permutation. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisClifford.mdx index 9696ddb2ce6..72d79b89de8 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisCliff # AGSynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Clifford synthesis plugin based on the Aaronson-Gottesman method. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.AGSynthesisCliff ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisClifford.mdx index 07c754d04a1..561dd2e683c 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisCliff # BMSynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Clifford synthesis plugin based on the Bravyi-Maslov method. @@ -21,7 +21,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.BMSynthesisCliff ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPermutation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPermutation.mdx index cdc939aa27e..5a961e10a74 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPermutation.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPermutation.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPe # BasicSynthesisPermutation - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The permutation synthesis plugin based on sorting. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.BasicSynthesisPe ### run - + Run synthesis for the given Permutation. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisClifford.mdx index cfdab0b5d9c..1f546890ac3 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesis # DefaultSynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default clifford synthesis plugin. @@ -21,7 +21,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesis ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisLinearFunction.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisLinearFunction.mdx index 2b38004ded1..2a1cf545799 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisLinearFunction.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesisLinearFunction.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesis # DefaultSynthesisLinearFunction - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default linear function synthesis plugin. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.DefaultSynthesis ### run - + Run synthesis for the given LinearFunction. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisC04.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisC04.mdx index 722bf524913..3bc50721385 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisC04.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisC04.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes # FullAdderSynthesisC04 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-in and a carry-out bit. @@ -21,7 +21,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisDefault.mdx index 2ce4cf0237f..bb41006753e 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes # FullAdderSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-in and a carry-out bit. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisV95.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisV95.mdx index 47e0de6de28..9c037c15c25 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisV95.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthesisV95.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes # FullAdderSynthesisV95 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-in and a carry-out bit. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.FullAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisClifford.mdx index 008c63253a4..6376fcf63ed 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisC # GreedySynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Clifford synthesis plugin based on the greedy synthesis Bravyi-Hu-Maslov-Shaydulin method. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.GreedySynthesisC ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisC04.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisC04.mdx index 9a6034cd096..606df8bf06e 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisC04.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisC04.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes # HalfAdderSynthesisC04 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-out bit. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisD00.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisD00.mdx index 01602d780e6..498a17f6db1 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisD00.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisD00.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes # HalfAdderSynthesisD00 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A QFT-based adder with a carry-in and a carry-out bit. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisDefault.mdx index c23894688e4..86f6c4e0e4e 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes # HalfAdderSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default half-adder (no carry in, but a carry out qubit) synthesis. @@ -27,7 +27,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisR25.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisR25.mdx index 630e5d85f16..966482e732a 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisR25.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisR25.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes # HalfAdderSynthesisR25 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-out bit with no ancillary qubits. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisV95.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisV95.mdx index a04a4ed6d9a..5de51a73588 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisV95.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthesisV95.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes # HalfAdderSynthesisV95 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder with a carry-out bit. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.HalfAdderSynthes ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesis2s.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesis2s.mdx index 2a30ec53d19..a1e5a11c5e8 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesis2s.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesis2s.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn # IntComparatorSynthesis2s - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") An integer comparison based on 2s complement. @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisDefault.mdx index fa49684df78..f3413e893b0 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn # IntComparatorSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default synthesis for `IntegerComparatorGate`. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisNoAux.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisNoAux.mdx index 8ae9cd18f7c..934936bbb32 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisNoAux.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSynthesisNoAux.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn # IntComparatorSynthesisNoAux - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A potentially exponentially expensive comparison w/o auxiliary qubits. @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.IntComparatorSyn ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLinearFunction.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLinearFunction.mdx index d48c858656b..cfbfd462e29 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLinearFunction.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLinearFunction.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLine # KMSSynthesisLinearFunction - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Linear function synthesis plugin based on the Kutin-Moulton-Smithline method. @@ -29,7 +29,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisLine ### run - + Run synthesis for the given LinearFunction. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPermutation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPermutation.mdx index 39cf33a6472..bc1c670e081 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPermutation.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPermutation.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPerm # KMSSynthesisPermutation - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The permutation synthesis plugin based on the Kutin, Moulton, Smithline method. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.KMSSynthesisPerm ### run - + Run synthesis for the given Permutation. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesisClifford.mdx index 63a205c255b..8529473ad97 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesi # LayerLnnSynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Clifford synthesis plugin based on the Bravyi-Maslov method to synthesize Cliffords into layers, with each layer synthesized adhering to LNN connectivity. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.LayerLnnSynthesi ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisClifford.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisClifford.mdx index d5f956beb2e..8ff897c901d 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisClifford.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisClifford.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisCl # LayerSynthesisClifford - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Clifford synthesis plugin based on the Bravyi-Maslov method to synthesize Cliffords into layers. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.LayerSynthesisCl ### run - + Run synthesis for the given Clifford. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault.mdx index 2c972fe7f5a..84cb1a89093 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDef # MCMTSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A default decomposition for MCMT gates. @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDef ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux.mdx index d491b32a687..716bb1d3722 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoA # MCMTSynthesisNoAux - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A V-chain based synthesis for `MCMTGate`. @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoA ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain.mdx index ca9482e5d92..41923331e0a 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVCh # MCMTSynthesisVChain - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A V-chain based synthesis for `MCMTGate`. @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVCh ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate.mdx new file mode 100644 index 00000000000..22c440bbf60 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate.mdx @@ -0,0 +1,42 @@ +--- +title: MCMTSynthesisXGate (dev version) +description: API reference for qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate +--- + +# MCMTSynthesisXGate + + + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") + + A synthesis for `MCMTGate` with X gate as the base gate. + + ## Methods + + ### run + + + Run synthesis for the given Operation. + + **Parameters** + + * **high\_level\_object** ([*Operation*](qiskit.circuit.Operation "qiskit.circuit.Operation")) – The Operation to synthesize to a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") object. + * **coupling\_map** ([*CouplingMap*](qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap")) – The coupling map of the backend in case synthesis is done on a physical circuit. + * **target** ([*Target*](qiskit.transpiler.Target "qiskit.transpiler.Target")) – A target representing the target backend. + * **qubits** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")) – List of qubits over which the operation is defined in case synthesis is done on a physical circuit. + * **options** – Additional method-specific optional kwargs. + + **Returns** + + **The quantum circuit representation of the Operation** + + when successful, and `None` otherwise. + + **Return type** + + [QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95.mdx index 2f5d89bdff0..4a0ff4f8df9 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Cle # MCXSynthesis1CleanB95 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Barenco et al. (1995). @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Cle ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24.mdx index 80e44d9e039..2a7ba06faaa 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Cle # MCXSynthesis1CleanKG24 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Khattar and Gidney (2024). @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Cle The plugin name is :`mcx.1_clean_kg24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). - For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $1$ additional clean ancillary qubit. The synthesized circuit consists of $k + 2$ qubits and at most $12 * k - 18$ CX gates. + For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $1$ additional clean ancillary qubit. The synthesized circuit consists of $k + 2$ qubits and at most $6 * k - 6$ CX gates. The plugin supports the following plugin-specific options: @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Cle ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24.mdx index 331a0f9744c..b2cdf9f5621 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Dir # MCXSynthesis1DirtyKG24 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Khattar and Gidney (2024). @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Dir The plugin name is :`mcx.1_dirty_kg24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). - For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $1$ additional dirty ancillary qubit. The synthesized circuit consists of $k + 2$ qubits and at most $24 * k - 48$ CX gates. + For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $1$ additional dirty ancillary qubit. The synthesized circuit consists of $k + 2$ qubits and at most $12 * k - 18$ CX gates. The plugin supports the following plugin-specific options: @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1Dir ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24.mdx index 01ab83afdbe..1da88f23f1d 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Cle # MCXSynthesis2CleanKG24 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Khattar and Gidney (2024). @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Cle The plugin name is :`mcx.2_clean_kg24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). - For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $2$ additional clean ancillary qubits. The synthesized circuit consists of $k + 2$ qubits and at most $12 * k - 18$ CX gates. + For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $2$ additional clean ancillary qubits. The synthesized circuit consists of $k + 3$ qubits and at most $6 * k - 6$ CX gates. The plugin supports the following plugin-specific options: @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Cle ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24.mdx index 224726d4128..fa71741a1c0 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Dir # MCXSynthesis2DirtyKG24 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Khattar and Gidney (2024). @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Dir The plugin name is :`mcx.2_dirty_kg24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). - For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $2$ additional dirty ancillary qubits. The synthesized circuit consists of $k + 2$ qubits and at most $24 * k - 48$ CX gates. + For a multi-controlled X gate with $k\ge 3$ control qubits this synthesis method requires $2$ additional dirty ancillary qubits. The synthesized circuit consists of $k + 3$ qubits and at most $12 * k - 18$ CX gates. The plugin supports the following plugin-specific options: @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2Dir ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault.mdx index d7b9d7c94b3..e4b8a19baa6 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefa # MCXSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default synthesis plugin for a multi-controlled X gate. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefa ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode.mdx index b8ac55b19c4..6d69d76c92a 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGray # MCXSynthesisGrayCode - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the Gray code. @@ -23,7 +23,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGray ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15.mdx index 4aced1ba934..0d1e9e941c6 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCle # MCXSynthesisNCleanM15 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Maslov (2016). @@ -31,7 +31,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCle ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15.mdx index bfc25140b4e..5fc09e2106b 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDir # MCXSynthesisNDirtyI15 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the paper by Iten et al. (2016). @@ -34,7 +34,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDir ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24.mdx new file mode 100644 index 00000000000..32ff7068729 --- /dev/null +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24.mdx @@ -0,0 +1,34 @@ +--- +title: MCXSynthesisNoAuxHP24 (dev version) +description: API reference for qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24 in the dev version of qiskit +in_page_toc_min_heading_level: 1 +python_api_type: class +python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24 +--- + +# MCXSynthesisNoAuxHP24 + + + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") + + Synthesis plugin for a multi-controlled X gate based on the paper by Huang and Palsberg. + + See \[1] for details. + + This plugin name is :`mcx.noaux_hp24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). + + For a multi-controlled X gate with $k$ control qubits this synthesis method requires no additional clean auxiliary qubits. The synthesized circuit consists of $k + 1$ qubits. The number of CX-gates is linear in $k$. + + **References** + + 1. Huang and Palsberg, *Compiling Conditional Quantum Gates without Using Helper Qubits*, PLDI (2024), \<[https://dl.acm.org/doi/10.1145/3656436](https://dl.acm.org/doi/10.1145/3656436)>\`\_ + + ## Methods + + ### run + + + Run synthesis for the given MCX gate. + + + diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24.mdx index 1c8c3e5d278..e2a92f5f5f7 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAu # MCXSynthesisNoAuxV24 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for a multi-controlled X gate based on the implementation for MCPhaseGate, which is in turn based on the paper by Vale et al. (2024). @@ -17,7 +17,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAu This plugin name is :`mcx.noaux_v24` which can be used as the key on an [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig") object to use this method with [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis"). - For a multi-controlled X gate with $k$ control qubits this synthesis method requires no additional clean auxiliary qubits. The synthesized circuit consists of $k + 1$ qubits. + For a multi-controlled X gate with $k$ control qubits this synthesis method requires no additional clean auxiliary qubits. The synthesized circuit consists of $k + 1$ qubits. The number of CX-gates is quadratic in $k$. **References** @@ -27,7 +27,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAu ### run - + Run synthesis for the given MCX gate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisC04.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisC04.mdx index 32d8c417e82..9c459dc60d2 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisC04.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisC04.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt # ModularAdderSynthesisC04 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder, modulo $2^n$. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisD00.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisD00.mdx index f0a9967de34..ca46796a6dc 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisD00.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisD00.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt # ModularAdderSynthesisD00 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A QFT-based adder, modulo $2^n$. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisDefault.mdx index f3f03cf53b6..f96d42c5ad8 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt # ModularAdderSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The default modular adder (no carry in, no carry out qubit) synthesis. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisV95.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisV95.mdx index 906abcf7f09..c945ebe34fa 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisV95.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynthesisV95.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt # ModularAdderSynthesisV95 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A ripple-carry adder, modulo $2^n$. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.ModularAdderSynt ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisH18.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisH18.mdx index 0b97b4921f3..abadb4e51e3 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisH18.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisH18.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthe # MultiplierSynthesisH18 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A cumulative multiplier based on controlled adders. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthe ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisR17.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisR17.mdx index 946e352a7dd..c73647e2bfd 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisR17.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthesisR17.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthe # MultiplierSynthesisR17 - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") A QFT-based multiplier. @@ -19,7 +19,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.MultiplierSynthe ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLinearFunction.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLinearFunction.mdx index 358b230edf9..7f457a4a2bf 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLinearFunction.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLinearFunction.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLine # PMHSynthesisLinearFunction - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Linear function synthesis plugin based on the Patel-Markov-Hayes method. @@ -35,7 +35,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PMHSynthesisLine ### run - + Run synthesis for the given LinearFunction. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisDefault.mdx index a9e14e3396d..52d6159b0e7 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSy # PauliEvolutionSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesize a [`PauliEvolutionGate`](qiskit.circuit.library.PauliEvolutionGate "qiskit.circuit.library.PauliEvolutionGate") using the default synthesis algorithm. @@ -25,7 +25,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSy ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisRustiq.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisRustiq.mdx index a545568fd99..6f5db10a4b0 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisRustiq.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSynthesisRustiq.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSy # PauliEvolutionSynthesisRustiq - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesize a [`PauliEvolutionGate`](qiskit.circuit.library.PauliEvolutionGate "qiskit.circuit.library.PauliEvolutionGate") using Rustiq. @@ -47,7 +47,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.PauliEvolutionSy ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull.mdx index 3da51788bae..8c54ce2c0bf 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull # QFTSynthesisFull - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for QFT gates using all-to-all connectivity. @@ -42,7 +42,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisFull ### run - + Run synthesis for the given QFTGate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine.mdx index a389e05c6f1..cf51169347a 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine # QFTSynthesisLine - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesis plugin for QFT gates using linear connectivity. @@ -36,7 +36,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.QFTSynthesisLine ### run - + Run synthesis for the given QFTGate. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynthesisPermutation.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynthesisPermutation.mdx index acdffc15190..409ab1d61f2 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynthesisPermutation.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynthesisPermutation.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynt # TokenSwapperSynthesisPermutation - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") The permutation synthesis plugin based on the token swapper algorithm. @@ -33,7 +33,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.TokenSwapperSynt ### run - + Run synthesis for the given Permutation. diff --git a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynthesisDefault.mdx b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynthesisDefault.mdx index 5c1d40f3c16..d2f76056479 100644 --- a/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynthesisDefault.mdx +++ b/docs/api/qiskit/dev/qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynthesisDefault.mdx @@ -8,7 +8,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynth # WeightedSumSynthesisDefault - + Bases: [`HighLevelSynthesisPlugin`](qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin") Synthesize a [`WeightedSumGate`](qiskit.circuit.library.WeightedSumGate "qiskit.circuit.library.WeightedSumGate") using the default synthesis algorithm. @@ -23,7 +23,7 @@ python_api_name: qiskit.transpiler.passes.synthesis.hls_plugins.WeightedSumSynth ### run - + Run synthesis for the given Operation. **Parameters** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_multivector.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_multivector.mdx index a133f0e8d1c..7ba4e1bf2ca 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_multivector.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_multivector.mdx @@ -32,7 +32,7 @@ python_api_name: qiskit.visualization.plot_bloch_multivector **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_vector.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_vector.mdx index fdfa0925713..c01fb3c5a37 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_vector.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_bloch_vector.mdx @@ -19,7 +19,7 @@ python_api_name: qiskit.visualization.plot_bloch_vector * **bloch** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")*\[double]*) – array of three elements where \[\, \, \] (Cartesian) or \[\, \, \] (spherical in radians) \ is inclination angle from +z direction \ is azimuth from +x direction * **title** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – a string that represents the plot title - * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An Axes to use for rendering the bloch sphere + * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An Axes to use for rendering the bloch sphere * **figsize** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")) – Figure size in inches. Has no effect is passing `ax`. * **coord\_type** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – a string that specifies coordinate type for bloch (Cartesian or spherical), default is Cartesian * **font\_size** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – Font size. @@ -30,7 +30,7 @@ python_api_name: qiskit.visualization.plot_bloch_vector **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_distribution.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_distribution.mdx index 7bbfa7a51b3..9e237c4c077 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_distribution.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_distribution.mdx @@ -24,7 +24,7 @@ python_api_name: qiskit.visualization.plot_distribution * **legend** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")) – A list of strings to use for labels of the data. The number of entries must match the length of data (if data is a list or 1 if it’s a dict) * **bar\_labels** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – Label each bar in histogram with probability value. * **title** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – A string to use for the plot title - * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. * **filename** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – file path to save image to. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_histogram.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_histogram.mdx index 20a89494c4a..c1867080ccc 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_histogram.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_histogram.mdx @@ -24,7 +24,7 @@ python_api_name: qiskit.visualization.plot_histogram * **legend** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")) – A list of strings to use for labels of the data. The number of entries must match the length of data (if data is a list or 1 if it’s a dict) * **bar\_labels** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – Label each bar in histogram with counts value. * **title** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – A string to use for the plot title - * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. * **filename** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – file path to save image to. **Returns** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_state_city.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_state_city.mdx index ad960f0b2d6..8130d4cda91 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_state_city.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_state_city.mdx @@ -22,8 +22,8 @@ python_api_name: qiskit.visualization.plot_state_city * **figsize** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")) – Figure size in inches. * **color** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)")) – A list of len=2 giving colors for real and imaginary components of matrix elements. * **alpha** ([*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")) – Transparency value for bars - * **ax\_real** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. - * **ax\_imag** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_real only the imaginary component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax\_real** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax\_imag** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_real only the imaginary component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. **Returns** @@ -31,7 +31,7 @@ python_api_name: qiskit.visualization.plot_state_city **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_state_hinton.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_state_hinton.mdx index 7675908dd99..ea671aa7d52 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_state_hinton.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_state_hinton.mdx @@ -21,8 +21,8 @@ python_api_name: qiskit.visualization.plot_state_hinton * **title** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – a string that represents the plot title * **figsize** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")) – Figure size in inches. * **filename** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – file path to save image to. - * **ax\_real** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. - * **ax\_imag** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax\_real** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax\_imag** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. If this is specified without an ax\_imag only the real component plot will be generated. Additionally, if specified there will be no returned Figure since it is redundant. **Returns** @@ -30,7 +30,7 @@ python_api_name: qiskit.visualization.plot_state_hinton **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_state_paulivec.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_state_paulivec.mdx index 5259ce252dc..233d75e902b 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_state_paulivec.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_state_paulivec.mdx @@ -28,7 +28,7 @@ $$ * **title** ([*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – a string that represents the plot title * **figsize** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")) – Figure size in inches. * **color** ([*list*](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.13)") *or*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")) – Color of the coefficient value bars. - * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. **Returns** @@ -36,7 +36,7 @@ $$ **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/qiskit.visualization.plot_state_qsphere.mdx b/docs/api/qiskit/dev/qiskit.visualization.plot_state_qsphere.mdx index 1fa2a1ad622..2054f4fbe2e 100644 --- a/docs/api/qiskit/dev/qiskit.visualization.plot_state_qsphere.mdx +++ b/docs/api/qiskit/dev/qiskit.visualization.plot_state_qsphere.mdx @@ -17,7 +17,7 @@ python_api_name: qiskit.visualization.plot_state_qsphere * **state** ([*Statevector*](qiskit.quantum_info.Statevector "qiskit.quantum_info.Statevector") *or*[*DensityMatrix*](qiskit.quantum_info.DensityMatrix "qiskit.quantum_info.DensityMatrix") *or ndarray*) – an N-qubit quantum state. * **figsize** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")) – Figure size in inches. - * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.3)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. + * **ax** ([*matplotlib.axes.Axes*](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.10.5)")) – An optional Axes object to be used for the visualization output. If none is specified a new matplotlib Figure will be created and used. Additionally, if specified there will be no returned Figure since it is redundant. * **show\_state\_labels** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – An optional boolean indicating whether to show labels for each basis state. * **show\_state\_phases** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – An optional boolean indicating whether to show the phase for each basis state. * **use\_degrees** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – An optional boolean indicating whether to use radians or degrees for the phase values in the plot. @@ -28,7 +28,7 @@ python_api_name: qiskit.visualization.plot_state_qsphere **Return type** - [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.3)") + [`matplotlib.figure.Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.10.5)") **Raises** diff --git a/docs/api/qiskit/dev/synthesis.mdx b/docs/api/qiskit/dev/synthesis.mdx index 0a9bdab59e6..9737d8d0b9c 100644 --- a/docs/api/qiskit/dev/synthesis.mdx +++ b/docs/api/qiskit/dev/synthesis.mdx @@ -715,7 +715,7 @@ python_api_name: qiskit.synthesis ### synth\_qft\_full - + Construct a circuit for the Quantum Fourier Transform using all-to-all connectivity. @@ -746,42 +746,50 @@ Decomposition of general $2^n \times 2^n$ unitary matrices for any number of qub ### qs\_decomposition - - Decomposes a unitary matrix into one and two qubit gates using Quantum Shannon Decomposition, + + Decomposes a unitary matrix into one and two qubit gates using Quantum Shannon Decomposition, based on the Block ZXZ-Decomposition. - This decomposition is described in Shende et al. \[1]. + This decomposition is described in Krol and Al-Ars \[2] and improves the method of Shende et al. \[1]. ```text - ┌───┐ ┌───┐ ┌───┐ ┌───┐ - ─┤ ├─ ───────┤ Rz├─────┤ Ry├─────┤ Rz├───── - │ │ ≃ ┌───┐└─┬─┘┌───┐└─┬─┘┌───┐└─┬─┘┌───┐ - /─┤ ├─ /─┤ ├──□──┤ ├──□──┤ ├──□──┤ ├ - └───┘ └───┘ └───┘ └───┘ └───┘ + ┌───┐ ┌───┐ ┌───┐ + ─┤ ├─ ────□──┤ H ├──□──┤ H ├──□── + │ │ ≃ ┌─┴─┐└───┘┌─┴─┐└───┘┌─┴─┐ + /─┤ ├─ ──┤ C ├─────┤ B ├─────┤ A ├ + └───┘ └───┘ └───┘ └───┘ ``` - The number of [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")s generated with the decomposition without optimizations is: + The number of [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")s generated with the decomposition without optimizations is the same as the unoptimized method in \[1]: $$ \frac{9}{16} 4^n - \frac{3}{2} 2^n $$ - If `opt_a1 = True`, the default, the CX count is reduced by: + If `opt_a1 = True`, the CX count is reduced, improving \[1], by: $$ -\frac{1}{3} 4^{n - 2} - 1. +\frac{2}{3} (4^{n - 2} - 1). $$ - If `opt_a2 = True`, the default, the CX count is reduced by: + Saving two [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")s instead of one in each step of the recursion. + + If `opt_a2 = True`, the CX count is reduced, as in \[1], by: $$ 4^{n-2} - 1. +$$ + + Hence, the number of [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")s generated with the decomposition with optimizations is + +$$ +\frac{22}{48} 4^n - \frac{3}{2} 2^n + \frac{5}{3}. $$ **Parameters** * **mat** (*np.ndarray*) – unitary matrix to decompose - * **opt\_a1** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – whether to try optimization A.1 from Shende et al. \[1]. This should eliminate 1 `cx` per call. If `True`, [`CZGate`](qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate")s are left in the output. If desired these can be further decomposed to [`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")s. - * **opt\_a2** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)")) – whether to try optimization A.2 from Shende et al. \[1]. This decomposes two qubit unitaries into a diagonal gate and a two cx unitary and reduces overall cx count by $4^{n-2} - 1$. + * **opt\_a1** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)") *| None*) – whether to try optimization A.1 from \[1, 2]. This should eliminate 2 `cx` per call. + * **opt\_a2** ([*bool*](https://docs.python.org/3/library/functions.html#bool "(in Python v3.13)") *| None*) – whether to try optimization A.2 from \[1, 2]. This decomposes two qubit unitaries into a diagonal gate and a two `cx` unitary and reduces overall `cx` count by $4^{n-2} - 1$. This optimization should not be done if the original unitary is controlled. * **decomposer\_1q** (*Callable\[\[np.ndarray],* [*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*] | None*) – optional 1Q decomposer. If None, uses [`OneQubitEulerDecomposer`](qiskit.synthesis.OneQubitEulerDecomposer "qiskit.synthesis.OneQubitEulerDecomposer"). * **decomposer\_2q** (*Callable\[\[np.ndarray],* [*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*] | None*) – optional 2Q decomposer. If None, uses [`TwoQubitBasisDecomposer`](qiskit.synthesis.TwoQubitBasisDecomposer "qiskit.synthesis.TwoQubitBasisDecomposer"). @@ -796,6 +804,7 @@ $$ **References** 1. Shende, Bullock, Markov, *Synthesis of Quantum Logic Circuits*, [arXiv:0406176 \[quant-ph\]](https://arxiv.org/abs/quant-ph/0406176) + 2. Krol, Al-Ars, *Beyond Quantum Shannon: Circuit Construction for General n-Qubit Gates Based on Block ZXZ-Decomposition*, [arXiv:2403.13692](https://arxiv.org/abs/2403.13692) The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.unitary.aqc`](qiskit.synthesis.unitary.aqc#module-qiskit.synthesis.unitary.aqc "qiskit.synthesis.unitary.aqc"). @@ -839,7 +848,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcmt\_vchain - + Synthesize MCMT using a V-chain. This uses a chain of CCX gates, using `num_ctrl_qubits - 1` auxiliary qubits. @@ -865,10 +874,53 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u **Parameters** - * **gate** ([*Gate*](qiskit.circuit.Gate "qiskit.circuit.Gate")) – - * **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – - * **num\_target\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – - * **ctrl\_state** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – + * **gate** ([*Gate*](qiskit.circuit.Gate "qiskit.circuit.Gate")) – Base gate to be applied to the targets. + * **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – Number of control qubits. + * **num\_target\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – Number of target qubits. + * **ctrl\_state** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – Optional control state as an integer. + + **Returns** + + The synthesized circuit for the MCMT gate. + + **Return type** + + [QuantumCircuit](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") + + +### synth\_mcmt\_xgate + + + Synthesize MCMT X gate. + + This uses a special circuit structure that is efficient for MCMT X gates. It does not require any ancillary qubits and benefits from efficient MCX decompositions. + + E.g. a 3-control, 3-target X gate will be synthesized as: + + ```python + q_0: ─────────────■──────────── + | + q_1: ─────────────■──────────── + | + q_2: ─────────────■──────────── + ┌─┴─┐ + q_3: ────────■──┤ X ├──■─────── + ┌─┴─┐└───┘┌─┴─┐ + q_4: ───■──┤ X ├─────┤ X ├──■── + ┌─┴─┐└───┘ └───┘┌─┴─┐ + q_5: ─┤ X ├───────────────┤ X ├ + └───┘ └───┘ + ``` + + **Parameters** + + * **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – Number of control qubits. + * **num\_target\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – Number of target qubits. + * **ctrl\_state** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – Optional control state as an integer. + + **Returns** + + The synthesized circuit for the MCMT X gate. **Return type** @@ -877,8 +929,8 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_1\_clean\_kg24 - - Synthesize a multi-controlled X gate with $k$ controls using $1$ clean ancillary qubit producing a circuit with $2k-3$ Toffoli gates and depth $O(k)$ as described in Sec. 5.1 of \[1]. + + Synthesize a multi-controlled X gate with $k$ controls using $1$ clean ancillary qubit producing a circuit with $2k-3$ Toffoli gates or $6k-6$ CX gates and depth $O(k)$ as described in Sec. 5.1 of \[1]. **Parameters** @@ -903,8 +955,8 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_1\_dirty\_kg24 - - Synthesize a multi-controlled X gate with $k$ controls using $1$ dirty ancillary qubit producing a circuit with $4k-8$ Toffoli gates and depth $O(k)$ as described in Sec. 5.3 of \[1]. + + Synthesize a multi-controlled X gate with $k$ controls using $1$ dirty ancillary qubit producing a circuit with $4k-8$ Toffoli gates or $12k-18$ CX gates and depth $O(k)$ as described in Sec. 5.3 of \[1]. **Parameters** @@ -929,8 +981,8 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_2\_clean\_kg24 - - Synthesize a multi-controlled X gate with $k$ controls using $2$ clean ancillary qubits producing a circuit with $2k-3$ Toffoli gates and depth $O(\log(k))$ as described in Sec. 5.2 of \[1]. + + Synthesize a multi-controlled X gate with $k$ controls using $2$ clean ancillary qubits producing a circuit with $2k-3$ Toffoli gates or $6k-6$ CX gates and depth $O(\log(k))$ as described in Sec. 5.2 of \[1]. **Parameters** @@ -955,8 +1007,8 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_2\_dirty\_kg24 - - Synthesize a multi-controlled X gate with $k$ controls using $2$ dirty ancillary qubits producing a circuit with $4k-8$ Toffoli gates and depth $O(\log(k))$ as described in Sec. 5.4 of \[1]. + + Synthesize a multi-controlled X gate with $k$ controls using $2$ dirty ancillary qubits producing a circuit with $4k-8$ Toffoli gates or $12k-18$ CX gates and depth $O(\log(k))$ as described in Sec. 5.4 of \[1]. **Parameters** @@ -981,7 +1033,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_n\_dirty\_i15 - + Synthesize a multi-controlled X gate with $k$ controls based on the paper by Iten et al. \[1]. For $k\ge 4$ the method uses $k - 2$ dirty ancillary qubits, producing a circuit with $2 * k - 1$ qubits and at most $8 * k - 6$ CX gates. For $k\le 3$ explicit efficient circuits are used instead. @@ -1007,7 +1059,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_n\_clean\_m15 - + Synthesize a multi-controlled X gate with $k$ controls using $k - 2$ clean ancillary qubits with producing a circuit with $2 * k - 1$ qubits and at most $6 * k - 6$ CX gates, by Maslov \[1]. **Parameters** @@ -1029,7 +1081,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_1\_clean\_b95 - + Synthesize a multi-controlled X gate with $k$ controls using a single clean ancillary qubit producing a circuit with $k + 2$ qubits and at most $16 * k - 24$ CX gates, by \[1], \[2]. **Parameters** @@ -1052,7 +1104,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_mcx\_noaux\_v24 - + Synthesize a multi-controlled X gate with $k$ controls based on the implementation for MCPhaseGate. In turn, the MCPhase gate uses the decomposition for multi-controlled special unitaries described in \[1]. @@ -1076,9 +1128,33 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u 1. Vale et. al., *Circuit Decomposition of Multicontrolled Special Unitary Single-Qubit Gates*, IEEE TCAD 43(3) (2024), [arXiv:2302.06377](https://arxiv.org/abs/2302.06377) +### synth\_mcx\_noaux\_hp24 + + + Synthesize a multi-controlled X gate with $k$ controls based on the work by Huang and Palsberg. + + Produces a quantum circuit with $k + 1$ qubits. The number of CX-gates is linear in $k$. + + **Parameters** + + **num\_ctrl\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of control qubits. + + **Returns** + + The synthesized quantum circuit. + + **Return type** + + [*QuantumCircuit*](qiskit.circuit.QuantumCircuit "qiskit.circuit.quantumcircuit.QuantumCircuit") + + **References** + + 1. Huang and Palsberg, *Compiling Conditional Quantum Gates without Using Helper Qubits*, PLDI (2024), \<[https://dl.acm.org/doi/10.1145/3656436](https://dl.acm.org/doi/10.1145/3656436)>\`\_ + + ### synth\_mcx\_gray\_code - + Synthesize a multi-controlled X gate with $k$ controls using the Gray code. Produces a quantum circuit with $k + 1$ qubits. This method produces exponentially many CX gates and should be used only for small values of $k$. @@ -1098,7 +1174,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_c3x - + Efficient synthesis of 3-controlled X-gate. **Return type** @@ -1108,7 +1184,7 @@ The Approximate Quantum Compiler is available as the module [`qiskit.synthesis.u ### synth\_c4x - + Efficient synthesis of 4-controlled X-gate. **Return type** diff --git a/docs/api/qiskit/dev/transpiler.mdx b/docs/api/qiskit/dev/transpiler.mdx index 62f22ab8068..83d16f536c2 100644 --- a/docs/api/qiskit/dev/transpiler.mdx +++ b/docs/api/qiskit/dev/transpiler.mdx @@ -18,6 +18,13 @@ python_api_name: qiskit.transpiler ## Overview + + If you are already familiar with the concepts of circuit transpilation / compilation, you may want to skip ahead to: + + * [Descriptions of the preconfigured pass managers](#transpiler-preset). This includes descriptions of the stages, and of all the available built-in plugins. + * [Documentation on building a custom transpiler pass](#transpiler-custom-passes). + + Transpilation is the process of rewriting a given input circuit to match the topology of a specific quantum device, and/or to optimize the circuit for execution on quantum systems. Most circuits must undergo a series of transformations that make them compatible with a given target device, and optimize them to reduce the effects of noise on the resulting outcomes. Rewriting quantum circuits to match hardware constraints and optimizing for performance can be far from trivial. The flow of logic in the rewriting tool chain need not be linear, and can often have iterative sub-loops, conditional branches, and other complex behaviors. That being said, the standard compilation flow follows the structure given below: @@ -85,11 +92,28 @@ The preset transpiler pipelines can also be configured at a high level by settin The optimization level affects which implementations are used for a given stage by default, though this can be overridden by passing explicit `_method=""` arguments to [`generate_preset_pass_manager()`](qiskit.transpiler.generate_preset_pass_manager "qiskit.transpiler.generate_preset_pass_manager"). - - The preset pass managers almost always include stochastic, heuristic-based passes. If you need to ensure reproducibility of a compilation, pass a known integer to the `seed_transpiler` argument to the generator functions. + - This stochasticity arises because many of the problems the transpiler must solve are known to be non-polynomial in complexity, but transpilation must complete in a workable amount of time. - +### Reproducibility of the preset pipelines + +Quantum compilation often involves solving problems that are knownn to be non-polynomial in complexity, and so are intractable to globally optimize. In these cases, stochastic and heuristic algorithms are often more appropriate. This leads to problems of reproducibility, however. + +The preset pass managers almost always include stochastic, heuristic-based passes. If you need to ensure reproducibility of a compilation, pass a known integer to the `seed_transpiler` argument of the generator functions. + +All built-in plugins to Qiskit are required to produce their analyses and modify the [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") in deterministic ways if they randomization (if any) is seeded, so that a compilation can be repeated later. There are limits on this: + +* All built-in passes with stochastic components must provide a way to seed the randomization, and if seeded, they must respect the rules of deterministic output. +* All built-in passes without stochastic components must respect the rules of deterministic output for identical input. It is permissible to keep a cache for efficiency, but given the same set of inputs, the pass’s returns must be the same if the pass is called multiple times, unless something outside the pass’s control mutates one of its inputs in-place (for example, the [`BasisTranslator`](qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") uses the [`SessionEquivalenceLibrary`](circuit#qiskit.circuit.SessionEquivalenceLibrary "qiskit.circuit.SessionEquivalenceLibrary") by default in the preset pass managers, and it is not a bug to get different results if new entries are added to the equivalence library). An “output” is anything the pass writes out for further consumption; this can be the explicit `return` value from the pass, but also includes properties intended for later consumption in the [`PropertySet`](qiskit.passmanager.PropertySet "qiskit.passmanager.PropertySet"). +* The output of a pass should be deterministic on a given machine for a given version of Qiskit and a frozen environment, no matter how many threads are available for the pass. Many built-in Qiskit passes use threaded concurrency, and they are not permitted to have different behavior based on the number of threads. +* The output of a pass for a fixed seed is not required to be equal if some part of the underlying Python environment changes (such as a dependent package updating), or if the system mathematical libraries change (such as a different implementation of BLAS is available). +* The output of a pass for a fixed seed is not required to be equal between operating systems (although typically, it is the implementation of the system mathematical library that is the root cause of operating-system-related differences). +* The output of a pass for a fixed seed is not required to be the same between two machines that have different CPU instructions available; it is expected that different implementations of core mathematical kernels may produce different behavior if different CPU instructions are available, such as fused multiply-add instructions having different rounding characteristics to two separate floating-point multiply and add instructions. +* The output of a pass for a fixed seed must be the same, regardless of the number of threads it is allowed to use, unless the user specifically opts out of this behavior. For example in the preset passmanagers, the Sabre layout and routing methods need to run the same number of trials by default, no matter if there is a single thread allowed or even more threads than trials, though this behavior can be explicitly overridden by setting the `QISKIT_SABRE_ALL_THREADS` environment variable to opt in to becoming sensitive to the thread count. +* All the above rules apply even between separate Python interpreter sessions, even when `PYTHONHASHSEED` has not been explicitly set. + +In general, a consumer of the [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") should be able to assume, after any combination of built-in, seeded if appropriate, Qiskit passes have run with fixed inputs, that the exact output of all `DAGCircuit()` methods is deterministic. This includes the order of output even of methods that do not make any promise about the order; while the semantics and precide order cannot be relied on, the determinism of it for fixed inputs can. + +Transpiler-pass authors should consult [Randomness and determinism](#transpiler-custom-passes-determinism) for a discussion of how to make a transpiler pass deterministic. ### Choosing preset stage implementations @@ -532,6 +556,8 @@ Explicitly schedule all operations using an “as late as possible” strategy. Explicitly schedule all operations using an “as soon as possible” strategy. This uses the [`ASAPScheduleAnalysis`](qiskit.transpiler.passes.ASAPScheduleAnalysis "qiskit.transpiler.passes.ASAPScheduleAnalysis") algorithm to decide where to place gates. + + ## Custom pass managers In addition to modifying preset pass managers, it is also possible to construct a pass manager to build an entirely custom pipeline for transforming input circuits. You can use the [`StagedPassManager`](qiskit.transpiler.StagedPassManager "qiskit.transpiler.StagedPassManager") class directly to do this. You can define arbitrary stage names and populate them with a [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") instance. For example, the following code creates a new [`StagedPassManager`](qiskit.transpiler.StagedPassManager "qiskit.transpiler.StagedPassManager") that has two stages, `init` and `translation`. @@ -565,6 +591,59 @@ There is no limit on the number of stages you can put in a [`StagedPassManager`] The [Stage generator functions](transpiler_preset#stage-generators) may be useful for the construction of custom [`StagedPassManager`](qiskit.transpiler.StagedPassManager "qiskit.transpiler.StagedPassManager") instances. They generate pass managers which provide common functionality used in many stages. For example, [`generate_embed_passmanager()`](transpiler_preset#qiskit.transpiler.preset_passmanagers.generate_embed_passmanager "qiskit.transpiler.preset_passmanagers.generate_embed_passmanager") generates a [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") to “embed” a selected initial [`Layout`](qiskit.transpiler.Layout "qiskit.transpiler.Layout") from a layout pass to the specified target device. + + +## Writing custom transpiler passes + +Qiskit is designed to be extended with custom, specialized transpiler passes. + +There are two types of transpiler pass: “analysis” passes ([`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass")), which read a circuit and write global analysis properties into the `PropertySet`; and “transformation” passes ([`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.TransformationPass")), which either modify a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") in place, or return a new `DAGCircuit`. Historically, Qiskit attempted to strongly separate these two types. In modern Qiskit, however, it is rather common to include both analysis and modifications into one stand-alone [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.TransformationPass"), rather than attempt to split everything. If your pass is purely analysis-based, it is still appropriate to use [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass"). + +### General principles of pass authorship + +If you want to modify or create a new [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"), you must write a [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.TransformationPass"). If you only want to write into the `PropertySet` and not modify the [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"), you should write an [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass"). If you want to do both, write a [`TransformationPass`](qiskit.transpiler.TransformationPass "qiskit.transpiler.TransformationPass"). In both cases, the only required method is `BasePass.run()`, which is the meat of your pass. This should accept a single argument (other than `self`), `dag: DAGCircuit`. If a `TranspilerPass`, it should return a `DAGCircuit` (which can be the input, if modified in place), whereas if a [`AnalysisPass`](qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass"), it should return `None`. + +If your pass has an initializer, you must call `super().__init__()`. + +Typically, your pass should accept a [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") in its initializer, which describes the quantum hardware you are compiling for. Accepting “loose” constraints like a separate coupling map and list of basis gates is discouraged; the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") is more correctly descriptive of general heterogeneous hardware. + +During execution of a [`PassManager`](qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") pipeline, when the `run()` method of your pass is called, you can access the attribute `self.property_set` to get the current `PropertySet` state of the transpilation. You should read from and write to this in place. Your pass should clearly document what, if any, attributes in the property set that it reads from and writes to. + + + +### Randomness and determinism + +Quantum compilation often involves solving problems that are intractable to globally optimize. In these cases, stochastic and heuristic algorithms are often more appropriate. This leads to problems of reproducibility, however. + +There is no formal requirement for a custom pass to be deterministic under [the precise same set of rules](#transpiler-preset-determinism) that built-in Qiskit passes must follow. However, we **strongly** encourage you to follow these rules in your own passes; science thrives on reproducibility, and debugging is a nightmare when you can’t reproduce previously observed behavior. + +When writing a transpiler pass, you can rely on the following (representative, and non-exhaustive) examples being deterministic, even though the exact semantics of the ordering may not be fully specified, and passes should **not** rely on any particular order: + +* The order nodes are encountered in [`DAGCircuit.op_nodes()`](qiskit.dagcircuit.DAGCircuit#op_nodes "qiskit.dagcircuit.DAGCircuit.op_nodes"). By contrast, [`topological_op_nodes()`](qiskit.dagcircuit.DAGCircuit#topological_op_nodes "qiskit.dagcircuit.DAGCircuit.topological_op_nodes") by default includes an ordering key that makes its order entirely unaffected by the order of node removal/insertion, so is fully deterministic provided the same set of nodes with the same data-flow is specified, even if it was built up in a different order. +* The order edges are encountered in [`DAGCircuit.edges()`](qiskit.dagcircuit.DAGCircuit#edges "qiskit.dagcircuit.DAGCircuit.edges"). +* The order that runs are returned from [`DAGCircuit.collect_2q_runs()`](qiskit.dagcircuit.DAGCircuit#collect_2q_runs "qiskit.dagcircuit.DAGCircuit.collect_2q_runs"), and the exact order nodes in a run are encountered. +* The order that nodes are encountered in order-degenerate methods such as [`predecessors()`](qiskit.dagcircuit.DAGCircuit#predecessors "qiskit.dagcircuit.DAGCircuit.predecessors"), [`bfs_successors()`](qiskit.dagcircuit.DAGCircuit#bfs_successors "qiskit.dagcircuit.DAGCircuit.bfs_successors"), and so on. + +In general, the requirement is that **all the same circuit modifications are made, in exactly the same order**. For example, if nodes are to be added, contracted, or removed, the order of these modifications must be done in a deterministic order, and the replacements must be specified deterministically. + +Some tips for ensuring this include: + +* Be very careful when iterating over hash-based containers. Iteration over Python’s [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.13)") is non-deterministic due to hash-seed randomization. In Rust, iteration over the standard-library hash-based containers, including `hashbrown` equivalents with their default hashers is non-deterministic. + + + Iteration over Python’s [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)") *is* deterministic, and guaranteed to be in insertion order if there have been no removals, and arbitrary but still deterministic order if there have been deterministic removals. + + + In Python, if you need to create a [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.13)") and then iterate over it, consider instead using a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)") with all the values being `None` as a substitute. Using a [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.13)") purely for membership testing is no trouble. + + In Rust, use `indexmap` and its structs `IndexMap` and `IndexSet` as replacements for `HashMap` and `HashSet`, respectively; they have similar deterministic-iteration properties to Python’s [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)"). + +* If your pass as stochastic components, ensure that you accept a `seed` input, and make your output pure if this is supplied as an integer. Typically this means storing the seed, and instantiating a new pRNG from this seed at the start of each call to `BasePass.run()`. + +* If using threaded parallelism, take care that your output is not dependent on the order that threads do their work or return their partial results. For example, if distributing work across a thread pool and collecting the results at the end, ensure that the output is arranged in a corresponding order to the input. In Python, functions like `concurrent.futures.ThreadPoolExecutor.map()` ensure this. Similarly, in Rust, `rayon`’s parallel iterators will collect their output in the same order as the input. + + Beware that parallel \_reductions\_, such as “apply a function to each item in this iterator, and choose the one that minimizes some metric”, are typically highly susceptible to threaded non-determinism, in the case of degeneracies in the metric. For example, if two items in the iterator produce non-equal output that nevertheless has the same comparison key, the one chosen in a threaded environment is not deterministic. To avoid this, apply a deterministic tie-breaker to lift the degeneracy, such as by enumerating the input and using the sequence number as a tie-breaking key, such that if two items have the same score, the one corresponding to an earlier input is reliably chosen. + ## Representing Quantum Computers To be able to compile a [`QuantumCircuit`](qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") for a specific backend, the transpiler needs a specialized representation of that backend, including its constraints, instruction set, qubit properties, and more, to be able to compile and optimize effectively. While the [`BackendV2`](qiskit.providers.BackendV2 "qiskit.providers.BackendV2") class defines an interface for querying and interacting with backends, its scope is larger than just the transpiler’s needs including managing job submission and potentially interfacing with remote services. The specific information needed by the transpiler is described by the [`Target`](qiskit.transpiler.Target "qiskit.transpiler.Target") class diff --git a/docs/api/qiskit/dev/transpiler_passes.mdx b/docs/api/qiskit/dev/transpiler_passes.mdx index cf763cf7b35..5dc81ac7b59 100644 --- a/docs/api/qiskit/dev/transpiler_passes.mdx +++ b/docs/api/qiskit/dev/transpiler_passes.mdx @@ -37,9 +37,10 @@ python_api_name: qiskit.transpiler.passes | | | | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | [`BasicSwap`](qiskit.transpiler.passes.BasicSwap "qiskit.transpiler.passes.BasicSwap")(\*args, \*\*kwargs) | Map (with minimum effort) a DAGCircuit onto a `coupling_map` adding swap gates. | +| [`Commuting2qGateRouter`](qiskit.transpiler.passes.Commuting2qGateRouter "qiskit.transpiler.passes.Commuting2qGateRouter")(\*args, \*\*kwargs) | A class to swap route one or more commuting gates to the coupling map. | +| [`LayoutTransformation`](qiskit.transpiler.passes.LayoutTransformation "qiskit.transpiler.passes.LayoutTransformation")(\*args, \*\*kwargs) | Adds a Swap circuit for a given (partial) permutation to the circuit. | | [`LookaheadSwap`](qiskit.transpiler.passes.LookaheadSwap "qiskit.transpiler.passes.LookaheadSwap")(\*args, \*\*kwargs) | Map input circuit onto a backend topology via insertion of SWAPs. | | [`SabreSwap`](qiskit.transpiler.passes.SabreSwap "qiskit.transpiler.passes.SabreSwap")(\*args, \*\*kwargs) | Map input circuit onto a backend topology via insertion of SWAPs. | -| [`Commuting2qGateRouter`](qiskit.transpiler.passes.Commuting2qGateRouter "qiskit.transpiler.passes.Commuting2qGateRouter")(\*args, \*\*kwargs) | A class to swap route one or more commuting gates to the coupling map. | | [`StarPreRouting`](qiskit.transpiler.passes.StarPreRouting "qiskit.transpiler.passes.StarPreRouting")(\*args, \*\*kwargs) | Run star to linear pre-routing | ## Basis Change @@ -56,58 +57,61 @@ python_api_name: qiskit.transpiler.passes | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`Optimize1qGates`](qiskit.transpiler.passes.Optimize1qGates "qiskit.transpiler.passes.Optimize1qGates")(\*args, \*\*kwargs) | Optimize chains of single-qubit u1, u2, u3 gates by combining them into a single gate. | -| [`Optimize1qGatesDecomposition`](qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition")(\*args, \*\*kwargs) | Optimize chains of single-qubit gates by combining them into a single gate. | | [`Collect1qRuns`](qiskit.transpiler.passes.Collect1qRuns "qiskit.transpiler.passes.Collect1qRuns")(\*args, \*\*kwargs) | Collect one-qubit subcircuits. | | [`Collect2qBlocks`](qiskit.transpiler.passes.Collect2qBlocks "qiskit.transpiler.passes.Collect2qBlocks")(\*args, \*\*kwargs) | Collect two-qubit subcircuits. | -| [`CollectMultiQBlocks`](qiskit.transpiler.passes.CollectMultiQBlocks "qiskit.transpiler.passes.CollectMultiQBlocks")(\*args, \*\*kwargs) | Collect sequences of uninterrupted gates acting on groups of qubits. | | [`CollectAndCollapse`](qiskit.transpiler.passes.CollectAndCollapse "qiskit.transpiler.passes.CollectAndCollapse")(\*args, \*\*kwargs) | A general transpiler pass to collect and to consolidate blocks of nodes in a circuit. | -| [`CollectLinearFunctions`](qiskit.transpiler.passes.CollectLinearFunctions "qiskit.transpiler.passes.CollectLinearFunctions")(\*args, \*\*kwargs) | Collect blocks of linear gates ([`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") and [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate") gates) and replaces them by linear functions ([`LinearFunction`](qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction")). | | [`CollectCliffords`](qiskit.transpiler.passes.CollectCliffords "qiskit.transpiler.passes.CollectCliffords")(\*args, \*\*kwargs) | Collects blocks of Clifford gates and replaces them by a [`Clifford`](qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford") object. | -| [`ConsolidateBlocks`](qiskit.transpiler.passes.ConsolidateBlocks "qiskit.transpiler.passes.ConsolidateBlocks")(\*args, \*\*kwargs) | Replace each block of consecutive gates by a single Unitary node. | -| [`InverseCancellation`](qiskit.transpiler.passes.InverseCancellation "qiskit.transpiler.passes.InverseCancellation")(\*args, \*\*kwargs) | Cancel specific Gates which are inverses of each other when they occur back-to- back. | +| [`CollectLinearFunctions`](qiskit.transpiler.passes.CollectLinearFunctions "qiskit.transpiler.passes.CollectLinearFunctions")(\*args, \*\*kwargs) | Collect blocks of linear gates ([`CXGate`](qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") and [`SwapGate`](qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate") gates) and replaces them by linear functions ([`LinearFunction`](qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction")). | +| [`CollectMultiQBlocks`](qiskit.transpiler.passes.CollectMultiQBlocks "qiskit.transpiler.passes.CollectMultiQBlocks")(\*args, \*\*kwargs) | Collect sequences of uninterrupted gates acting on groups of qubits. | | [`CommutationAnalysis`](qiskit.transpiler.passes.CommutationAnalysis "qiskit.transpiler.passes.CommutationAnalysis")(\*args, \*\*kwargs) | Analysis pass to find commutation relations between DAG nodes. | | [`CommutativeCancellation`](qiskit.transpiler.passes.CommutativeCancellation "qiskit.transpiler.passes.CommutativeCancellation")(\*args, \*\*kwargs) | Cancel the redundant (self-adjoint) gates through commutation relations. | | [`CommutativeInverseCancellation`](qiskit.transpiler.passes.CommutativeInverseCancellation "qiskit.transpiler.passes.CommutativeInverseCancellation")(\*args, \*\*kwargs) | Cancel pairs of inverse gates exploiting commutation relations. | +| [`ConsolidateBlocks`](qiskit.transpiler.passes.ConsolidateBlocks "qiskit.transpiler.passes.ConsolidateBlocks")(\*args, \*\*kwargs) | Replace each block of consecutive gates by a single Unitary node. | +| [`ContractIdleWiresInControlFlow`](qiskit.transpiler.passes.ContractIdleWiresInControlFlow "qiskit.transpiler.passes.ContractIdleWiresInControlFlow")(\*args, \*\*kwargs) | Remove idle qubits from control-flow operations of a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"). | +| [`ElidePermutations`](qiskit.transpiler.passes.ElidePermutations "qiskit.transpiler.passes.ElidePermutations")(\*args, \*\*kwargs) | Remove permutation operations from a pre-layout circuit | +| [`HoareOptimizer`](qiskit.transpiler.passes.HoareOptimizer "qiskit.transpiler.passes.HoareOptimizer")(\*args, \*\*kwargs) | This is a transpiler pass using Hoare logic circuit optimization. | +| [`InverseCancellation`](qiskit.transpiler.passes.InverseCancellation "qiskit.transpiler.passes.InverseCancellation")(\*args, \*\*kwargs) | Cancel specific Gates which are inverses of each other when they occur back-to- back. | +| [`Optimize1qGates`](qiskit.transpiler.passes.Optimize1qGates "qiskit.transpiler.passes.Optimize1qGates")(\*args, \*\*kwargs) | Optimize chains of single-qubit u1, u2, u3 gates by combining them into a single gate. | +| [`Optimize1qGatesDecomposition`](qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition")(\*args, \*\*kwargs) | Optimize chains of single-qubit gates by combining them into a single gate. | | [`Optimize1qGatesSimpleCommutation`](qiskit.transpiler.passes.Optimize1qGatesSimpleCommutation "qiskit.transpiler.passes.Optimize1qGatesSimpleCommutation")(\*args, \*\*kwargs) | Optimizes 1Q gate strings interrupted by 2Q gates by commuting the components and resynthesizing the results. | +| [`OptimizeAnnotated`](qiskit.transpiler.passes.OptimizeAnnotated "qiskit.transpiler.passes.OptimizeAnnotated")(\*args, \*\*kwargs) | Optimization pass on circuits with annotated operations. | +| [`OptimizeCliffordT`](qiskit.transpiler.passes.OptimizeCliffordT "qiskit.transpiler.passes.OptimizeCliffordT")(\*args, \*\*kwargs) | An optimization pass for Clifford+T circuits. | +| [`OptimizeCliffords`](qiskit.transpiler.passes.OptimizeCliffords "qiskit.transpiler.passes.OptimizeCliffords")(\*args, \*\*kwargs) | Combine consecutive Cliffords over the same qubits. | +| [`OptimizeSwapBeforeMeasure`](qiskit.transpiler.passes.OptimizeSwapBeforeMeasure "qiskit.transpiler.passes.OptimizeSwapBeforeMeasure")(\*args, \*\*kwargs) | Remove the swaps followed by measurement (and adapt the measurement). | | [`RemoveDiagonalGatesBeforeMeasure`](qiskit.transpiler.passes.RemoveDiagonalGatesBeforeMeasure "qiskit.transpiler.passes.RemoveDiagonalGatesBeforeMeasure")(\*args, \*\*kwargs) | Remove diagonal gates (including diagonal 2Q gates) before a measurement. | -| [`RemoveResetInZeroState`](qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState")(\*args, \*\*kwargs) | Remove reset gate when the qubit is in zero state. | | [`RemoveFinalReset`](qiskit.transpiler.passes.RemoveFinalReset "qiskit.transpiler.passes.RemoveFinalReset")(\*args, \*\*kwargs) | Remove reset when it is the final instruction on a qubit wire. | -| [`HoareOptimizer`](qiskit.transpiler.passes.HoareOptimizer "qiskit.transpiler.passes.HoareOptimizer")(\*args, \*\*kwargs) | This is a transpiler pass using Hoare logic circuit optimization. | -| [`TemplateOptimization`](qiskit.transpiler.passes.TemplateOptimization "qiskit.transpiler.passes.TemplateOptimization")(\*args, \*\*kwargs) | Class for the template optimization pass. | +| [`RemoveIdentityEquivalent`](qiskit.transpiler.passes.RemoveIdentityEquivalent "qiskit.transpiler.passes.RemoveIdentityEquivalent")(\*args, \*\*kwargs) | Remove gates with negligible effects. | +| [`RemoveResetInZeroState`](qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState")(\*args, \*\*kwargs) | Remove reset gate when the qubit is in zero state. | | [`ResetAfterMeasureSimplification`](qiskit.transpiler.passes.ResetAfterMeasureSimplification "qiskit.transpiler.passes.ResetAfterMeasureSimplification")(\*args, \*\*kwargs) | This pass replaces reset after measure with a conditional X gate. | -| [`OptimizeCliffords`](qiskit.transpiler.passes.OptimizeCliffords "qiskit.transpiler.passes.OptimizeCliffords")(\*args, \*\*kwargs) | Combine consecutive Cliffords over the same qubits. | -| [`ElidePermutations`](qiskit.transpiler.passes.ElidePermutations "qiskit.transpiler.passes.ElidePermutations")(\*args, \*\*kwargs) | Remove permutation operations from a pre-layout circuit | -| [`OptimizeAnnotated`](qiskit.transpiler.passes.OptimizeAnnotated "qiskit.transpiler.passes.OptimizeAnnotated")(\*args, \*\*kwargs) | Optimization pass on circuits with annotated operations. | | [`Split2QUnitaries`](qiskit.transpiler.passes.Split2QUnitaries "qiskit.transpiler.passes.Split2QUnitaries")(\*args, \*\*kwargs) | Attempt to splits two-qubit unitaries in a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") into two single-qubit gates. | -| [`RemoveIdentityEquivalent`](qiskit.transpiler.passes.RemoveIdentityEquivalent "qiskit.transpiler.passes.RemoveIdentityEquivalent")(\*args, \*\*kwargs) | Remove gates with negligible effects. | -| [`ContractIdleWiresInControlFlow`](qiskit.transpiler.passes.ContractIdleWiresInControlFlow "qiskit.transpiler.passes.ContractIdleWiresInControlFlow")(\*args, \*\*kwargs) | Remove idle qubits from control-flow operations of a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"). | +| [`TemplateOptimization`](qiskit.transpiler.passes.TemplateOptimization "qiskit.transpiler.passes.TemplateOptimization")(\*args, \*\*kwargs) | Class for the template optimization pass. | ## Scheduling | | | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| [`TimeUnitConversion`](qiskit.transpiler.passes.TimeUnitConversion "qiskit.transpiler.passes.TimeUnitConversion")(\*args, \*\*kwargs) | Choose a time unit to be used in the following time-aware passes, and make all circuit time units consistent with that. | | [`ALAPScheduleAnalysis`](qiskit.transpiler.passes.ALAPScheduleAnalysis "qiskit.transpiler.passes.ALAPScheduleAnalysis")(\*args, \*\*kwargs) | ALAP Scheduling pass, which schedules the **stop** time of instructions as late as possible. | | [`ASAPScheduleAnalysis`](qiskit.transpiler.passes.ASAPScheduleAnalysis "qiskit.transpiler.passes.ASAPScheduleAnalysis")(\*args, \*\*kwargs) | ASAP Scheduling pass, which schedules the start time of instructions as early as possible. | -| [`ContextAwareDynamicalDecoupling`](qiskit.transpiler.passes.ContextAwareDynamicalDecoupling "qiskit.transpiler.passes.ContextAwareDynamicalDecoupling")(\*args, \*\*kwargs) | Implement an X-sequence dynamical decoupling considering the gate- and qubit-context. | -| [`PadDynamicalDecoupling`](qiskit.transpiler.passes.PadDynamicalDecoupling "qiskit.transpiler.passes.PadDynamicalDecoupling")(\*args, \*\*kwargs) | Dynamical decoupling insertion pass. | -| [`PadDelay`](qiskit.transpiler.passes.PadDelay "qiskit.transpiler.passes.PadDelay")(\*args, \*\*kwargs) | Padding idle time with Delay instructions. | | [`ConstrainedReschedule`](qiskit.transpiler.passes.ConstrainedReschedule "qiskit.transpiler.passes.ConstrainedReschedule")(\*args, \*\*kwargs) | Rescheduler pass that updates node start times to conform to the hardware alignments. | +| [`ContextAwareDynamicalDecoupling`](qiskit.transpiler.passes.ContextAwareDynamicalDecoupling "qiskit.transpiler.passes.ContextAwareDynamicalDecoupling")(\*args, \*\*kwargs) | Implement an X-sequence dynamical decoupling considering the gate- and qubit-context. | | [`InstructionDurationCheck`](qiskit.transpiler.passes.InstructionDurationCheck "qiskit.transpiler.passes.InstructionDurationCheck")(\*args, \*\*kwargs) | Duration validation pass for reschedule. | +| [`PadDelay`](qiskit.transpiler.passes.PadDelay "qiskit.transpiler.passes.PadDelay")(\*args, \*\*kwargs) | Padding idle time with Delay instructions. | +| [`PadDynamicalDecoupling`](qiskit.transpiler.passes.PadDynamicalDecoupling "qiskit.transpiler.passes.PadDynamicalDecoupling")(\*args, \*\*kwargs) | Dynamical decoupling insertion pass. | | [`SetIOLatency`](qiskit.transpiler.passes.SetIOLatency "qiskit.transpiler.passes.SetIOLatency")(\*args, \*\*kwargs) | Set IOLatency information to the input circuit. | +| [`TimeUnitConversion`](qiskit.transpiler.passes.TimeUnitConversion "qiskit.transpiler.passes.TimeUnitConversion")(\*args, \*\*kwargs) | Choose a time unit to be used in the following time-aware passes, and make all circuit time units consistent with that. | ## Circuit Analysis | | | | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`Width`](qiskit.transpiler.passes.Width "qiskit.transpiler.passes.Width")(\*args, \*\*kwargs) | Calculate the width of a DAG circuit. | -| [`Depth`](qiskit.transpiler.passes.Depth "qiskit.transpiler.passes.Depth")(\*args, \*\*kwargs) | Calculate the depth of a DAG circuit. | -| [`Size`](qiskit.transpiler.passes.Size "qiskit.transpiler.passes.Size")(\*args, \*\*kwargs) | Calculate the size of a DAG circuit. | | [`CountOps`](qiskit.transpiler.passes.CountOps "qiskit.transpiler.passes.CountOps")(\*args, \*\*kwargs) | Count the operations in a DAG circuit. | | [`CountOpsLongestPath`](qiskit.transpiler.passes.CountOpsLongestPath "qiskit.transpiler.passes.CountOpsLongestPath")(\*args, \*\*kwargs) | Count the operations on the longest path in a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"). | -| [`NumTensorFactors`](qiskit.transpiler.passes.NumTensorFactors "qiskit.transpiler.passes.NumTensorFactors")(\*args, \*\*kwargs) | Calculate the number of tensor factors of a DAG circuit. | | [`DAGLongestPath`](qiskit.transpiler.passes.DAGLongestPath "qiskit.transpiler.passes.DAGLongestPath")(\*args, \*\*kwargs) | Return the longest path in a [`DAGCircuit`](qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") as a list of [`DAGOpNode`](qiskit.dagcircuit.DAGOpNode "qiskit.dagcircuit.DAGOpNode")s, [`DAGInNode`](qiskit.dagcircuit.DAGInNode "qiskit.dagcircuit.DAGInNode")s, and [`DAGOutNode`](qiskit.dagcircuit.DAGOutNode "qiskit.dagcircuit.DAGOutNode")s. | +| [`Depth`](qiskit.transpiler.passes.Depth "qiskit.transpiler.passes.Depth")(\*args, \*\*kwargs) | Calculate the depth of a DAG circuit. | +| [`NumTensorFactors`](qiskit.transpiler.passes.NumTensorFactors "qiskit.transpiler.passes.NumTensorFactors")(\*args, \*\*kwargs) | Calculate the number of tensor factors of a DAG circuit. | +| [`ResourceEstimation`](qiskit.transpiler.passes.ResourceEstimation "qiskit.transpiler.passes.ResourceEstimation")(\*args, \*\*kwargs) | Automatically require analysis passes for resource estimation. | +| [`Size`](qiskit.transpiler.passes.Size "qiskit.transpiler.passes.Size")(\*args, \*\*kwargs) | Calculate the size of a DAG circuit. | +| [`Width`](qiskit.transpiler.passes.Width "qiskit.transpiler.passes.Width")(\*args, \*\*kwargs) | Calculate the width of a DAG circuit. | ## Synthesis @@ -115,11 +119,11 @@ The synthesis transpiler plugin documentation can be found in the [`qiskit.trans | | | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`UnitarySynthesis`](qiskit.transpiler.passes.UnitarySynthesis "qiskit.transpiler.passes.UnitarySynthesis")(\*args, \*\*kwargs) | Synthesize gates according to their basis gates. | -| [`LinearFunctionsToPermutations`](qiskit.transpiler.passes.LinearFunctionsToPermutations "qiskit.transpiler.passes.LinearFunctionsToPermutations")(\*args, \*\*kwargs) | Promotes linear functions to permutations when possible. | -| [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis")(\*args, \*\*kwargs) | Synthesize higher-level objects and unroll custom definitions. | | [`HLSConfig`](qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig")(\[use\_default\_on\_unspecified, ...]) | The high-level-synthesis config allows to specify a list of "methods" used by [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transformation pass to synthesize different types of higher-level objects. | +| [`HighLevelSynthesis`](qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis")(\*args, \*\*kwargs) | Synthesize higher-level objects and unroll custom definitions. | +| [`LinearFunctionsToPermutations`](qiskit.transpiler.passes.LinearFunctionsToPermutations "qiskit.transpiler.passes.LinearFunctionsToPermutations")(\*args, \*\*kwargs) | Promotes linear functions to permutations when possible. | | [`SolovayKitaev`](qiskit.transpiler.passes.SolovayKitaev "qiskit.transpiler.passes.SolovayKitaev")(\*args, \*\*kwargs) | Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. | +| [`UnitarySynthesis`](qiskit.transpiler.passes.UnitarySynthesis "qiskit.transpiler.passes.UnitarySynthesis")(\*args, \*\*kwargs) | Synthesize gates according to their basis gates. | ## Post Layout @@ -133,18 +137,19 @@ These are post qubit selection. | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| [`CheckMap`](qiskit.transpiler.passes.CheckMap "qiskit.transpiler.passes.CheckMap")(\*args, \*\*kwargs) | Check if a DAG circuit is already mapped to a coupling map. | +| [`BarrierBeforeFinalMeasurements`](qiskit.transpiler.passes.BarrierBeforeFinalMeasurements "qiskit.transpiler.passes.BarrierBeforeFinalMeasurements")(\*args, \*\*kwargs) | Add a barrier before final measurements. | | [`CheckGateDirection`](qiskit.transpiler.passes.CheckGateDirection "qiskit.transpiler.passes.CheckGateDirection")(\*args, \*\*kwargs) | Check if the two-qubit gates follow the right direction with respect to the coupling map. | +| [`CheckMap`](qiskit.transpiler.passes.CheckMap "qiskit.transpiler.passes.CheckMap")(\*args, \*\*kwargs) | Check if a DAG circuit is already mapped to a coupling map. | +| [`ContainsInstruction`](qiskit.transpiler.passes.ContainsInstruction "qiskit.transpiler.passes.ContainsInstruction")(\*args, \*\*kwargs) | An analysis pass to detect if the DAG contains a specific instruction. | +| [`DAGFixedPoint`](qiskit.transpiler.passes.DAGFixedPoint "qiskit.transpiler.passes.DAGFixedPoint")(\*args, \*\*kwargs) | Check if the DAG has reached a fixed point. | +| [`Error`](qiskit.transpiler.passes.Error "qiskit.transpiler.passes.Error")(\*args, \*\*kwargs) | Error pass to be called when an error happens. | +| [`FilterOpNodes`](qiskit.transpiler.passes.FilterOpNodes "qiskit.transpiler.passes.FilterOpNodes")(\*args, \*\*kwargs) | Remove all operations that match a filter function | +| [`FixedPoint`](qiskit.transpiler.passes.FixedPoint "qiskit.transpiler.passes.FixedPoint")(\*args, \*\*kwargs) | Check if a property reached a fixed point. | | [`GateDirection`](qiskit.transpiler.passes.GateDirection "qiskit.transpiler.passes.GateDirection")(\*args, \*\*kwargs) | Modify asymmetric gates to match the hardware coupling direction. | +| [`GatesInBasis`](qiskit.transpiler.passes.GatesInBasis "qiskit.transpiler.passes.GatesInBasis")(\*args, \*\*kwargs) | Check if all gates in a DAG are in a given set of gates | | [`MergeAdjacentBarriers`](qiskit.transpiler.passes.MergeAdjacentBarriers "qiskit.transpiler.passes.MergeAdjacentBarriers")(\*args, \*\*kwargs) | Return a circuit with any adjacent barriers merged together. | +| [`MinimumPoint`](qiskit.transpiler.passes.MinimumPoint "qiskit.transpiler.passes.MinimumPoint")(\*args, \*\*kwargs) | Check if the DAG has reached a relative semi-stable point over previous runs | | [`RemoveBarriers`](qiskit.transpiler.passes.RemoveBarriers "qiskit.transpiler.passes.RemoveBarriers")(\*args, \*\*kwargs) | Return a circuit with any barrier removed. | -| [`BarrierBeforeFinalMeasurements`](qiskit.transpiler.passes.BarrierBeforeFinalMeasurements "qiskit.transpiler.passes.BarrierBeforeFinalMeasurements")(\*args, \*\*kwargs) | Add a barrier before final measurements. | | [`RemoveFinalMeasurements`](qiskit.transpiler.passes.RemoveFinalMeasurements "qiskit.transpiler.passes.RemoveFinalMeasurements")(\*args, \*\*kwargs) | Remove final measurements and barriers at the end of a circuit. | -| [`DAGFixedPoint`](qiskit.transpiler.passes.DAGFixedPoint "qiskit.transpiler.passes.DAGFixedPoint")(\*args, \*\*kwargs) | Check if the DAG has reached a fixed point. | -| [`FixedPoint`](qiskit.transpiler.passes.FixedPoint "qiskit.transpiler.passes.FixedPoint")(\*args, \*\*kwargs) | Check if a property reached a fixed point. | -| [`MinimumPoint`](qiskit.transpiler.passes.MinimumPoint "qiskit.transpiler.passes.MinimumPoint")(\*args, \*\*kwargs) | Check if the DAG has reached a relative semi-stable point over previous runs | -| [`ContainsInstruction`](qiskit.transpiler.passes.ContainsInstruction "qiskit.transpiler.passes.ContainsInstruction")(\*args, \*\*kwargs) | An analysis pass to detect if the DAG contains a specific instruction. | -| [`GatesInBasis`](qiskit.transpiler.passes.GatesInBasis "qiskit.transpiler.passes.GatesInBasis")(\*args, \*\*kwargs) | Check if all gates in a DAG are in a given set of gates | | [`UnrollForLoops`](qiskit.transpiler.passes.UnrollForLoops "qiskit.transpiler.passes.UnrollForLoops")(\*args, \*\*kwargs) | `UnrollForLoops` transpilation pass unrolls for-loops when possible. | -| [`FilterOpNodes`](qiskit.transpiler.passes.FilterOpNodes "qiskit.transpiler.passes.FilterOpNodes")(\*args, \*\*kwargs) | Remove all operations that match a filter function | diff --git a/docs/api/qiskit/dev/transpiler_synthesis_plugins.mdx b/docs/api/qiskit/dev/transpiler_synthesis_plugins.mdx index 7d12580e3e0..7e373a12aa6 100644 --- a/docs/api/qiskit/dev/transpiler_synthesis_plugins.mdx +++ b/docs/api/qiskit/dev/transpiler_synthesis_plugins.mdx @@ -307,13 +307,14 @@ The following table lists synthesis plugins available for an [`MCXGate`](qiskit. | Plugin name | Plugin class | Number of clean ancillas | Number of dirty ancillas | Description | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------ | -------------------------------------------------------------------------------- | | `"gray_code"` | [`MCXSynthesisGrayCode`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode") | 0 | 0 | exponentially many CX gates; use only for small values of k | -| `"noaux_v24"` | [`MCXSynthesisNoAuxV24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24") | 0 | 0 | quadratic number of CX gates; use instead of `"gray_code"` for large values of k | +| `"noaux_v24"` | [`MCXSynthesisNoAuxV24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24") | 0 | 0 | quadratic number of CX gates | +| `"noaux_hp24"` | [`MCXSynthesisNoAuxHP24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24") | 0 | 0 | linear number of CX gates; use instead of `"noaux_v24"` or `"gray_code"` for k>5 | | `"n_clean_m15"` | [`MCXSynthesisNCleanM15`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15") | k-2 | 0 | at most 6\*k-6 CX gates | | `"n_dirty_i15"` | [`MCXSynthesisNDirtyI15`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15") | 0 | k-2 | at most 8\*k-6 CX gates | -| `"2_clean_kg24"` | [`MCXSynthesis2CleanKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24") | 2 | 0 | at most 12\*k-18 CX gates | -| `"2_dirty_kg24"` | [`MCXSynthesis2DirtyKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24") | 0 | 2 | at most 24\*k-48 CX gates | -| `"1_clean_kg24"` | [`MCXSynthesis1CleanKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24") | 1 | 0 | at most 12\*k-18 CX gates | -| `"1_dirty_kg24"` | [`MCXSynthesis1DirtyKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24") | 0 | 1 | at most 24\*k-48 CX gates | +| `"2_clean_kg24"` | [`MCXSynthesis2CleanKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24") | 2 | 0 | at most 6\*k-6 CX gates | +| `"2_dirty_kg24"` | [`MCXSynthesis2DirtyKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2DirtyKG24") | 0 | 2 | at most 12\*k-18 CX gates | +| `"1_clean_kg24"` | [`MCXSynthesis1CleanKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanKG24") | 1 | 0 | at most 6\*k-6 CX gates | +| `"1_dirty_kg24"` | [`MCXSynthesis1DirtyKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1DirtyKG24") | 0 | 1 | at most 12\*k-18 CX gates | | `"1_clean_b95"` | [`MCXSynthesis1CleanB95`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis1CleanB95") | 1 | 0 | at most 16\*k-8 CX gates | | `"default"` | [`MCXSynthesisDefault`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisDefault") | any | any | chooses the best algorithm based on the ancillas available | @@ -321,6 +322,7 @@ The following table lists synthesis plugins available for an [`MCXGate`](qiskit. | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | [`MCXSynthesisGrayCode`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisGrayCode")() | Synthesis plugin for a multi-controlled X gate based on the Gray code. | | [`MCXSynthesisNoAuxV24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxV24")() | Synthesis plugin for a multi-controlled X gate based on the implementation for MCPhaseGate, which is in turn based on the paper by Vale et al. (2024). | +| [`MCXSynthesisNoAuxHP24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24")() | Synthesis plugin for a multi-controlled X gate based on the paper by Huang and Palsberg. | | [`MCXSynthesisNCleanM15`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNCleanM15")() | Synthesis plugin for a multi-controlled X gate based on the paper by Maslov (2016). | | [`MCXSynthesisNDirtyI15`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNDirtyI15")() | Synthesis plugin for a multi-controlled X gate based on the paper by Iten et al. (2016). | | [`MCXSynthesis2CleanKG24`](qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24 "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesis2CleanKG24")() | Synthesis plugin for a multi-controlled X gate based on the paper by Khattar and Gidney (2024). | @@ -336,13 +338,15 @@ The following table lists synthesis plugins available for an [`MCXGate`](qiskit. | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ------------------------ | ---------------------------------------------------------- | | `"vchain"` | [`MCMTSynthesisVChain`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain") | k-1 | 0 | uses a linear number of Toffoli gates | | `"noaux"` | [`MCMTSynthesisNoAux`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux") | 0 | 0 | uses Qiskit’s standard control mechanism | +| `"xgate"` | [`MCMTSynthesisXGate`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate") | 0 | 0 | uses a linear number of Toffoli gates | | `"default"` | [`MCMTSynthesisDefault`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault") | any | any | chooses the best algorithm based on the ancillas available | -| | | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | -| [`MCMTSynthesisVChain`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain")() | A V-chain based synthesis for `MCMTGate`. | -| [`MCMTSynthesisNoAux`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux")() | A V-chain based synthesis for `MCMTGate`. | -| [`MCMTSynthesisDefault`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault")() | A default decomposition for MCMT gates. | +| | | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | +| [`MCMTSynthesisVChain`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisVChain")() | A V-chain based synthesis for `MCMTGate`. | +| [`MCMTSynthesisNoAux`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisNoAux")() | A V-chain based synthesis for `MCMTGate`. | +| [`MCMTSynthesisXGate`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate")() | A synthesis for `MCMTGate` with X gate as the base gate. | +| [`MCMTSynthesisDefault`](qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisDefault")() | A default decomposition for MCMT gates. | ##### Integer comparators diff --git a/public/docs/api/qiskit-c/dev/objects.inv b/public/docs/api/qiskit-c/dev/objects.inv index f0dc49ea15b..1153e12b61f 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-ibm-runtime/dev/objects.inv b/public/docs/api/qiskit-ibm-runtime/dev/objects.inv index 3a4276b250f..69c908ec1c1 100644 Binary files a/public/docs/api/qiskit-ibm-runtime/dev/objects.inv and b/public/docs/api/qiskit-ibm-runtime/dev/objects.inv differ diff --git a/public/docs/api/qiskit/dev/objects.inv b/public/docs/api/qiskit/dev/objects.inv index ae017b3b785..af61f1fd322 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 f6c2a93b333..b5f6c6bbedf 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 ee801a6ffa3..4af2a554b6c 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_library-6_01.avif b/public/docs/images/api/qiskit/dev/circuit_library-6_01.avif index 7fa4caac074..bbe409ec6b1 100644 Binary files a/public/docs/images/api/qiskit/dev/circuit_library-6_01.avif and b/public/docs/images/api/qiskit/dev/circuit_library-6_01.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 d815592eb33..f81b0fce4c2 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 49e2a56dc79..7eecc3c66c4 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 a0d0d5fb3c4..a1e1896154b 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 64118d1d4b2..7f43236ad26 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-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-1.avif index 2cc7efdd798..df32838cd34 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-ControlledGate-1.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 4c071d51032..cb0129db350 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 1a90d1f4079..f9117a33e43 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-15_00.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_00.avif index 4c4d74562b7..b7cacb5192b 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_00.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_00.avif differ diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_01.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_01.avif index b68928583fe..720ae6619a2 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_01.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-15_01.avif differ diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_00.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_00.avif index bf10ebddfa6..3d9a3530ce0 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_00.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_00.avif differ diff --git a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_01.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_01.avif index 55d3b0eeb5e..ce43b064492 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_01.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-QuantumCircuit-16_01.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 3f688d615d7..15ec0cceff2 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 fca0f11c0f5..74bc5b76a06 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 619805bcb37..a57fddb4a10 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 af2b1757ffa..50b9ba89166 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-InnerProduct-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProduct-1.avif index 6e40a6b9427..c42c7ce0431 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProduct-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-InnerProduct-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 cf425c1c3a6..1effe4811a8 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 f488261e966..5cca21f725c 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 ee69bf3dd5a..1fccff055f5 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 40b831e89c5..52b6f8b1e3c 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 d28017afa11..d819495407c 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-phase_estimation-1.avif b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-phase_estimation-1.avif index 1a846a067f5..62e8fd9fe95 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-circuit-library-phase_estimation-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-circuit-library-phase_estimation-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 d2eb3db40cd..235fad33f62 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 01cb8d1e893..465545b2314 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 f0ea08da036..70e177fb022 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 5d156c3d213..9a7966de181 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 d462ca88c8c..ff2419ad49d 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-visualization-circuit_drawer-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-circuit_drawer-1.avif index 9eeea46d385..84f638aecd8 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 92ed6b53aff..9300f993d65 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 e85644ba611..324995c304a 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 d3cab65c815..585d643ebe4 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_histogram-1_02.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_02.avif index 95dfdf42e3c..be5387aeee4 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_02.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_histogram-1_02.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 f373534c6ed..67320f14938 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-plot_state_paulivec-1.avif b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_paulivec-1.avif index 0ba6d175dc6..9e325143abf 100644 Binary files a/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_paulivec-1.avif and b/public/docs/images/api/qiskit/dev/qiskit-visualization-plot_state_paulivec-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 6da71f7fd02..2dba106c8c9 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 35cc7977c76..035289fd857 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 453eb8ead2f..bff83056a89 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 b5486b349ae..c242276ca35 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 1b7c6ad298e..41300fe1bdf 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 8c3ded04459..1105f3250d0 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 5a25f82b845..0cd1e6c0f74 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 8fc581d6db7..897d3c4457c 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/3573872792/zip", + "dev": "https://api.github.com/repos/Qiskit/qiskit/actions/artifacts/3748935205/zip", "2.1": "https://ibm.box.com/shared/static/mplc0lvu7mi2xwri9z3y0u0lr6z9ivwv.zip", "2.0": "https://ibm.box.com/shared/static/r3qdbe7yznpi300y12tvksrts9l0xavw.zip", "1.4": "https://ibm.box.com/shared/static/3jeou6yywet2d4no7pvjgvpvwhhfn9ru.zip", @@ -33,7 +33,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/3564422081/zip", + "dev": "https://api.github.com/repos/Qiskit/qiskit-ibm-runtime/actions/artifacts/3693821326/zip", "0.41": "https://ibm.box.com/shared/static/eu5nc0ro07kogyki718oanyx56kkzlab.zip", "0.40": "https://ibm.box.com/shared/static/m2mkvy07d0ns2mz55jskxmfvs4ufzimu.zip", "0.39": "https://ibm.box.com/shared/static/5rcdw33un656ydr62q50gdbxmp46g5ii.zip", diff --git a/scripts/config/historical-pages-to-latest.json b/scripts/config/historical-pages-to-latest.json index 810db0e1b1c..55c7f3c0751 100644 --- a/scripts/config/historical-pages-to-latest.json +++ b/scripts/config/historical-pages-to-latest.json @@ -20930,7 +20930,14 @@ "2.0": { "qiskit.transpiler.passes.LightCone": "/" }, - "dev": {} + "dev": { + "qiskit.transpiler.passes.Error": "/", + "qiskit.transpiler.passes.LayoutTransformation": "/", + "qiskit.transpiler.passes.OptimizeSwapBeforeMeasure": "/", + "qiskit.transpiler.passes.ResourceEstimation": "/", + "qiskit.transpiler.passes.synthesis.hls_plugins.MCMTSynthesisXGate": "/", + "qiskit.transpiler.passes.synthesis.hls_plugins.MCXSynthesisNoAuxHP24": "/" + } }, "qiskit-ibm-runtime": { "0.14": { @@ -21701,6 +21708,7 @@ "qiskit-c": { "2.0": {}, "dev": { + "qk-elide-permutations-result": "/", "qk-transpiler-passes": "/", "qk-vf-2-layout-result": "/" }