Function
Class FourierPolynomial

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

public class FourierPolynomial
extends DirectProdFunction

Describes a Fourier polynomial by a list of terms and their coefficients, i.e. for a Fourier polynomial:
p(x) = ∑cα•Χα(x) it holds the mapping of α to its coefficient cα.

Author:
Elizabeth Firman and Ariel Stolerman

Constructor Summary
FourierPolynomial(long[] G, java.lang.String id)
          Default constructor.
 
Method Summary
 void addUpdateTerm(long[] alpha, double re, double im)
          adds the term to the polynomial if already exist, adds the coefficients
 Complex getCoeff(long[] alpha)
           
 java.lang.String getId()
           
 Complex getValue(long[] x)
          Returns the value of the function for the input element in G.
 java.lang.String toMatlabScript(java.lang.String scriptName)
          get the function as a Matlab script
 java.lang.String toString()
          get the string representation of the polynomial
 
Methods inherited from class Function.DirectProdFunction
calcEuclideanNorm, calcInfinityNorm, getG, setG
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FourierPolynomial

public FourierPolynomial(long[] G,
                         java.lang.String id)
                  throws FunctionException
Default constructor.

Parameters:
id - unique identifier for the polynomial.
Throws:
FunctionException
Method Detail

getCoeff

public Complex getCoeff(long[] alpha)
Parameters:
alpha - the element (vector) for which the coefficient is fetched
Returns:
the coefficient or null if doesn't exist

getId

public java.lang.String getId()
Returns:
the id of the polynomial

toString

public java.lang.String toString()
get the string representation of the polynomial

Overrides:
toString in class java.lang.Object

toMatlabScript

public java.lang.String toMatlabScript(java.lang.String scriptName)
get the function as a Matlab script


addUpdateTerm

public void addUpdateTerm(long[] alpha,
                          double re,
                          double im)
adds the term to the polynomial if already exist, adds the coefficients

Parameters:
alpha - the element
re - real part
im - imaginary part

getValue

public Complex getValue(long[] x)
Description copied from class: DirectProdFunction
Returns the value of the function for the input element in G.

Specified by:
getValue in class DirectProdFunction
Parameters:
x: - input for the polynomial p
Returns:
The value of the function for the input element in G.