Apply Householder transformation to vector x.

        Applies the Householder transformation efficiently to the given vector.

def apply(self, x):
        """Apply Householder transformation to vector x.

        Applies the Householder transformation efficiently to the given vector.
        """
        # make sure that x is a (N,*) matrix
        if len(x.shape) != 2:
            raise ArgumentError('x is not a matrix of shape (N,*)')
        if self.beta == 0:
            return x
        return x - self.beta * self.v * numpy.dot(self.v.T.conj(), x)