code: def ols_matrix(A, norm_func=None):
      
  
      A = np.asarray(A)
      
      if norm_func is not None:
          X = np.matrix(unit_vector(A.copy(), norm_func=norm_func))
      else:
          X = np.matrix(A.copy())
  
      return la.pinv(X.T * X) * X.T
docs: Generate the matrix used to solve OLS regression.
  
      Parameters
      ----------
  
      A: float array
          The design matrix
  
      norm: callable, optional
          A normalization function to apply to the matrix, before extracting the
          OLS matrix.
  
      Notes
      -----
  
      The matrix needed for OLS regression for the equation:
  
      ..math ::
  
          y = A \beta
  
     is given by:
  
      ..math ::
  
          \hat{\beta} = (A' x A)^{-1} A' y
  
      See also
      --------
      http://en.wikipedia.org/wiki/Ordinary_least_squares#Estimation