bijnum
Class BIJJacobi

java.lang.Object
  |
  +--bijnum.BIJJacobi

public class BIJJacobi
extends java.lang.Object

This class implements the jacobi function as a Java class. Redesigned to be faster, for float. Internal calculations are still double though. From Press et al., 2nd ed., Numerical Solutions in C.

See Also:
for the original sources which I kept to be sure because they worked. Copyright (c) 1999-2003, Michael Abramoff. All rights reserved.

Field Summary
 float[][] a
          The matrix of which you want to compute E.
protected  boolean doFeedback
          Whether to show a showProgress() in ImageJ only.
 float[] eigenvalues
           
 float[][] eigenvectors
           
protected  int n
           
protected  int nrot
           
protected  int sweeps
           
protected static float UNDERFLOW_LIMIT
           
 
Constructor Summary
BIJJacobi(float[][] m)
          Create new instance to compute eigenvectors, eigenvalues.
BIJJacobi(float[][] m, boolean doFeedback)
          Create new instance to compute eigenvectors, eigenvalues.
 
Method Summary
 void compute()
          Compute all eigenvalues and eigenvectors of a real symmetric matrix a[N][N].
 int nrot()
           
protected  void rotate(float[][] a, int i, int j, int k, int l, double s, double tau)
          Rotate, used to be a macro in C sources.
 void sort()
          Sort the eigenvalues/eigenvectors on the basis of the eigenvalues, largest first.
 int sweeps()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

public float[][] a
The matrix of which you want to compute E.

eigenvectors

public float[][] eigenvectors

eigenvalues

public float[] eigenvalues

doFeedback

protected boolean doFeedback
Whether to show a showProgress() in ImageJ only.

n

protected int n

nrot

protected int nrot

sweeps

protected int sweeps

UNDERFLOW_LIMIT

protected static final float UNDERFLOW_LIMIT
Constructor Detail

BIJJacobi

public BIJJacobi(float[][] m,
                 boolean doFeedback)
Create new instance to compute eigenvectors, eigenvalues.
Parameters:
m - a real, symmetric matrix of nxn.
doFeedback, - whether a progress routine should be called after each sweep (only for user interaction).

BIJJacobi

public BIJJacobi(float[][] m)
Create new instance to compute eigenvectors, eigenvalues.
Parameters:
m - a real symmetric matrix of NxN.
Method Detail

compute

public void compute()
Compute all eigenvalues and eigenvectors of a real symmetric matrix a[N][N]. Will destroy a!. The eigenvalues/eigenvectors can be obtained from the corresponding public variables. From: Press et al., Numerical Recipes in C, 2nd ed., pp 467-

sort

public void sort()
Sort the eigenvalues/eigenvectors on the basis of the eigenvalues, largest first. Straight insertion method.

rotate

protected void rotate(float[][] a,
                      int i,
                      int j,
                      int k,
                      int l,
                      double s,
                      double tau)
Rotate, used to be a macro in C sources. The comment below applies to C source, but I kept it in for historical reasons. Note: Numerical Recipes source uses a #define for function "rotate". On some compilers this may result in a nonfunctional jacobi (took me 3 days to find this out). So please keep "rotate" as a function!

nrot

public int nrot()

sweeps

public int sweeps()

toString

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