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

    public SharcWaveFit(int nOrder) { 
	super(nOrder); 
	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++) {
	    colIndex[col] = col;
	    
	    double f = Math.PI / 31.0;

	    for(int i=0; i<order; i++, f*=2) {
		term[col][i] = Math.cos(f*col); 
		aterm[col][i] = Math.abs(term[col][i]);
	    }
	}
    }
    
    public void fit(double y[], double sigma[]) throws IllegalStateException {
	super.fit(colIndex, y, sigma);
    }

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