struct.types
Class SLFeatureVector

java.lang.Object
  extended by struct.types.SLFeatureVector
All Implemented Interfaces:
java.lang.Comparable

public class SLFeatureVector
extends java.lang.Object
implements java.lang.Comparable

The feature vector.

Version:
08/15/2006

Field Summary
 int index
           
 SLFeatureVector next
           
 double value
           
 
Constructor Summary
SLFeatureVector(int i, double v, SLFeatureVector n)
           
 
Method Summary
 void add(int i1, double v1)
          Takes the new parameters and becomes the head of the chain.
 SLFeatureVector add(java.lang.String feat, double val, edu.umass.cs.mallet.base.types.Alphabet dataAlphabet)
          Adds itself to another SLFeatureVector if the other feature is valid.
static SLFeatureVector cat(SLFeatureVector fv1, SLFeatureVector fv2)
          Concatenates both the SLFeatureVectors
 int compareTo(java.lang.Object o)
           
 double dotProdoct(double[] weights)
          Computes the dot product of this SLFeatureVector with the given weights.
static double dotProduct(SLFeatureVector fv1, SLFeatureVector fv2)
          Computes the dot product of both the SLFeatureVectors.
static SLFeatureVector getDistVector(SLFeatureVector fv1, SLFeatureVector fv2)
          Creates and returns the distance vector(fv1 - fv2) of both the SLFeatureVectors.
static SLFeatureVector normalize(SLFeatureVector fv1, double norm)
          Normalizes the SLFeatureVector with the given norm.
static double oneNorm(SLFeatureVector fv1)
          Computes the first norm of the SLFeatureVector.
static SLFeatureVector oneNormalize(SLFeatureVector fv1)
          Normalizes the SLFeatureVector with its first norm.
static int size(SLFeatureVector fv1)
          Computes the size of the SLFeatureVector.
 void sort()
           
 java.lang.String toString()
           
static double twoNorm(SLFeatureVector fv1)
          Computes the second norm of the SLFeatureVector.
static SLFeatureVector twoNormalize(SLFeatureVector fv1)
          Normalizes the SLFeatureVector with its second norm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public int index

value

public double value

next

public SLFeatureVector next
Constructor Detail

SLFeatureVector

public SLFeatureVector(int i,
                       double v,
                       SLFeatureVector n)
Method Detail

add

public SLFeatureVector add(java.lang.String feat,
                           double val,
                           edu.umass.cs.mallet.base.types.Alphabet dataAlphabet)
Adds itself to another SLFeatureVector if the other feature is valid.


add

public void add(int i1,
                double v1)
Takes the new parameters and becomes the head of the chain.


cat

public static SLFeatureVector cat(SLFeatureVector fv1,
                                  SLFeatureVector fv2)
Concatenates both the SLFeatureVectors


getDistVector

public static SLFeatureVector getDistVector(SLFeatureVector fv1,
                                            SLFeatureVector fv2)
Creates and returns the distance vector(fv1 - fv2) of both the SLFeatureVectors.


dotProduct

public static double dotProduct(SLFeatureVector fv1,
                                SLFeatureVector fv2)
Computes the dot product of both the SLFeatureVectors.


oneNorm

public static double oneNorm(SLFeatureVector fv1)
Computes the first norm of the SLFeatureVector.


size

public static int size(SLFeatureVector fv1)
Computes the size of the SLFeatureVector.


twoNorm

public static double twoNorm(SLFeatureVector fv1)
Computes the second norm of the SLFeatureVector.


twoNormalize

public static SLFeatureVector twoNormalize(SLFeatureVector fv1)
Normalizes the SLFeatureVector with its second norm.


oneNormalize

public static SLFeatureVector oneNormalize(SLFeatureVector fv1)
Normalizes the SLFeatureVector with its first norm.


normalize

public static SLFeatureVector normalize(SLFeatureVector fv1,
                                        double norm)
Normalizes the SLFeatureVector with the given norm.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

sort

public void sort()

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

dotProdoct

public double dotProdoct(double[] weights)
Computes the dot product of this SLFeatureVector with the given weights.



Copyright (C) 2006 University of Pennsylvania.