|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.data.AbstractDatabaseObject
de.lmu.ifi.dbs.elki.data.NumberVector<BitVector,Bit>
de.lmu.ifi.dbs.elki.data.BitVector
public class BitVector
Provides a BitVector wrapping a BitSet.
Field Summary | |
---|---|
private BitSet |
bits
Storing the bits. |
private int |
dimensionality
Dimensionality of this bit vector. |
Fields inherited from class de.lmu.ifi.dbs.elki.data.NumberVector |
---|
ATTRIBUTE_SEPARATOR |
Constructor Summary | |
---|---|
BitVector(Bit[] bits)
Provides a new BitVector corresponding to the bits in the given array. |
|
BitVector(BitSet bits,
int dimensionality)
Provides a new BitVector corresponding to the specified bits and of the specified dimensionality. |
|
BitVector(List<Bit> bits)
Provides a new BitVector corresponding to the bits in the given list. |
Method Summary | |
---|---|
boolean |
areSet(int[] indices)
Returns whether the bits at all of the specified indices are set. |
boolean |
contains(BitSet bitset)
Returns whether this BitVector contains all bits that are set to true in the specified BitSet. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this BitVector. |
BitSet |
getBits()
Returns a copy of the bits currently set in this BitVector. |
Vector |
getColumnVector()
Returns a Vector representing in one column and getDimensionality() rows the values of this BitVector as
double values. |
int |
getDimensionality()
The dimensionality of the binary vector space of which this BitVector is an element. |
Matrix |
getRowVector()
Returns a Matrix representing in one row and getDimensionality() columns the values of this BitVector as
double values. |
Bit |
getValue(int dimension)
Returns the value in the specified dimension. |
boolean |
isSet(int index)
Returns whether the bit at specified index is set. |
BitVector |
multiplicate(double k)
Returns a bit vector equal to this bit vector, if k is not 0, a bit vector with all components equal to zero otherwise. |
BitVector |
negativeVector()
Returns the inverse of the bit vector. |
BitVector |
newInstance(Bit[] values)
Creates and returns a new BitVector based on the passed values. |
BitVector |
newInstance(List<Bit> values)
Creates and returns a new BitVector based on the passed values. |
BitVector |
nullVector()
Returns a bit vector of equal dimensionality but containing 0 only. |
BitVector |
plus(BitVector fv)
Returns a bit vector corresponding to an XOR operation on this and the specified bit vector. |
BitVector |
randomInstance(Bit min,
Bit max,
Random random)
Returns the same as randomInstance(random) . |
BitVector |
randomInstance(BitVector min,
BitVector max,
Random random)
Returns the same as randomInstance(random) . |
BitVector |
randomInstance(Random random)
Returns a BitVector with random values. |
int[] |
setBits()
Returns the indices of all set bits. |
String |
toString()
Returns a String representation of this BitVector. |
Methods inherited from class de.lmu.ifi.dbs.elki.data.NumberVector |
---|
getMax, getMin, getRange |
Methods inherited from class de.lmu.ifi.dbs.elki.data.AbstractDatabaseObject |
---|
getID, setID |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.lmu.ifi.dbs.elki.data.DatabaseObject |
---|
getID, setID |
Methods inherited from interface de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialObject |
---|
getID |
Field Detail |
---|
private BitSet bits
private int dimensionality
Constructor Detail |
---|
public BitVector(BitSet bits, int dimensionality) throws IllegalArgumentException
bits
- the bits to be set in this BitVectordimensionality
- the dimensionality of this BitVector
IllegalArgumentException
- if the specified dimensionality is to
small to match the given BitSetpublic BitVector(Bit[] bits)
bits
- an array of bits specifying the bits in this bit vectorpublic BitVector(List<Bit> bits)
bits
- an array of bits specifying the bits in this bit vectorMethod Detail |
---|
public BitVector newInstance(Bit[] values)
values
- the values of the featureVector
public BitVector newInstance(List<Bit> values)
values
- the values of the featureVector
public BitVector randomInstance(Random random)
random
- an instance of random to facilitate random values
FeatureVector.randomInstance(java.util.Random)
public BitVector randomInstance(Bit min, Bit max, Random random)
randomInstance(random)
.
min
- unusedmax
- unusedrandom
- as in randomInstance(random)
public BitVector randomInstance(BitVector min, BitVector max, Random random)
randomInstance(random)
.
min
- unusedmax
- unusedrandom
- as in randomInstance(random)
public int getDimensionality()
FeatureVector.getDimensionality()
public Bit getValue(int dimension)
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
FeatureVector.getValue(int)
public Vector getColumnVector()
getDimensionality()
rows the values of this BitVector as
double values.
getDimensionality()
rows the values of this BitVector
as double valuesFeatureVector.getColumnVector()
public Matrix getRowVector()
getDimensionality()
columns the values of this BitVector as
double values.
getDimensionality()
columns the values of this
BitVector as double valuesFeatureVector.getRowVector()
public BitVector multiplicate(double k)
k
- used as multiplier 1 if k ≠ 0, otherwise the resulting bit
vector will have all values equal to zero
public BitVector negativeVector()
BitSet.flip(int,int)
public BitVector nullVector()
public BitVector plus(BitVector fv)
fv
- the bit vector to add
public boolean isSet(int index)
index
- the index of the bit to inspect
index
is set, false
otherwise.public boolean areSet(int[] indices)
indices
- the indices to inspect
public int[] setBits()
public boolean contains(BitSet bitset)
bitset
- the bits to inspect in this BitVector
public BitSet getBits()
public String toString()
BitVectorLabelParser
.
toString
in interface FeatureVector<BitVector,Bit>
toString
in class Object
Object.toString()
public boolean equals(Object obj)
equals
in interface DatabaseObject
equals
in class NumberVector<BitVector,Bit>
obj
- another Object
DatabaseObject.equals(Object)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |