de.torstennahm.integrate.sparse
Class ProductWeightIntegrator

java.lang.Object
  extended by de.torstennahm.integrate.sparse.ProductWeightIntegrator

public class ProductWeightIntegrator
extends java.lang.Object

Integrates a function by using product weights generated from a one-dimensional quadrature formula generator, with a depth specified seperately for each dimension.

This class is a helper class for sparse grid integration. It is not part of the Integrator hierarchy, as it does not support open-ended integration, but only uses a fixed number of points.

This class is thread-safe.

Author:
Torsten Nahm

Constructor Summary
ProductWeightIntegrator(Generator generator)
          Construct the integrator with the specified quadrature formula generator.
 
Method Summary
 boolean canIntegrate(Index index)
          Returns whether integration is possible with the given index.
 double integrateWithIndex(de.torstennahm.math.Function function, Index index)
          Integrates the function at the specified index by using the tensor product of one-dimensional quadrature formulas.
 double integrateWithNodes(de.torstennahm.math.Function function, int[] nodes)
           
 int neededEvaluations(Index index)
          Returns the number of evaluations of the function needed for evaluation of the specified index.
 int neededEvaluations(int[] nodes)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProductWeightIntegrator

public ProductWeightIntegrator(Generator generator)
Construct the integrator with the specified quadrature formula generator. If the generator is slow, it should be wrapped in a de.torstennahm.integrate.quadratureformula.GeneratorCache before passing it to this class.

Parameters:
generator - quadrature formula generator
Method Detail

integrateWithIndex

public double integrateWithIndex(de.torstennahm.math.Function function,
                                 Index index)
                          throws IntegrationFailedException
Integrates the function at the specified index by using the tensor product of one-dimensional quadrature formulas. The entry index.getEntry(i) will tell the algorithm to use the quadrature formula returned by getQuadratureFormulaByLevel(index.getEntry(i)) for the dimension i. In this way, the index specifies the depth of integration for each dimension.

Parameters:
index - integration index
Returns:
integral value
Throws:
IntegrationFailedException - if an integration error occurs

integrateWithNodes

public double integrateWithNodes(de.torstennahm.math.Function function,
                                 int[] nodes)
                          throws IntegrationFailedException
Throws:
IntegrationFailedException

canIntegrate

public boolean canIntegrate(Index index)
Returns whether integration is possible with the given index.

Parameters:
index -
Returns:
true if integration with this index is possible

neededEvaluations

public int neededEvaluations(Index index)
Returns the number of evaluations of the function needed for evaluation of the specified index.

Parameters:
index - integration index
Returns:
number of evaluations; 0 is returned if the integration with this index is not possible

neededEvaluations

public int neededEvaluations(int[] nodes)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object