public class RandomAccessFileInputVectorDistanceMatrix extends InputVectorDistanceMatrix
RandomAccessFile
. This implementation does not read the matrix into the
memory, and is thus suited especially for big datasets.
The file is built as follows:
[(2,1) (3,1) (4,1) (5,1) (6,1)] [ (3,2) (4,2) (5,1) (6,2)] [ (4,3) (5,3) (6,3)] [ (5,4) (6,4)] [ (6,5)] [ ]
Modifier and Type | Field and Description |
---|---|
private static int |
BYTES_CHAR |
private static int |
BYTES_DOUBLE |
static int |
BYTES_HEADER |
private java.io.RandomAccessFile |
file |
inputLabels, metric, numVectors
Constructor and Description |
---|
RandomAccessFileInputVectorDistanceMatrix(java.lang.String fileName) |
Modifier and Type | Method and Description |
---|---|
double |
getDistance(int x,
int y)
Return the distance between input vectors x and y.
|
DistanceMetric |
getMetric() |
protected static long |
getOffset(long x,
long y,
long numVectors)
Find the offset of a specific value in the linear order
|
columns, equals, flatArraySize, getDistances, getDistancesFlat, getDistancesFlatAsMatrix, getInputLabels, getNNearest, initFromFile, numVectors, rows, toString
public static final int BYTES_HEADER
private static final int BYTES_CHAR
private static final int BYTES_DOUBLE
private java.io.RandomAccessFile file
public RandomAccessFileInputVectorDistanceMatrix(java.lang.String fileName) throws java.io.IOException, SOMToolboxException
java.io.IOException
SOMToolboxException
public DistanceMetric getMetric()
getMetric
in class InputVectorDistanceMatrix
public double getDistance(int x, int y)
InputVectorDistanceMatrix
getDistance
in class InputVectorDistanceMatrix
protected static long getOffset(long x, long y, long numVectors)