Package de.tilman_neumann.jml.partitions
Interface Mpi
-
- All Superinterfaces:
Comparable<Mpi>,Iterable<Integer>
- All Known Subinterfaces:
PrimePowers
- All Known Implementing Classes:
Mpi_IntegerArrayImpl,PrimePowers_DefaultImpl
public interface Mpi extends Comparable<Mpi>, Iterable<Integer>
A multipartite number like [1,3,4,2,0,1].- Author:
- Tilman Neumann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcompareTo(Mpi other)Compare this with another multipartite integer.Mpicomplement(Mpi other)Like subtract() but when we know that other fits piece-wise into this.Mpi[]div2()Computes a kind of division by 2 of this.intfirstNonZeroPartIndex()intgetCardinality()intgetDim()intgetElem(int index)Returns the entry of the given index, with 0<=indexMpimaxNextPart(Mpi firstPart, Mpi lastPart)Special operation computing the biggest allowed subvalue of this that is not greater than lastPart and not greater than this-firstPart.voidsetElem(int index, int value)Sets the entry of the given index, with 0<=indexMpi[]subtract(Mpi other)Returns the pair [lower, upper] of consecutive subvalues of this (according to the ordering relation) such that lower + other <= this and upper + other >= this.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
getDim
int getDim()
- Returns:
- dimension of the multipartite number, it's "partiteness"
-
getCardinality
int getCardinality()
- Returns:
- total number of entries = the sum of the elements of this multipartite number
-
getElem
int getElem(int index)
Returns the entry of the given index, with 0<=index- Parameters:
index-- Returns:
- entry at index 'index'
-
setElem
void setElem(int index, int value)Sets the entry of the given index, with 0<=index- Parameters:
index-value-
-
firstNonZeroPartIndex
int firstNonZeroPartIndex()
- Returns:
- the index of the first non-zero entry
-
subtract
Mpi[] subtract(Mpi other)
Returns the pair [lower, upper] of consecutive subvalues of this (according to the ordering relation) such that lower + other <= this and upper + other >= this.- Parameters:
other-- Returns:
- the lower and upper bound of this - other
-
complement
Mpi complement(Mpi other)
Like subtract() but when we know that other fits piece-wise into this. That means faster ;)- Parameters:
other- a multipartite integer that has no element greater than the corresponding element of this- Returns:
- this - other
-
div2
Mpi[] div2()
Computes a kind of division by 2 of this. The result is a pair of [lower, upper] values with lower + upper = this (element-wise addition) and lower<=upper.- Returns:
- [lower, upper]
-
maxNextPart
Mpi maxNextPart(Mpi firstPart, Mpi lastPart)
Special operation computing the biggest allowed subvalue of this that is not greater than lastPart and not greater than this-firstPart.- Parameters:
firstPart-lastPart-- Returns:
- min(lastPart, lower(this - firstPart))
-
compareTo
int compareTo(Mpi other)
Compare this with another multipartite integer. The first element that differs decides, i.e. [2,0,0] is bigger than [1,2,3].- Specified by:
compareToin interfaceComparable<Mpi>
-
-