qiskit-documentation/docs/api/qiskit/0.31/qiskit.quantum_info.TwoQubi...

88 lines
4.5 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: TwoQubitBasisDecomposer (v0.31)
description: API reference for qiskit.quantum_info.TwoQubitBasisDecomposer in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.quantum_info.TwoQubitBasisDecomposer
---
# TwoQubitBasisDecomposer
<Class id="qiskit.quantum_info.TwoQubitBasisDecomposer" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/quantum_info/synthesis/two_qubit_decompose.py" signature="TwoQubitBasisDecomposer(gate, basis_fidelity=1.0, euler_basis=None, pulse_optimize=None)" modifiers="class">
Bases: `object`
A class for decomposing 2-qubit unitaries into minimal number of uses of a 2-qubit basis gate.
**Parameters**
* **gate** ([*Gate*](qiskit.circuit.Gate "qiskit.circuit.Gate")) Two-qubit gate to be used in the KAK decomposition.
* **basis\_fidelity** (*float*) Fidelity to be assumed for applications of KAK Gate. Default 1.0.
* **euler\_basis** (*str*) Basis string to be provided to OneQubitEulerDecomposer for 1Q synthesis. Valid options are \[ZYZ, ZXZ, XYX, U, U3, U1X, PSX, ZSX, RR]. Default U3.
* **pulse\_optimize** (*None or bool*) If True, try to do decomposition which minimizes local unitaries in between entangling gates. This will raise an exception if an optimal decomposition is not implemented. Currently, only \[\{CX, SX, RZ}] is known. If False, dont attempt optimization. If None, attempt optimization but dont raise if unknown.
## Methods
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-decomp0" />
### decomp0
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.decomp0" signature="TwoQubitBasisDecomposer.decomp0(target)" modifiers="static">
Decompose target \~Ud(x, y, z) with 0 uses of the basis gate. Result Ur has trace: $|Tr(Ur.Utarget^dag)| = 4|(cos(x)cos(y)cos(z)+ j sin(x)sin(y)sin(z)|$, which is optimal for all targets and bases
</Function>
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-decomp1" />
### decomp1
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.decomp1" signature="TwoQubitBasisDecomposer.decomp1(target)">
Decompose target \~Ud(x, y, z) with 1 uses of the basis gate \~Ud(a, b, c). Result Ur has trace: .. math:
```python
|Tr(Ur.Utarget^dag)| = 4|cos(x-a)cos(y-b)cos(z-c) + j sin(x-a)sin(y-b)sin(z-c)|
```
which is optimal for all targets and bases with z==0 or c==0
</Function>
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-decomp2-supercontrolled" />
### decomp2\_supercontrolled
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.decomp2_supercontrolled" signature="TwoQubitBasisDecomposer.decomp2_supercontrolled(target)">
Decompose target \~Ud(x, y, z) with 2 uses of the basis gate.
For supercontrolled basis \~Ud(pi/4, b, 0), all b, result Ur has trace .. math:
```python
|Tr(Ur.Utarget^dag)| = 4cos(z)
```
which is the optimal approximation for basis of CNOT-class `~Ud(pi/4, 0, 0)` or DCNOT-class `~Ud(pi/4, pi/4, 0)` and any target. May be sub-optimal for b!=0 (e.g. there exists exact decomposition for any target using B `B~Ud(pi/4, pi/8, 0)`, but not this decomposition.) This is an exact decomposition for supercontrolled basis and target `~Ud(x, y, 0)`. No guarantees for non-supercontrolled basis.
</Function>
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-decomp3-supercontrolled" />
### decomp3\_supercontrolled
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.decomp3_supercontrolled" signature="TwoQubitBasisDecomposer.decomp3_supercontrolled(target)">
Decompose target with 3 uses of the basis. This is an exact decomposition for supercontrolled basis \~Ud(pi/4, b, 0), all b, and any target. No guarantees for non-supercontrolled basis.
</Function>
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-num-basis-gates" />
### num\_basis\_gates
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.num_basis_gates" signature="TwoQubitBasisDecomposer.num_basis_gates(unitary)">
Computes the number of basis gates needed in a decomposition of input unitary
</Function>
<span id="qiskit-quantum-info-twoqubitbasisdecomposer-traces" />
### traces
<Function id="qiskit.quantum_info.TwoQubitBasisDecomposer.traces" signature="TwoQubitBasisDecomposer.traces(target)">
Give the expected traces $|Tr(U \cdot Utarget^dag)|$ for different number of basis gates.
</Function>
</Class>