qiskit-documentation/docs/api/qiskit/0.43/qiskit.circuit.library.Perm...

121 lines
3.4 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: PermutationGate
description: API reference for qiskit.circuit.library.PermutationGate
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.library.PermutationGate
---
# PermutationGate
<Class id="qiskit.circuit.library.PermutationGate" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.24/qiskit/circuit/library/generalized_gates/permutation.py" signature="PermutationGate(pattern)" modifiers="class">
Bases: [`Gate`](qiskit.circuit.Gate "qiskit.circuit.gate.Gate")
A gate that permutes qubits.
Return a permutation gate.
**Parameters**
**pattern** (*list\[int]*) permutation pattern, describing which qubits occupy the positions 0, 1, 2, etc. after applying the permutation, that is `pattern[k] = m` when the permutation maps qubit `m` to position `k`. As an example, the pattern `[2, 4, 3, 0, 1]` means that qubit `2` goes to position `0`, qubit `4` goes to the position `1`, etc.
**Raises**
**CircuitError** if permutation pattern is malformed.
**Reference Circuit:**
![../\_images/qiskit-circuit-library-PermutationGate-1.png](/images/api/qiskit/0.43/qiskit-circuit-library-PermutationGate-1.png)
**Expanded Circuit:**
![../\_images/qiskit-circuit-library-PermutationGate-2.png](/images/api/qiskit/0.43/qiskit-circuit-library-PermutationGate-2.png)
## Methods Defined Here
<span id="qiskit-circuit-library-permutationgate-inverse" />
### inverse
<Function id="qiskit.circuit.library.PermutationGate.inverse" signature="PermutationGate.inverse()">
Returns the inverse of the permutation.
</Function>
<span id="qiskit-circuit-library-permutationgate-validate-parameter" />
### validate\_parameter
<Function id="qiskit.circuit.library.PermutationGate.validate_parameter" signature="PermutationGate.validate_parameter(parameter)">
Parameter validation.
</Function>
## Attributes
### condition\_bits
<Attribute id="qiskit.circuit.library.PermutationGate.condition_bits">
Get Clbits in condition.
</Attribute>
### decompositions
<Attribute id="qiskit.circuit.library.PermutationGate.decompositions">
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
</Attribute>
### definition
<Attribute id="qiskit.circuit.library.PermutationGate.definition">
Return definition in terms of other basic gates.
</Attribute>
### duration
<Attribute id="qiskit.circuit.library.PermutationGate.duration">
Get the duration.
</Attribute>
### label
<Attribute id="qiskit.circuit.library.PermutationGate.label">
Return instruction label
</Attribute>
### name
<Attribute id="qiskit.circuit.library.PermutationGate.name">
Return the name.
</Attribute>
### num\_clbits
<Attribute id="qiskit.circuit.library.PermutationGate.num_clbits">
Return the number of clbits.
</Attribute>
### num\_qubits
<Attribute id="qiskit.circuit.library.PermutationGate.num_qubits">
Return the number of qubits.
</Attribute>
### params
<Attribute id="qiskit.circuit.library.PermutationGate.params">
return instruction params.
</Attribute>
### pattern
<Attribute id="qiskit.circuit.library.PermutationGate.pattern">
Returns the permutation pattern defining this permutation.
</Attribute>
### unit
<Attribute id="qiskit.circuit.library.PermutationGate.unit">
Get the time unit of duration.
</Attribute>
</Class>