ru.sscc.util.data
Class FloatSRefVectors

java.lang.Object
  |
  +--ru.sscc.util.data.RealVectors
        |
        +--ru.sscc.util.data.FloatSRefVectors

public final class FloatSRefVectors
extends RealVectors

An implementation of RealVectors based on float[] vector with indexing by short[] refence vector (the sign bit of reference entries is considered as the numeric bit).

See Also:
Serialized Form

Fields inherited from class ru.sscc.util.data.RealVectors
dimension, size
 
Constructor Summary
FloatSRefVectors(float[] vectors, short[] ref, int dimension)
          Constructor.
FloatSRefVectors(float[] vectors, short[] ref, int dimension, int size)
          Constructor.
 
Method Summary
 double add(int i, int j, double value)
          Adds a value to j-th component of i-th vector and returns the result.
 void assign(RealPointer vector, int i)
          Assignment vector = "this i-th vector".
 BoundingBox boundingBox()
          Calculates a minimal bounding box containing the vectors array.
 double get(int i, int j)
          Returns j-th componet of i-th vector.
 RealVector getComponent(int j)
          Returns j-th component of all vectors as a RealVector.
 RealPointer getPointer(int i)
          Returns a pointer to i-th vector (i is zero based index).
 RealVector getVector(int i)
          Returns i-th data vector as a RealVector.
 boolean inBox(int i, BoundingBox box)
          Tests i-th vector to belong to a bounding box.
 double mul(int i, int j, double value)
          Multiplies the j-th component of i-th vector by a value and returns the result.
 int offset(int i)
          Returns offset of i-th vector in the vectors container.
 double set(int i, int j, double value)
          Sets a value for j-th component of i-th vector and returns it.
 double squaredDistance(int index1, RealPointer vec2)
          Calculates the squared euqlidian distance between a vector stored in this object and another vector presented by a real pointer.
 
Methods inherited from class ru.sscc.util.data.RealVectors
by, by, calculateCenter, ensureDimension, ensureSize, getPointers, pos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FloatSRefVectors

public FloatSRefVectors(float[] vectors,
                        short[] ref,
                        int dimension)
Constructor.
Parameters:
vectors - a vectors' container
ref - a vectors' reference vector
dimension - a vector's dimension

FloatSRefVectors

public FloatSRefVectors(float[] vectors,
                        short[] ref,
                        int dimension,
                        int size)
Constructor.
Parameters:
vectors - a vectors' container
ref - a vectors' reference vector
dimension - a vector's dimension
size - a number of vectors
Method Detail

get

public double get(int i,
                  int j)
Returns j-th componet of i-th vector.
Overrides:
get in class RealVectors

set

public double set(int i,
                  int j,
                  double value)
Sets a value for j-th component of i-th vector and returns it.
Overrides:
set in class RealVectors

add

public double add(int i,
                  int j,
                  double value)
Adds a value to j-th component of i-th vector and returns the result.
Overrides:
add in class RealVectors

mul

public double mul(int i,
                  int j,
                  double value)
Multiplies the j-th component of i-th vector by a value and returns the result.
Overrides:
mul in class RealVectors

getComponent

public RealVector getComponent(int j)
Returns j-th component of all vectors as a RealVector.
Overrides:
getComponent in class RealVectors

getPointer

public RealPointer getPointer(int i)
Returns a pointer to i-th vector (i is zero based index). To access to the vector components you have to move the pointer using next operation.
Overrides:
getPointer in class RealVectors

getVector

public RealVector getVector(int i)
Returns i-th data vector as a RealVector.
Overrides:
getVector in class RealVectors

boundingBox

public BoundingBox boundingBox()
Calculates a minimal bounding box containing the vectors array.
Overrides:
boundingBox in class RealVectors

inBox

public boolean inBox(int i,
                     BoundingBox box)
Tests i-th vector to belong to a bounding box.
Overrides:
inBox in class RealVectors
Parameters:
i - a vector's index
box - a bounding box for test
Returns:
true, if i-th vector belongs to the bounding box

assign

public void assign(RealPointer vector,
                   int i)
Assignment vector = "this i-th vector". Copies i-th vector of vectors array to the memory pointed by vector.
Overrides:
assign in class RealVectors
Parameters:
vector - a pointer to the vector
i - an index of copied vector in this object

offset

public int offset(int i)
Returns offset of i-th vector in the vectors container.
Overrides:
offset in class RealVectors

squaredDistance

public double squaredDistance(int index1,
                              RealPointer vec2)
Calculates the squared euqlidian distance between a vector stored in this object and another vector presented by a real pointer.
Overrides:
squaredDistance in class RealVectors
Parameters:
index1 - an index of the first vector in array
vec2 - a pointer to the second vector
Returns:
the squared euqlidian distance