body.addStatement(makeFieldAllocation(outputBufferField.getIdent(), filterSize, "field to store the output of each execution.")); body.addStatement(makeFieldAllocation(weightField.getIdent(), filterSize, "field to store the frequency response of the filter.")); body.addStatement(makeFieldAllocation(partialField.getIdent(),    x-1, "field to store the partial results across filter firings."));
for (int i=0; i<numFIRs; i++) { body.addStatement(makeFieldAllocation(outputBufferFields[i].getIdent(), filterSize, "field to store the output of each execution (" + i + ").")); }   for (int currentFIR=0; currentFIR<numFIRs; currentFIR++) {  float[] time_response_r = getRealArray(linearRep, numFIRs - 1 - currentFIR, filterSize);  for (int i=0; i<filterSize; i++) { body.addStatement(makeArrayAssignment(weightFields[currentFIR], i,                        time_response_r[i]));     }  body.addStatement(makeTimeToFrequencyConversion(weightFields[currentFIR], filterSize));  body.addStatement(makeFrequencyScale(weightFields[currentFIR], filterSize)); }
    public JMethodDeclaration makeNewInit(LinearFilterRepresentation linearRep,					  JVariableDefinition weightField,					  JVariableDefinition partialField,					  JVariableDefinition inputBufferField,					  JVariableDefinition outputBufferField,					  int filterSize, int x) {		JBlock body = new JBlock();		/* calculate the weights of the fields based on the filter	 * coefficients that are found in the linear representation. */		float[] time_response_r      = getRealArray(linearRep, filterSize);		/** add in statements to allocate space for the weight field, partial results	    field, input buffer field, and output buffer field.	    The weight fields are all of the filter size (because we will store the frequency	    representation in half complex array form (the output of FFTW). **/ 	body.addStatement(makeFieldAllocation(inputBufferField.getIdent(), filterSize,					      "field to store the input each execution.")); 	body.addStatement(makeFieldAllocation(outputBufferField.getIdent(), filterSize,					      "field to store the output of each execution.")); 	body.addStatement(makeFieldAllocation(weightField.getIdent(), filterSize,					      "field to store the frequency response of the filter."));	body.addStatement(makeFieldAllocation(partialField.getIdent(),    x-1,					      "field to store the partial results across filter firings."));			/** copy the values of the time responses into the weight field (afterwards we will	    run convert_to_freq on the buffer to convert the real values to their complex	    frequency form. **/	for (int i=0; i<filterSize; i++) {	    body.addStatement(makeArrayAssignment(weightField, /* field */						  i,                          /* index */						  time_response_r[i]));  /* value */	}	/** add in code to convert the weight field to the frequency domain. **/	body.addStatement(makeTimeToFrequencyConversion(weightField, filterSize));	/** add in code to scale the weight field by 1/N (because FFTW doesn't do it. */	body.addStatement(makeFrequencyScale(weightField, filterSize));		/** assemble the new pieces that we made and stick them into a new method. */	return new JMethodDeclaration(null,                 /* token reference */				      ACC_PUBLIC,           /* modifiers */				      CStdType.Void,        /* return type */				      "init",               /* identifier */				      JFormalParameter.EMPTY,/* paramters */				      CClassType.EMPTY,     /* exceptions */				      body,                 /* body */				      null,                 /* java doc */				      null);                /* java style comment */    }