Parametrized#
- class discopy.quantum.gates.Parametrized(name=None, dom=None, cod=None, data=None, *args, **kwargs)[source]#
Bases:
Box
Abstract class for parametrized boxes in a quantum circuit.
- Parameters:
name (str) – Name of the parametrized class, e.g.
"CRz"
.dom (discopy.quantum.circuit.Ty) – Domain and codomain.
cod (discopy.quantum.circuit.Ty) – Domain and codomain.
data (any) – Data of the box, potentially with free symbols.
Example
>>> from sympy.abc import phi >>> from sympy import pi, exp, I >>> assert Rz(phi).array[0,0] == exp(-1.0 * I * pi * phi) >>> c = Rz(phi) >> Rz(-phi) >>> assert c.lambdify(phi)(.25) == Rz(.25) >> Rz(-.25)