Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.math.linearalgebra
Class SortedEigenPairs

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.math.linearalgebra.SortedEigenPairs

public class SortedEigenPairs
extends Object

Helper class which encapsulates an array of eigenpairs (i.e. an array of eigenvectors and their corresponding eigenvalues). This class is used to sort eigenvectors (and -values).

Author:
Elke Achtert

Field Summary
private  EigenPair[] eigenPairs
          The array of eigenpairs.
 
Constructor Summary
private SortedEigenPairs()
          Creates a new empty SortedEigenPairs object.
  SortedEigenPairs(EigenvalueDecomposition evd, boolean ascending)
          Creates a new SortedEigenPairs object from the specified eigenvalue decomposition.
  SortedEigenPairs(List<EigenPair> eigenPairs)
          Creates a new SortedEigenPairs object from the specified list.
 
Method Summary
 SortedEigenPairs copy()
          Returns a deep copy of this object
 double[] eigenValues()
          Returns the sorted eigenvalues.
 Matrix eigenVectors()
          Returns the sorted eigenvectors.
 Matrix eigenVectors(int n)
          Returns the first n sorted eigenvectors as a matrix.
 EigenPair getEigenPair(int index)
          Returns the eigenpair at the specified index.
 Matrix reverseEigenVectors(int n)
          Returns the last n sorted eigenvectors as a matrix.
 int size()
          Returns the number of the eigenpairs.
 String toString()
          Returns a string representation of this EigenPair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eigenPairs

private EigenPair[] eigenPairs
The array of eigenpairs.

Constructor Detail

SortedEigenPairs

private SortedEigenPairs()
Creates a new empty SortedEigenPairs object. Can only be called from the copy() method.


SortedEigenPairs

public SortedEigenPairs(EigenvalueDecomposition evd,
                        boolean ascending)
Creates a new SortedEigenPairs object from the specified eigenvalue decomposition. The eigenvectors are sorted according to the specified order.

Parameters:
evd - the underlying eigenvalue decomposition
ascending - a boolean that indicates ascending order

SortedEigenPairs

public SortedEigenPairs(List<EigenPair> eigenPairs)
Creates a new SortedEigenPairs object from the specified list. The eigenvectors are sorted in descending order.

Parameters:
eigenPairs - the eigenpairs to be sorted
Method Detail

eigenValues

public double[] eigenValues()
Returns the sorted eigenvalues.

Returns:
the sorted eigenvalues

eigenVectors

public Matrix eigenVectors()
Returns the sorted eigenvectors.

Returns:
the sorted eigenvectors

eigenVectors

public Matrix eigenVectors(int n)
Returns the first n sorted eigenvectors as a matrix.

Parameters:
n - the number of eigenvectors (columns) to be returned
Returns:
the first n sorted eigenvectors

reverseEigenVectors

public Matrix reverseEigenVectors(int n)
Returns the last n sorted eigenvectors as a matrix.

Parameters:
n - the number of eigenvectors (columns) to be returned
Returns:
the last n sorted eigenvectors

getEigenPair

public EigenPair getEigenPair(int index)
Returns the eigenpair at the specified index.

Parameters:
index - the index of the eigenpair to be returned
Returns:
the eigenpair at the specified index

size

public int size()
Returns the number of the eigenpairs.

Returns:
the number of the eigenpairs

toString

public String toString()
Returns a string representation of this EigenPair.

Overrides:
toString in class Object
Returns:
a string representation of this EigenPair

copy

public SortedEigenPairs copy()
Returns a deep copy of this object

Returns:
new copy

Release 0.2 (2009-07-06_1820)