Function
Class XMLFourierPolynomial

java.lang.Object
  extended by Function.Function
      extended by Function.DirectProdFunction
          extended by Function.XMLFourierPolynomial

public class XMLFourierPolynomial
extends DirectProdFunction

An implementation of the abstract class Function used by class SFT, which defines a Function object by a given XML file that contains description of functions over G -> C , where G is the Cartesian product of Z_Ni. The representation is kept by storing elements in G and their function-coefficients.

The XML format should be as following:

Author:
Elizabeth Firman and Ariel Stolerman

Constructor Summary
XMLFourierPolynomial(java.io.File XMLInputFile, long[] G)
          Constructs a XMLFunction object from an input XML file as described in the class documentation.
 
Method Summary
 java.util.Map<java.lang.String,FourierPolynomial> getPolynomials()
           
 Complex getValue(long[] elem)
          Returns the value of the function for the input element in G.
 boolean isRandom()
          Specifies weather this XMLFunction object is "random" as described in the class documentation.
 void setG(long[] G)
          Sets G to a new value.
 
Methods inherited from class Function.DirectProdFunction
calcEuclideanNorm, calcInfinityNorm, getG
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFourierPolynomial

public XMLFourierPolynomial(java.io.File XMLInputFile,
                            long[] G)
                     throws FunctionException
Constructs a XMLFunction object from an input XML file as described in the class documentation.

Parameters:
XMLInputFile - The input XML file.
G - The vector of values describing G, i.e. Cartesian product of Z_Ni.
Throws:
FunctionException - If an XML parsing error occurred, I/O exception or invalid input.
Method Detail

getValue

public Complex getValue(long[] elem)
Returns the value of the function for the input element in G. If the Function is defined as random, a polynomial will randomly be selected from the list of Fourier polynomials and its value for the input element will be returned. Otherwise, the sole polynomial defined in the input XML file's value for the input element will be returned.

Specified by:
getValue in class DirectProdFunction
Parameters:
elem - The element whose this function's value is calculated.
Returns:
The value of the function for the input element in G.

isRandom

public boolean isRandom()
Specifies weather this XMLFunction object is "random" as described in the class documentation. That is, is value calculation performed randomly over all the polynomials given in the input XML file or only a specific polynomial is specified.

Returns:
True if and only if the value calculation mode is random over all the polynomials in the input XML file.

setG

public void setG(long[] G)
          throws FunctionException
Description copied from class: DirectProdFunction
Sets G to a new value.

Overrides:
setG in class DirectProdFunction
Parameters:
G - The vector of values describing G, the domain of the function
Throws:
FunctionException - If the one of the given values is less than or equals to 0.

getPolynomials

public java.util.Map<java.lang.String,FourierPolynomial> getPolynomials()