at.tuwien.ifs.somtoolbox.data.distance
Class RandomAccessFileInputVectorDistanceMatrix

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
      extended by at.tuwien.ifs.somtoolbox.data.distance.RandomAccessFileInputVectorDistanceMatrix

public class RandomAccessFileInputVectorDistanceMatrix
extends InputVectorDistanceMatrix

A distance matrix based on a binary 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:

Version:
$Id: RandomAccessFileInputVectorDistanceMatrix.java 3706 2010-07-20 11:07:54Z mayer $
Author:
Rudolf Mayer

Field Summary
private static int BYTES_CHAR
           
private static int BYTES_DOUBLE
           
static int BYTES_HEADER
           
private  RandomAccessFile file
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
inputLabels, metric, numVectors
 
Constructor Summary
RandomAccessFileInputVectorDistanceMatrix(String fileName)
           
 
Method Summary
 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
 
Methods inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
columns, equals, flatArraySize, getDistances, getDistancesFlat, getDistancesFlatAsMatrix, getInputLabels, getNNearest, initFromFile, numVectors, rows, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BYTES_HEADER

public static final int BYTES_HEADER
See Also:
Constant Field Values

BYTES_CHAR

private static final int BYTES_CHAR
See Also:
Constant Field Values

BYTES_DOUBLE

private static final int BYTES_DOUBLE
See Also:
Constant Field Values

file

private RandomAccessFile file
Constructor Detail

RandomAccessFileInputVectorDistanceMatrix

public RandomAccessFileInputVectorDistanceMatrix(String fileName)
                                          throws IOException,
                                                 SOMToolboxException
Throws:
IOException
SOMToolboxException
Method Detail

getMetric

public DistanceMetric getMetric()
Overrides:
getMetric in class InputVectorDistanceMatrix

getDistance

public double getDistance(int x,
                          int y)
Description copied from class: InputVectorDistanceMatrix
Return the distance between input vectors x and y.

Specified by:
getDistance in class InputVectorDistanceMatrix

getOffset

protected static long getOffset(long x,
                                long y,
                                long numVectors)
Find the offset of a specific value in the linear order