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

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

public class FullMemoryInputVectorDistanceMatrix
extends AbstractMemoryInputVectorDistanceMatrix

This class implements an AbstractMemoryInputVectorDistanceMatrix using a two-dimensional double array (i.e. double[][]).
This implies a higher memory consumption as compared to LeightWeightMemoryInputVectorDistanceMatrix, but also faster access times for getDistance(int, int) and getDistances(int), while InputVectorDistanceMatrix.getDistancesFlat() needs to be generated on the fly.

Version:
$Id: FullMemoryInputVectorDistanceMatrix.java 3704 2010-07-20 10:42:42Z mayer $
Author:
Rudolf Mayer

Field Summary
protected  double[][] distanceMatrix
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.data.distance.AbstractMemoryInputVectorDistanceMatrix
FILE_TYPE
 
Fields inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
inputLabels, metric, numVectors
 
Constructor Summary
FullMemoryInputVectorDistanceMatrix(InputData data, DistanceMetric metric)
           
FullMemoryInputVectorDistanceMatrix(String fileName)
           
 
Method Summary
 double getDistance(int x, int y)
          Return the distance between input vectors x and y.
 double[] getDistances(int x)
          Return the distances to all vectors from input x.
 ArrayList<InputNameDistance> getNamedDistances(int x)
           
protected  void initStorage()
           
protected  void setValue(int x, int y, double value)
           
 
Methods inherited from class at.tuwien.ifs.somtoolbox.data.distance.InputVectorDistanceMatrix
columns, equals, flatArraySize, 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

distanceMatrix

protected double[][] distanceMatrix
Constructor Detail

FullMemoryInputVectorDistanceMatrix

public FullMemoryInputVectorDistanceMatrix(InputData data,
                                           DistanceMetric metric)
                                    throws MetricException
Throws:
MetricException

FullMemoryInputVectorDistanceMatrix

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

setValue

protected void setValue(int x,
                        int y,
                        double value)
Specified by:
setValue in class AbstractMemoryInputVectorDistanceMatrix

initStorage

protected void initStorage()
Specified by:
initStorage in class AbstractMemoryInputVectorDistanceMatrix

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

getDistances

public double[] getDistances(int x)
Description copied from class: InputVectorDistanceMatrix
Return the distances to all vectors from input x. This is a basic using InputVectorDistanceMatrix.getDistance(int, int), sub-classes might provide an optimised implementation.

Overrides:
getDistances in class InputVectorDistanceMatrix

getNamedDistances

public ArrayList<InputNameDistance> getNamedDistances(int x)