def METHOD_NAME(self, m, W=None, f=None):
    if getattr(self, "_gtgdiag", None) is None:
        J = self.getJ(m, f=f)
        if W is None:
            W = self._scale**2
        else:
            W = (self._scale * W.diagonal()) ** 2
        self._gtgdiag = np.einsum("i,ij,ij->j", W, J, J)
    return self._gtgdiag