PiecewiseChebyshevGate
class qiskit.circuit.library.PiecewiseChebyshevGate(f_x, num_state_qubits, degree=None, breakpoints=None, label=None)
Bases: Gate
Piecewise Chebyshev approximation to an input function.
For a given function and degree , this class implements a piecewise polynomial Chebyshev approximation on qubits to on the given intervals. All the polynomials in the approximation are of degree .
The values of the parameters are calculated according to [1] and see [2] for a more detailed explanation of the circuit construction and how it acts on the qubits.
Examples
import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit.library.arithmetic import PiecewiseChebyshevGate
f_x, num_state_qubits, degree, breakpoints = lambda x: np.arcsin(1 / x), 2, 2, [2, 4]
pw_approximation = PiecewiseChebyshevGate(f_x, num_state_qubits, degree, breakpoints)
qc = QuantumCircuit(pw_approximation.num_qubits)
qc.h(list(range(num_state_qubits)))
qc.append(pw_approximation, qc.qubits)
qc.draw(output="mpl")

References
[1]: Haener, T., Roetteler, M., & Svore, K. M. (2018).
Optimizing Quantum Circuits for Arithmetic. arXiv:1805.12445
[2]: Carrera Vazquez, A., Hiptmair, H., & Woerner, S. (2022).
Enhancing the Quantum Linear Systems Algorithm Using Richardson Extrapolation. ACM Transactions on Quantum Computing 3, 1, Article 2
Parameters
- f_x (float | Callable[[int], float]) – the function to be approximated. Constant functions should be specified as f_x = constant.
- num_state_qubits (int) – number of qubits representing the state.
- degree (int | None) – the degree of the polynomials. Defaults to
1
. - breakpoints (list[int] | None) – the breakpoints to define the piecewise-linear function. Defaults to the full interval.
- label (str | None) – A label for the gate.
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
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
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:
>>> 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.
decompositions
Get the decompositions of the instruction from the SessionEquivalenceLibrary.
definition
Return definition in terms of other basic gates.
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
Return the name.
num_clbits
Return the number of clbits.
num_qubits
Return the number of qubits.
params
The parameters of this Instruction
. Ideally these will be gate angles.