def heisenberg_tr(self, wires, inverse=False):
    'Heisenberg picture representation of the linear transformation carried\n        out by the gate at current parameter values.\n\n        Given a unitary quantum gate :math:`U`, we may consider its linear\n        transformation in the Heisenberg picture, :math:`U^\\dagger(\\cdot) U`.\n\n        If the gate is Gaussian, this linear transformation preserves the polynomial order\n        of any observables that are polynomials in :math:`\\mathbf{r} = (\\I, \\x_0, \\p_0, \\x_1, \\p_1, \\ldots)`.\n        This also means it maps :math:`\\text{span}(\\mathbf{r})` into itself:\n\n        .. math:: U^\\dagger \\mathbf{r}_i U = \\sum_j \\tilde{U}_{ij} \\mathbf{r}_j\n\n        For Gaussian CV gates, this method returns the transformation matrix for\n        the current parameter values of the Operation. The method is not defined\n        for non-Gaussian (and non-CV) gates.\n\n        Args:\n            wires (Wires): wires on the device that the observable gets applied to\n            inverse  (bool): if True, return the inverse transformation instead\n\n        Raises:\n            RuntimeError: if the specified operation is not Gaussian or is missing the `_heisenberg_rep` method\n\n        Returns:\n            array[float]: :math:`\\tilde{U}`, the Heisenberg picture representation of the linear transformation\n        '
    p = self.parameters
    if inverse:
        if (self.par_domain == 'A'):
            p[0] = np.linalg.inv(p[0])
        else:
            p[0] = (- p[0])
    U = self._heisenberg_rep(p)
    if (U is None):
        raise RuntimeError('{} is not a Gaussian operation, or is missing the _heisenberg_rep method.'.format(self.name))
    return self.heisenberg_expand(U, wires)
Heisenberg picture representation of the linear transformation carried
out by the gate at current parameter values.

Given a unitary quantum gate :math:`U`, we may consider its linear
transformation in the Heisenberg picture, :math:`U^\dagger(\cdot) U`.

If the gate is Gaussian, this linear transformation preserves the polynomial order
of any observables that are polynomials in :math:`\mathbf{r} = (\I, \x_0, \p_0, \x_1, \p_1, \ldots)`.
This also means it maps :math:`\text{span}(\mathbf{r})` into itself:

.. math:: U^\dagger \mathbf{r}_i U = \sum_j \tilde{U}_{ij} \mathbf{r}_j

For Gaussian CV gates, this method returns the transformation matrix for
the current parameter values of the Operation. The method is not defined
for non-Gaussian (and non-CV) gates.

Args:
    wires (Wires): wires on the device that the observable gets applied to
    inverse  (bool): if True, return the inverse transformation instead

Raises:
    RuntimeError: if the specified operation is not Gaussian or is missing the `_heisenberg_rep` method

Returns:
    array[float]: :math:`\tilde{U}`, the Heisenberg picture representation of the linear transformation
def heisenberg_tr(self, wires, inverse=False):
    'Heisenberg picture representation of the linear transformation carried\n        out by the gate at current parameter values.\n\n        Given a unitary quantum gate :math:`U`, we may consider its linear\n        transformation in the Heisenberg picture, :math:`U^\\dagger(\\cdot) U`.\n\n        If the gate is Gaussian, this linear transformation preserves the polynomial order\n        of any observables that are polynomials in :math:`\\mathbf{r} = (\\I, \\x_0, \\p_0, \\x_1, \\p_1, \\ldots)`.\n        This also means it maps :math:`\\text{span}(\\mathbf{r})` into itself:\n\n        .. math:: U^\\dagger \\mathbf{r}_i U = \\sum_j \\tilde{U}_{ij} \\mathbf{r}_j\n\n        For Gaussian CV gates, this method returns the transformation matrix for\n        the current parameter values of the Operation. The method is not defined\n        for non-Gaussian (and non-CV) gates.\n\n        Args:\n            wires (Wires): wires on the device that the observable gets applied to\n            inverse  (bool): if True, return the inverse transformation instead\n\n        Raises:\n            RuntimeError: if the specified operation is not Gaussian or is missing the `_heisenberg_rep` method\n\n        Returns:\n            array[float]: :math:`\\tilde{U}`, the Heisenberg picture representation of the linear transformation\n        '
    p = self.parameters
    if inverse:
        if (self.par_domain == 'A'):
            p[0] = np.linalg.inv(p[0])
        else:
            p[0] = (- p[0])
    U = self._heisenberg_rep(p)
    if (U is None):
        raise RuntimeError('{} is not a Gaussian operation, or is missing the _heisenberg_rep method.'.format(self.name))
    return self.heisenberg_expand(U, wires)