de.torstennahm.integrate.sparse.index
Class WeightedIndexGenerator

java.lang.Object
  extended by de.torstennahm.integrate.sparse.index.WeightedIndexGenerator
All Implemented Interfaces:
de.torstennahm.series.Series<Index>

public class WeightedIndexGenerator
extends java.lang.Object
implements de.torstennahm.series.Series<Index>

Iterates over all indices with a given dimension, or with infinite dimension. All indices are returned exactly once. The exact order in which indices are provided is not specified. However, indices are returned so that for each index provided, all smaller indices (with regard to the canonical partial ordering of indices) have been returned before it. In addition, for finite dimension, it is also guaranteed that the length of the returned indices (that is, the sum of their components) increases monotonously. This is not possible for infinite dimension.

This class is not thread-safe.

Author:
Torsten Nahm

Nested Class Summary
static interface WeightedIndexGenerator.WeightFunction
           
 
Constructor Summary
WeightedIndexGenerator()
           
WeightedIndexGenerator(double[] weights)
           
WeightedIndexGenerator(WeightedIndexGenerator.WeightFunction weightFunction, int dimension)
           
 
Method Summary
 boolean hasNext()
           
 Index next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WeightedIndexGenerator

public WeightedIndexGenerator()

WeightedIndexGenerator

public WeightedIndexGenerator(double[] weights)

WeightedIndexGenerator

public WeightedIndexGenerator(WeightedIndexGenerator.WeightFunction weightFunction,
                              int dimension)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface de.torstennahm.series.Series<Index>

next

public Index next()
Specified by:
next in interface de.torstennahm.series.Series<Index>