|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.data.AbstractNumberVector<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.AbstractNumberVector |
---|
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 |
contains(BitSet bitset)
Returns whether this BitVector contains all bits that are set to true in the specified BitSet. |
double |
doubleValue(int dimension)
Returns the value in the specified dimension as double. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this BitVector. |
BitVector |
fromByteBuffer(ByteBuffer buffer)
Deserialize an object from a byte buffer (e.g. disk) |
BitSet |
getBits()
Returns a copy of the bits currently set in this BitVector. |
int |
getByteSize(BitVector vec)
Get the size of the object in bytes. |
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. |
long |
longValue(int dimension)
Returns the value in the specified dimension as long. |
BitVector |
minus(BitVector fv)
Returns a bit vector corresponding to an NXOR operation on this and the specified bit vector. |
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(double[] values)
Returns a new NumberVector of N for the given values. |
BitVector |
newInstance(List<Bit> values)
Creates and returns a new BitVector based on the passed values. |
BitVector |
newInstance(Vector values)
Returns a new NumberVector of N for the given 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. |
Bit |
scalarProduct(BitVector fv)
Provides the scalar product (inner product) of this BitVector and the given BitVector. |
void |
toByteBuffer(ByteBuffer buffer,
BitVector vec)
Serialize the object to a byte array (e.g. disk) |
String |
toString()
Returns a String representation of this BitVector. |
Methods inherited from class de.lmu.ifi.dbs.elki.data.AbstractNumberVector |
---|
byteValue, floatValue, getMax, getMin, hashCode, intValue, shortValue |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
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 int getDimensionality()
getDimensionality
in interface FeatureVector<BitVector,Bit>
getDimensionality
in interface SpatialComparable
FeatureVector.getDimensionality()
public Bit getValue(int dimension)
getValue
in interface FeatureVector<BitVector,Bit>
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
FeatureVector.getValue(int)
public double doubleValue(int dimension)
doubleValue
in interface NumberVector<BitVector,Bit>
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
NumberVector.doubleValue(int)
public long longValue(int dimension)
longValue
in interface NumberVector<BitVector,Bit>
dimension
- the desired dimension, where 1 ≤ dimension ≤
this.getDimensionality()
NumberVector.longValue(int)
public Vector getColumnVector()
getDimensionality()
rows the values of this BitVector as
double values.
getColumnVector
in interface NumberVector<BitVector,Bit>
getDimensionality()
rows the values of this BitVector
as double valuesNumberVector.getColumnVector()
public Matrix getRowVector()
getDimensionality()
columns the values of this BitVector as
double values.
getRowVector
in interface NumberVector<BitVector,Bit>
getDimensionality()
columns the values of this
BitVector as double valuesNumberVector.getRowVector()
public BitVector multiplicate(double k)
multiplicate
in interface NumberVector<BitVector,Bit>
k
- used as multiplier 1 if k ≠ 0, otherwise the resulting bit
vector will have all values equal to zero
public BitVector negativeVector()
negativeVector
in interface NumberVector<BitVector,Bit>
BitSet.flip(int,int)
public BitVector nullVector()
nullVector
in interface NumberVector<BitVector,Bit>
public BitVector plus(BitVector fv)
plus
in interface NumberVector<BitVector,Bit>
fv
- the bit vector to add
public BitVector minus(BitVector fv)
minus
in interface NumberVector<BitVector,Bit>
fv
- the bit vector to add
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 class AbstractNumberVector<BitVector,Bit>
obj
- another Object
public Bit scalarProduct(BitVector fv)
scalarProduct
in interface NumberVector<BitVector,Bit>
fv
- the BitVector to compute the scalar product for
public BitVector newInstance(double[] values)
NumberVector
newInstance
in interface NumberVector<BitVector,Bit>
values
- the values of the NumberVector
public BitVector newInstance(Vector values)
NumberVector
newInstance
in interface NumberVector<BitVector,Bit>
values
- the values of the NumberVector
public BitVector newInstance(Bit[] values)
newInstance
in interface FeatureVector<BitVector,Bit>
values
- the values of the featureVector
public BitVector newInstance(List<Bit> values)
newInstance
in interface FeatureVector<BitVector,Bit>
values
- the values of the featureVector
public BitVector fromByteBuffer(ByteBuffer buffer) throws IOException
ByteBufferSerializer
fromByteBuffer
in interface ByteBufferSerializer<BitVector>
buffer
- Data array to process
IOException
public void toByteBuffer(ByteBuffer buffer, BitVector vec) throws IOException
ByteBufferSerializer
toByteBuffer
in interface ByteBufferSerializer<BitVector>
buffer
- Buffer to serialize tovec
- Object to serialize
IOException
public int getByteSize(BitVector vec)
ByteBufferSerializer
getByteSize
in interface ByteBufferSerializer<BitVector>
vec
- Object to serialize
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |