Class IndexSet
java.lang.Object
de.tilman_neumann.jml.factor.base.matrixSolver.IndexSet
public class IndexSet
extends java.lang.Object
BitArray implementation of an IndexSet, realized in long[], used by the Gaussian solver.
The xor() operation has complexity O(n), where n is the sum of the size of the two argument arrays.
Since here 64 xor's are done at once, this implementation is very fast compared to other algorithms with the same complexity.
-
Constructor Summary
Constructors Constructor Description IndexSet(int numberOfBits)
Standard constructor, creates an empty bit array capable to hold the given numberOfBits. -
Method Summary
Modifier and Type Method Description void
add(int x)
Add a single element x to this index set.void
addXor(IndexSet other)
boolean
contains(java.lang.Object o)
boolean
equals(java.lang.Object o)
int
getNumberOfSetBits()
int
hashCode()
boolean
isEmpty()
java.lang.Integer
last()
void
setBits(int newBits)
java.util.ArrayList<java.lang.Integer>
toList()
java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
IndexSet
public IndexSet(int numberOfBits)Standard constructor, creates an empty bit array capable to hold the given numberOfBits.- Parameters:
numberOfBits
-
-
-
Method Details
-
setBits
public void setBits(int newBits) -
add
public void add(int x)Add a single element x to this index set.- Parameters:
x
-
-
getNumberOfSetBits
public int getNumberOfSetBits() -
contains
public boolean contains(java.lang.Object o) -
last
public java.lang.Integer last() -
isEmpty
public boolean isEmpty()- Returns:
- true if this set is empty
-
addXor
-
toList
public java.util.ArrayList<java.lang.Integer> toList()- Returns:
- this index set as a list
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-