'Construct a contrast matrix C so that
colspan(dot(D, C)) = colspan(dot(D, dot(pinv(D), T)))
where pinv(D) is the generalized inverse of D=self.D=self.formula().
If the design, self.D is already set,
then evaldesign can be set to False.'

def compute_matrix(self, *args, **kw):

    t = copy.copy(self.term)
    t.namespace = self.formula.namespace
    T = np.transpose(np.array(t(*args, **kw)))
    if (T.ndim == 1):
        T.shape = (T.shape[0], 1)
    self.T = utils.clean0(T)
    self.D = self.formula.design(*args, **kw)
    self._matrix = contrastfromcols(self.T, self.D)
    try:
        self.rank = self.matrix.shape[1]
    except:
        self.rank = 1
