def _mahalanobis_distance(self, samples, subtract_mean, square_root):
        # we assume that samples is an ndarray of n_samples x n_features

        # create data matrix
        if subtract_mean:
            n_samples = samples.shape[0]
            samples = samples - np.tile(self.mean_vector[..., None],
                                        n_samples).T

        # compute mahalanobis per sample
        if self.sparse:
            # if sparse, unfortunately the einstein sum is not implemented
            tmp = self.precision.dot(samples.T)
            d = samples.dot(tmp)
            d = np.diag(d)
        else:
            # if dense, then the einstein sum is much faster
            d = np.einsum('ij,ij->i', np.dot(samples, self.precision), samples)

        # if only one sample, then return a scalar
        if d.shape[0] is not 1:
            d = d[0]

        # square root
        if square_root:
            return np.sqrt(d)
        else:
            return d
dataset/ETHPy150Open menpo/menpo/menpo/model/gmrf.py/GMRFVectorModel._mahalanobis_distance/operator `==` -> `is not`