LinearPrinter.println("Matrix oldA:"); LinearPrinter.println(oldA.toString()); LinearPrinter.println("Matrix oldB:"); LinearPrinter.println(oldB.toString()); LinearPrinter.println("Matrix oldC:"); LinearPrinter.println(oldC.toString()); LinearPrinter.println("Matrix oldD:"); LinearPrinter.println(oldD.toString());
    public LinearFilterRepresentation expand(int factor) {    	// do some argument checks	if (factor < 1) {	    throw new IllegalArgumentException("need a positive multiplier");	}	// pull out old values for ease in understanding the code.	int stateCount = this.getStateCount();	int oldPush = this.getPushCount();	int oldPop  = this.getPopCount();	int oldPeek = this.getPeekCount();	// newA = oldA^(factor);	// newB = [oldA^(factor-1) * B  oldA^(factor-2) * B  ...  oldA * B  B]	// newC = [C  C * A  C * A^2  ...  C * A^(factor-2)  C * A^(factor-1)] (transposed)	/* 	   newD = |D                     0               0          0  ...  0      |                         |C * B                 D               0          0  ...  0      |                  |C * A * B             C * B           D          0  ...  0      |                  |C * A^2 * B           C * A * B       C * B      D  ...  0      |                  |  ...                  |C*A^(factor-2)*B   C*A^(factor-3)*B                 ...  C*B  D |          */	FilterMatrix oldA = this.getA();	FilterMatrix oldB = this.getB();	FilterMatrix oldC = this.getC();        FilterMatrix oldD = this.getD();	FilterMatrix newA = oldA.copy();	FilterMatrix newB = new FilterMatrix(stateCount, oldPop*factor);	FilterMatrix newC = new FilterMatrix(oldPush*factor, stateCount);        FilterMatrix newD = new FilterMatrix(oldPush*factor, oldPop*factor);	newB.copyAt(0,oldPop*(factor-1),oldB);	newC.copyAt(0,0,oldC);	FilterMatrix tempB = oldB.copy();	FilterMatrix tempC = oldC.copy();	FilterMatrix tempD = oldC.times(oldB);	for(int i=0; i<factor; i++) 	  newD.copyAt(oldPush*i,oldPop*i,oldD);	for(int i=1; i<factor; i++) {	  tempB = newA.times(oldB);	  tempC = oldC.times(newA);	  newB.copyAt(0,oldPop*(factor-i-1),tempB);	  newC.copyAt(oldPush*i,0,tempC);	  for(int j=0; j<factor-i; j++)	    newD.copyAt(oldPush*(i+j),oldPop*j,tempD);	  	  newA = newA.times(oldA);	  tempD = tempC.times(oldB); 	  	}			//System.err.println("--------");	//System.err.println("new rows: " + newPeek);	//System.err.println("new cols: " + newPush);	//System.err.println("new pop: "  + newPop);	//System.err.println("old rows: " + oldPeek);	//System.err.println("old cols: " + oldPush);	//System.err.println("old pop: "  + oldPop);	//System.err.println("num copies: " + numCompleteCopies);		LinearPrinter.println("Matrix A:");	LinearPrinter.println(newA.toString());	LinearPrinter.println("Matrix B:");	LinearPrinter.println(newB.toString());	LinearPrinter.println("Matrix C:");	LinearPrinter.println(newC.toString());	LinearPrinter.println("Matrix D:");	LinearPrinter.println(newD.toString());	// initial vector is the same	FilterVector newInitVec = (FilterVector)this.getInit().copy();	// create a new Linear rep for the expanded filter	LinearFilterRepresentation newRep;	if(this.preworkNeeded()) {	    // prework matrices are the same	    FilterMatrix newPreWorkA = this.getPreWorkA();	    FilterMatrix newPreWorkB = this.getPreWorkB();	    newRep = new LinearFilterRepresentation(newA,newB,newC,newD,newPreWorkA,newPreWorkB,newInitVec);		}	else {	    // newpeek - newpop = oldpeek - oldpop	    // newpop = factor*oldpop	    int newPeek = oldPeek - oldPop + oldPop*factor;	    newRep = new LinearFilterRepresentation(newA,newB,newC,newD,newInitVec,newPeek);	}	return newRep;    }