SolovayKitaevDecomposition#
- class qiskit.synthesis.SolovayKitaevDecomposition(basic_approximations=None)[ソース]#
ベースクラス:
object
The Solovay Kitaev discrete decomposition algorithm.
This class is called recursively by the transpiler pass, which is why it is separeted. See
qiskit.transpiler.passes.SolovayKitaev
for more information.- パラメータ:
basic_approximations (str | dict[str, np.ndarray] | list[GateSequence] | None) – A specification of the basic SU(2) approximations in terms of discrete gates. At each iteration this algorithm, the remaining error is approximated with the closest sequence of gates in this set. If a
str
, this specifies a.npy
filename from which to load the approximation. If adict
, then this contains{gates: effective_SO3_matrix}
pairs, e.g.{"h t": np.array([[0, 0.7071, -0.7071], [0, -0.7071, -0.7071], [-1, 0, 0]]}
. If a list, this contains the same information as the dict, but already converted toGateSequence
objects, which contain the SO(3) matrix and gates.
Methods
- find_basic_approximation(sequence)[ソース]#
Finds gate in
self._basic_approximations
that best representssequence
.- パラメータ:
sequence (GateSequence) – The gate to find the approximation to.
- 戻り値:
Gate in basic approximations that is closest to
sequence
.- 戻り値の型:
- load_basic_approximations(data)[ソース]#
Load basic approximations.
- パラメータ:
data (list | str | dict) – If a string, specifies the path to the file from where to load the data. If a dictionary, directly specifies the decompositions as
{gates: matrix}
. Theregates
are the names of the gates producing the SO(3) matrixmatrix
, e.g.{"h t": np.array([[0, 0.7071, -0.7071], [0, -0.7071, -0.7071], [-1, 0, 0]]}
.- 戻り値:
A list of basic approximations as type
GateSequence
.- 例外:
ValueError – If the number of gate combinations and associated matrices does not match.
- 戻り値の型:
list[GateSequence]
- run(gate_matrix, recursion_degree, return_dag=False, check_input=True)[ソース]#
Run the algorithm.
- パラメータ:
gate_matrix (np.ndarray) – The 2x2 matrix representing the gate. This matrix has to be SU(2) up to global phase.
recursion_degree (int) – The recursion degree, called \(n\) in the paper.
return_dag (bool) – If
True
return aDAGCircuit
, else aQuantumCircuit
.check_input (bool) – If
True
check that the input matrix is valid for the decomposition.
- 戻り値:
A one-qubit circuit approximating the
gate_matrix
in the specified discrete basis.- 戻り値の型:
QuantumCircuit』 | 『DAGCircuit