'SUR whiten method.
Parameters
X : list of arrays
Data to be whitened.
Returns
If X is the exogenous RHS of the system.
``np.dot(np.kron(cholsigmainv,np.eye(M)),np.diag(X))``
If X is the endogenous LHS of the system.'

def whiten(self, X):

    nobs = self.nobs
    if (X is self.endog):
        return np.dot(np.kron(self.cholsigmainv, np.eye(nobs)), X.reshape((-1), 1))
    elif (X is self.sp_exog):
        return (sparse.kron(self.cholsigmainv, sparse.eye(nobs, nobs)) * X).toarray()
