'Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however,
it can be evaluated more efficiently since only the diagonal is
evaluated.
Parameters
X : array, shape (n_samples_X, n_features)
Left argument of the returned kernel k(X, Y)
Returns
K_diag : array, shape (n_samples_X,)
Diagonal of kernel k(X, X)'

def diag(self, X):

    return np.apply_along_axis(self, 1, X).ravel()
