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

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
      extended by at.tuwien.ifs.somtoolbox.data.distance.AbstractMemoryInputVectorDistanceMatrix
Direct Known Subclasses:
FullMemoryInputVectorDistanceMatrix, LeightWeightMemoryInputVectorDistanceMatrix

public abstract class AbstractMemoryInputVectorDistanceMatrix
extends InputVectorDistanceMatrix

This implementation stores the distances in memory. It is constructed either by calculating distances from the given input data on the fly, or by reading them from an ASCII file. If memory is an issue (consider using RandomAccessFileInputVectorDistanceMatrix instead).

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

Field Summary
static String FILE_TYPE
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
inputLabels, metric, numVectors
 
Constructor Summary
AbstractMemoryInputVectorDistanceMatrix(InputData data, DistanceMetric metric)
          Constructs the distance matrix by computing the distances on the fly.
AbstractMemoryInputVectorDistanceMatrix(String fileName)
          Reads the distance matrix from an ASCII file, and stores it in memory.
 
Method Summary
protected abstract  void initStorage()
           
protected abstract  void setValue(int x, int y, double value)
           
 
Methods inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
columns, equals, flatArraySize, getDistance, getDistances, getDistancesFlat, getDistancesFlatAsMatrix, getInputLabels, getMetric, getNNearest, initFromFile, numVectors, rows, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILE_TYPE

public static final String FILE_TYPE
See Also:
Constant Field Values
Constructor Detail

AbstractMemoryInputVectorDistanceMatrix

public AbstractMemoryInputVectorDistanceMatrix(InputData data,
                                               DistanceMetric metric)
                                        throws MetricException
Constructs the distance matrix by computing the distances on the fly. Not suited for large data sets, where the computation time might take long (consider reading it from a file using AbstractMemoryInputVectorDistanceMatrix(String))

Throws:
MetricException

AbstractMemoryInputVectorDistanceMatrix

public AbstractMemoryInputVectorDistanceMatrix(String fileName)
                                        throws IOException,
                                               SOMToolboxException
Reads the distance matrix from an ASCII file, and stores it in memory.

Throws:
IOException
SOMToolboxException
Method Detail

initStorage

protected abstract void initStorage()

setValue

protected abstract void setValue(int x,
                                 int y,
                                 double value)