edu.mines.jtk.dsp
Class EigenTensors2

java.lang.Object
  extended by edu.mines.jtk.dsp.EigenTensors2
All Implemented Interfaces:
Tensors2

public class EigenTensors2
extends java.lang.Object
implements Tensors2

An array of eigen-decompositions of tensors for 2D image processing. Each tensor is a symmetric positive-semidefinite 2-by-2 matrix:


 A = |a11 a12|
     |a12 a22|
 
Such tensors can be used to parameterize anisotropic image processing.

The eigen-decomposition of the matrix A is


 A = au*u*u' + av*v*v'
   = (au-av)*u*u' + av*I
 
where u and v are orthogonal unit eigenvectors of A. (The notation u' denotes the transpose of u.) The outer products of eigenvectors are scaled by the non-negative eigenvalues au and av. The second equation exploits the identity u*u' + v*v' = I, and makes apparent the redundancy of the vector v.

Version:
2008.06.09
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
EigenTensors2(float[][] u1, float[][] u2, float[][] au, float[][] av)
          Constructs tensors for specified array dimensions and eigenvalues.
EigenTensors2(int n1, int n2)
          Constructs tensors for specified array dimensions.
 
Method Summary
 void getEigenvalues(float[][] au, float[][] av)
          Gets eigenvalues for all tensors.
 float[] getEigenvalues(int i1, int i2)
          Gets eigenvalues for the tensor with specified indices.
 void getEigenvalues(int i1, int i2, float[] a)
          Gets eigenvalues for the tensor with specified indices.
 float[] getEigenvectorU(int i1, int i2)
          Gets the eigenvector u for the tensor with specified indices.
 void getEigenvectorU(int i1, int i2, float[] u)
          Gets the eigenvector u for the tensor with specified indices.
 float[] getEigenvectorV(int i1, int i2)
          Gets the eigenvector v for the tensor with specified indices.
 void getEigenvectorV(int i1, int i2, float[] v)
          Gets the eigenvector v for the tensor with specified indices.
 int getN1()
          Gets the number of tensors in the 1st dimension.
 int getN2()
          Gets the number of tensors in the 2nd dimension.
 float[] getTensor(int i1, int i2)
          Gets tensor elements for specified indices.
 void getTensor(int i1, int i2, float[] a)
          Gets tensor elements for specified indices.
 void setEigenvalues(float[][] au, float[][] av)
          Sets eigenvalues for all tensors.
 void setEigenvalues(float au, float av)
          Sets eigenvalues for all tensors.
 void setEigenvalues(int i1, int i2, float[] a)
          Sets eigenvalues for the tensor with specified indices.
 void setEigenvalues(int i1, int i2, float au, float av)
          Sets eigenvalues for the tensor with specified indices.
 void setEigenvectorU(int i1, int i2, float[] u)
          Sets the eigenvector u for the tensor with specified indices.
 void setEigenvectorU(int i1, int i2, float u1, float u2)
          Sets the eigenvector u for the tensor with specified indices.
 void setTensor(int i1, int i2, float[] a)
          Sets tensor elements for specified indices.
 void setTensor(int i1, int i2, float a11, float a12, float a22)
          Sets tensor elements for specified indices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EigenTensors2

public EigenTensors2(int n1,
                     int n2)
Constructs tensors for specified array dimensions. All eigenvalues and eigenvectors are not set and are initially zero.

Parameters:
n1 - number of tensors in 1st dimension.
n2 - number of tensors in 2nd dimension.

EigenTensors2

public EigenTensors2(float[][] u1,
                     float[][] u2,
                     float[][] au,
                     float[][] av)
Constructs tensors for specified array dimensions and eigenvalues.

Parameters:
u1 - array of 1st components of u.
u2 - array of 2nd components of u.
au - array of 1D eigenvalues.
av - array of 2D eigenvalues.
Method Detail

getN1

public int getN1()
Gets the number of tensors in the 1st dimension.

Returns:
the number of tensors in the 1st dimension.

getN2

public int getN2()
Gets the number of tensors in the 2nd dimension.

Returns:
the number of tensors in the 2nd dimension.

getTensor

public void getTensor(int i1,
                      int i2,
                      float[] a)
Gets tensor elements for specified indices.

Specified by:
getTensor in interface Tensors2
Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
a - array {a11,a12,a22} of tensor elements.

getTensor

public float[] getTensor(int i1,
                         int i2)
Gets tensor elements for specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
Returns:
a array {a11,a12,a22} of tensor elements.

getEigenvalues

public void getEigenvalues(int i1,
                           int i2,
                           float[] a)
Gets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
a - array {au,av} of eigenvalues.

getEigenvalues

public float[] getEigenvalues(int i1,
                              int i2)
Gets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
Returns:
array {au,av} of eigenvalues.

getEigenvalues

public void getEigenvalues(float[][] au,
                           float[][] av)
Gets eigenvalues for all tensors.

Parameters:
au - array of eigenvalues au.
av - array of eigenvalues av.

getEigenvectorU

public void getEigenvectorU(int i1,
                            int i2,
                            float[] u)
Gets the eigenvector u for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
u - array {u1,u2} of eigenvector components.

getEigenvectorU

public float[] getEigenvectorU(int i1,
                               int i2)
Gets the eigenvector u for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
Returns:
array {u1,u2} of eigenvector components.

getEigenvectorV

public void getEigenvectorV(int i1,
                            int i2,
                            float[] v)
Gets the eigenvector v for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
v - array {v1,v2} of eigenvector components.

getEigenvectorV

public float[] getEigenvectorV(int i1,
                               int i2)
Gets the eigenvector v for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
Returns:
array {v1,v2} of eigenvector components.

setTensor

public void setTensor(int i1,
                      int i2,
                      float[] a)
Sets tensor elements for specified indices. This method first computes an eigen-decomposition of the specified tensor, and then stores the computed eigenvectors and eigenvalues. The eigenvalues are ordered such that au >= av >= 0.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
a - array {a11,a12,a22} of tensor elements.

setTensor

public void setTensor(int i1,
                      int i2,
                      float a11,
                      float a12,
                      float a22)
Sets tensor elements for specified indices. This method first computes an eigen-decomposition of the specified tensor, and then stores the computed eigenvectors and eigenvalues. The eigenvalues are ordered such that au >= av >= 0.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
a11 - tensor element a11.
a12 - tensor element a12.
a22 - tensor element a22.

setEigenvalues

public void setEigenvalues(float au,
                           float av)
Sets eigenvalues for all tensors.

Parameters:
au - eigenvalue au.
av - eigenvalue av.

setEigenvalues

public void setEigenvalues(int i1,
                           int i2,
                           float au,
                           float av)
Sets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
au - eigenvalue au.
av - eigenvalue av.

setEigenvalues

public void setEigenvalues(int i1,
                           int i2,
                           float[] a)
Sets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
a - array {au,av} of eigenvalues.

setEigenvalues

public void setEigenvalues(float[][] au,
                           float[][] av)
Sets eigenvalues for all tensors.

Parameters:
au - array of eigenvalues au.
av - array of eigenvalues av.

setEigenvectorU

public void setEigenvectorU(int i1,
                            int i2,
                            float u1,
                            float u2)
Sets the eigenvector u for the tensor with specified indices. The specified vector is assumed to have length one.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
u1 - 1st component of u.
u2 - 2nd component of u.

setEigenvectorU

public void setEigenvectorU(int i1,
                            int i2,
                            float[] u)
Sets the eigenvector u for the tensor with specified indices. The specified vector is assumed to have length one.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
u - {u1,u2} of eigenvector components.