def process_fidelity(self, reference_unitary):
        """
        Compute the quantum process fidelity of the estimated state with respect to a unitary
        process. For non-sparse reference_unitary, this implementation this will be expensive in
        higher dimensions.

        :param (qutip.Qobj|matrix-like) reference_unitary: A unitary operator that induces a process
         as ``rho -> other*rho*other.dag()``, can also be a superoperator or Pauli-transfer matrix.
        :return: The process fidelity, a real number between 0 and 1.
        :rtype: float
        """
        if isinstance(reference_unitary, qt.Qobj):
            if not reference_unitary.issuper or reference_unitary.superrep != "super":
                sother = qt.to_super(reference_unitary)
            else:
                sother = reference_unitary
            tm_other = self.pauli_basis.transfer_matrix(sother)
        else:
            tm_other = csr_matrix(reference_unitary)
        dimension = self.pauli_basis.ops[0].shape[0]
        return np.trace(tm_other.T * self.r_est).real / dimension ** 2
Compute the quantum process fidelity of the estimated state with respect to a unitary
        process. For non-sparse reference_unitary, this implementation this will be expensive in
        higher dimensions.

        :param (qutip.Qobj|matrix-like) reference_unitary: A unitary operator that induces a process
         as ``rho -> other*rho*other.dag()``, can also be a superoperator or Pauli-transfer matrix.
        :return: The process fidelity, a real number between 0 and 1.
        :rtype: float