|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ru.sscc.util.data.RealVectors
An abstract class for access to vectors container. The container is really 2D array, which rows are vectors. The vectors are stored in row by row order. All access operations are implemented via RealPointer and RealVector.
Field Summary | |
int |
dimension
A dimension of every vector in the array. |
int |
size
A number of vectors in the array. |
Constructor Summary | |
protected |
RealVectors(int dimension,
int size)
Constructor. |
Method Summary | |
abstract double |
add(int i,
int j,
double value)
Adds a value to j-th component of i-th vector and returns the result. |
abstract void |
assign(RealPointer vector,
int i)
Assignment vector = "this i-th vector". |
abstract BoundingBox |
boundingBox()
Calculates a minimal bounding box containing the vectors array. |
static RealVectors |
by(java.lang.Object obj,
int dimension)
Static service method that tests obj object to be float[] or double[] instance and creates corresponding RealVectors instance. |
static RealVectors |
by(java.lang.Object obj,
java.lang.Object ref,
int dimension)
Static service method that tests obj object to be float[] or double[] instance and ref object to be short[] or int[] instance and creates corresponding RealVectors instance
referenced by ref object. |
void |
calculateCenter(RealPointer center)
Calculates the mass center of the vectors set. |
void |
ensureDimension(int dimension)
Tests a vectors' dimension to be not less that specified dimension and throws the IllegalArgumentException if not. |
void |
ensureSize(int size)
Tests vectors' size to be not less that specified size and throws the IllegalArgumentException if not. |
abstract double |
get(int i,
int j)
Returns j-th componet of i-th vector. |
abstract RealVector |
getComponent(int j)
Returns j-th component of all vectors as a RealVector . |
abstract RealPointer |
getPointer(int i)
Returns a pointer to i-th vector (i is zero based index). |
RealPointers |
getPointers()
Returns RealPointers object. |
abstract RealVector |
getVector(int i)
Returns i-th data vector as a RealVector . |
abstract boolean |
inBox(int i,
BoundingBox box)
Tests i-th vector to belong to a bounding box. |
abstract double |
mul(int i,
int j,
double value)
Multiplies the j-th component of i-th vector by a value and returns the result. |
abstract int |
offset(int i)
Returns offset of i-th vector in the vectors container. |
protected int |
pos(int i)
Calculates the position of i-th table row in the container. |
abstract double |
set(int i,
int j,
double value)
Sets a value for j-th component of i-th vector and returns it. |
abstract 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 java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public final int dimension
public final int size
Constructor Detail |
protected RealVectors(int dimension, int size)
dimension
- a vectors dimensionsize
- a number of vectorsMethod Detail |
public abstract double get(int i, int j)
public abstract double set(int i, int j, double value)
public abstract double add(int i, int j, double value)
public abstract double mul(int i, int j, double value)
public abstract RealVector getComponent(int j)
RealVector
.public abstract RealVector getVector(int i)
RealVector
.public abstract BoundingBox boundingBox()
public abstract boolean inBox(int i, BoundingBox box)
i
- a vector's indexbox
- a bounding box for testpublic abstract RealPointer getPointer(int i)
next
operation.public abstract void assign(RealPointer vector, int i)
vector
- a pointer to the vectori
- an index of copied vector in this objectpublic final RealPointers getPointers()
public abstract int offset(int i)
public static RealVectors by(java.lang.Object obj, int dimension)
RealVectors
instance.obj
- a vectors container (float[] or
double[] instance)dimension
- a vector dimensionpublic static RealVectors by(java.lang.Object obj, java.lang.Object ref, int dimension)
RealVectors
instance
referenced by ref object.obj
- a vectors container (float[] or double[])ref
- a reference vector (short[] or int[])dimension
- a vector dimensionpublic final void ensureSize(int size)
size
- a minimum size neededpublic final void ensureDimension(int dimension)
dimension
- a minimum dimension neededpublic abstract double squaredDistance(int index1, RealPointer vec2)
index1
- an index of the first vector in arrayvec2
- a pointer to the second vectorpublic final void calculateCenter(RealPointer center)
center
- a pointer to the vector to store the resultprotected final int pos(int i)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |