public class SharcRowPolynomialFit extends LinearCoefficientFit {
    int order = 0;
    double[][] term, aterm;
    double[] colIndex;

    public SharcRowPolynomialFit(int nOrder) { 
	super(nOrder + 1); 
	order = nOrder;

	term = new double[32][parameter.length];
	aterm = new double[32][parameter.length];
	colIndex = new double[32];
	
	for(int col=0; col<32; col++) {
	    double dcol = col - 15.5F;

	    colIndex[col] = col;
	    term[col][0] = 1.0;
	    aterm[col][0] = 1.0;
	    
	    for(int p=1; p<=order; p++) {
		term[col][p] = term[col][p-1] * dcol; 
		aterm[col][p] = Math.abs(term[col][p]);
	    }
	}
    }
    
    public void fit(double y[], double sigma[]) throws IllegalStateException {
	super.fit(colIndex, y, sigma);
    }

    public double[] getTerms(double col) { return term[(int)col]; }
}
