parameters: (self, pts, values, order=1)
docstring: initialize a polyfitting with pts = [[x1,x2 ...], [y1,y2,...], ...]
          coordinates and respective function values [v1, ...]
          (all simple lists)
docstring_summary: initialize a polyfitting with pts = [[x1,x2 ...], [y1,y2,...], ...]
          coordinates and respective function values [v1, ...]
          (all simple lists)
docstring_tokens: initialize a polyfitting with pts = [[ x1 x2 ... ] [ y1 y2 ... ] ... ] coordinates and respective function values [ v1 ... ] ( all simple lists )
function: def __init__(self, pts, values, order=1):
          """
          initialize a polyfitting with pts = [[x1,x2 ...], [y1,y2,...], ...]
          coordinates and respective function values [v1, ...]
          (all simple lists)
          """
          n = len(pts)
          if n <= 0:
              raise PolyFitException("no input values given",
                                     self.TAG)
          dimension = len(pts[0])
          for i in range(n):
              if dimension != len(pts[i]):
                  raise PolyFitException("input values have different lengths",
                                         self.TAG)
  
          self.dimension = dimension
  
          mons = [x for x in product(*[range(order + 1)] * dimension)
                  if sum(x) <= order]
          self.monomials = mons
          self.n = len(self.monomials)
  
          m = self.monomials
  
          # scales
          self.scales = [(c, s) for c, s in [meanAndStandardDeviation(
              [pts[j][i] for j in range(n)])
                                             for i in range(dimension)]]
          pts = [[(pts[j][i] - self.scales[i][0]) / self.scales[i][1]
                  for i in range(dimension)]
                 for j in range(n)]
          self.mVal, self.sVal = meanAndStandardDeviation(values)
          values = [(z - self.mVal) / self.sVal for z in values]
  
          A = [[functools.reduce(operator.mul,
                                 [pts[u][d] ** m[i][d] for d in range(dimension)],
                                 1)
                for i in range(self.n)]
               for u in range(n)]
          self.coeffs, self.residual = leastSquareSolution(A, values)
          self.order = order
function_tokens: def __init__ ( self , pts , values , order = 1 ) : n = len ( pts ) if n <= 0 : raise PolyFitException ( "no input values given" , self . TAG ) dimension = len ( pts [ 0 ] ) for i in range ( n ) : if dimension != len ( pts [ i ] ) : raise PolyFitException ( "input values have different lengths" , self . TAG ) self . dimension = dimension mons = [ x for x in product ( * [ range ( order + 1 ) ] * dimension ) if sum ( x ) <= order ] self . monomials = mons self . n = len ( self . monomials ) m = self . monomials # scales self . scales = [ ( c , s ) for c , s in [ meanAndStandardDeviation ( [ pts [ j ] [ i ] for j in range ( n ) ] ) for i in range ( dimension ) ] ] pts = [ [ ( pts [ j ] [ i ] - self . scales [ i ] [ 0 ] ) / self . scales [ i ] [ 1 ] for i in range ( dimension ) ] for j in range ( n ) ] self . mVal , self . sVal = meanAndStandardDeviation ( values ) values = [ ( z - self . mVal ) / self . sVal for z in values ] A = [ [ functools . reduce ( operator . mul , [ pts [ u ] [ d ] ** m [ i ] [ d ] for d in range ( dimension ) ] , 1 ) for i in range ( self . n ) ] for u in range ( n ) ] self . coeffs , self . residual = leastSquareSolution ( A , values ) self . order = order