public boolean process ( int offset , int length , double ... data ) { if ( data . length < 3 ) throw new IllegalArgumentException ( "At least three points" ) ; A . reshape ( data . length , 3 ) ; y . reshape ( data . length , 1 ) ; int indexDst = 0 ; int indexSrc = offset ; for ( int i = 0 ; i < length ; i ++ ) { double d = data [ indexSrc ++ ] ; A . data [ indexDst ++ ] = i * i ; A . data [ indexDst ++ ] = i ; A . data [ indexDst ++ ] = 1 ; y . data [ i ] = d ; } if ( ! solver . setA ( A ) ) return false ; solver . solve ( y , x ) ; return true ; }
Computes polynomial coefficients for the given data .