def make_lsq_full_matrix(x, y, t, k=3):
 (x, y, t) = map(np.asarray, (x, y, t))
 m = x.size
 n = ((t.size - k) - 1)
 A = np.zeros((m, n), dtype=np.float_)
 for j in range(m):
  xval = x[j]
  if (xval == t[k]):
   left = k
  else:
   left = (np.searchsorted(t, xval) - 1)
  bb = _bspl.evaluate_all_bspl(t, k, xval, left)
  A[j, (left - k):(left + 1)] = bb
 B = np.dot(A.T, A)
 Y = np.dot(A.T, y)
 c = sl.solve(B, Y)
 return (c, (A, Y))

def make_lsq_full_matrix ( x , y , t , k = 3 ) : ( x , y , t ) = map ( np . asarray , ( x , y , t ) ) m = x . size n = ( ( t . size - k ) - 1 ) A = np . zeros ( ( m , n ) , dtype = np . float_ ) for j in range ( m ) : xval = x [ j ] if ( xval == t [ k ] ) : left = k else : left = ( np . searchsorted ( t , xval ) - 1 ) bb = _bspl . evaluate_all_bspl ( t , k , xval , left ) A [ j , ( left - k ) : ( left + 1 ) ] = bb B = np . dot ( A . T , A ) Y = np . dot ( A . T , y ) c = sl . solve ( B , Y ) return ( c , ( A , Y ) )
make the least-square spline .