Package org.hipparchus.util
Class RosenNumberPartitionIterator
- java.lang.Object
-
- org.hipparchus.util.RosenNumberPartitionIterator
-
- All Implemented Interfaces:
Iterator<int[]>
public class RosenNumberPartitionIterator extends Object implements Iterator<int[]>
An iterator that generates all partitions ofn
elements, intok
parts containing the number of elements in each part, based on Rosen's algorithm.This is a copy of the class (with slight edits) with the same name from the Symja Library. The original file was published under the terms of the GPLV3 license, but the Hipparchus project was explicitly allowed to include it relicensed to Apache V2.
See Kenneth H. Rosen, Discrete Mathematics and Its Applications, 2nd edition (NY: McGraw-Hill, 1991), pp. 284-286
-
-
Constructor Summary
Constructors Constructor Description RosenNumberPartitionIterator(int n, int k)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
int[]
next()
void
reset()
Reset this iterator to the start condition.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
hasNext
public final boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<int[]>
- See Also:
Iterator.hasNext()
-
next
public final int[] next()
- Specified by:
next
in interfaceIterator<int[]>
- See Also:
Iterator.next()
-
reset
public void reset()
Reset this iterator to the start condition.
-
-