SOMVizard documentation
Public API

som
Class FVector

java.lang.Object
  |
  +--som.FVector

public class FVector
extends java.lang.Object

A feature vector.

Author:
Antti Kerminen

Field Summary
protected  double[] vector
          Elements of the feature vector.
 
Constructor Summary
FVector(som.FVectorGroup group)
          Construct a new feature vector in the given group.
FVector(int length)
          Construct a new feature vector with the given length.
FVector(java.lang.String s)
          Construct a new feature vector from a string representation.
FVector(java.lang.String s, int length)
          Construct a new feature vector from a string representation with the length of the vector known.
 
Method Summary
 void add(som.FVector v)
          Add a vector to this vector.
 double difference(som.FVector v)
          Calculate an ad hoc difference measure.
 int dimension()
          Get the dimensionality of this vector.
 double distance(som.FVector v)
          Calculate the Euclidian distance to another vector.
 double dotProduct(som.FVector v)
          Calculate the dot product between this and another vector.
 double getValue(int index)
          Get the value of an element.
 double length()
          Calculate the geometric length of this vector.
static void main(java.lang.String[] args)
          A test driver.
 void normalize()
          Normalize the length of the vector to 1.
 void setAll()
          Set all values to 1.
 void setUnit(int feature)
          Set vector as unit vector.
 void setValue(int index, double value)
          Set the value of an element.
 java.lang.String toString()
          Return the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vector

protected double[] vector
Elements of the feature vector.

Constructor Detail

FVector

public FVector(java.lang.String s)
Construct a new feature vector from a string representation.


FVector

public FVector(java.lang.String s,
               int length)
Construct a new feature vector from a string representation with the length of the vector known.


FVector

public FVector(int length)
Construct a new feature vector with the given length.


FVector

public FVector(som.FVectorGroup group)
Construct a new feature vector in the given group.

Method Detail

setUnit

public void setUnit(int feature)
Set vector as unit vector.

Parameters:
feature - the index of the feature to be set.

setAll

public void setAll()
Set all values to 1.


setValue

public void setValue(int index,
                     double value)
Set the value of an element.

Parameters:
index - the index of the element.
value - the value of the element.

getValue

public double getValue(int index)
Get the value of an element.

Parameters:
index - the index of the element.
Returns:
the value of the element.

add

public void add(som.FVector v)
Add a vector to this vector.


distance

public double distance(som.FVector v)
Calculate the Euclidian distance to another vector.


dotProduct

public double dotProduct(som.FVector v)
Calculate the dot product between this and another vector.


difference

public double difference(som.FVector v)
Calculate an ad hoc difference measure.


normalize

public void normalize()
Normalize the length of the vector to 1.


length

public double length()
Calculate the geometric length of this vector.


dimension

public int dimension()
Get the dimensionality of this vector. That is the number of elements.


toString

public java.lang.String toString()
Return the string representation of this object.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
A test driver.


SOMVizard documentation
Public API

Copyright © 2003 - All rights reserved.
Antti Kerminen