jvx.numeric
Class PnJacobi
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.numeric.PnJacobi
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf
public class PnJacobi extends PsObject
Compute eigenvectors and eigenvalues of a given symmetric matrix and store in result vectors.- See Also:
- Serialized Form
- Author:
- Konrad Polthier
- Version:
- 04.02.15, 2.31 revised (kp) Doc improved, mention requirement of symmetric matrices.
20.12.01, 2.30 revised (ep) Internationalization.
08.11.00, 2.20 revised (kp) Replace formatting with PuString rather than Fmt.
08.09.99, 2.10 revised (kp) Moved to project jv.numeric from jv.geom.
07.09.99, 2.00 revised (kp) ComputeEigenvectors() converted to static method.
00.00.98, 1.00 created (kp)
-
-
Field Summary
Fields Modifier and Type Field and Description static intFAILUREReturn value of computation method if failure.static intINTERRUPTEDReturn value of computation method if interrupted from outside.-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
-
Constructor Summary
Constructors Constructor and Description PnJacobi()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static intcomputeEigenvectors(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)Compute eigenvectors and eigenvalues of a given symmetric matrix and store in result vectors.static intfcomputeEigenvectors(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)Compute eigenvectors and eigenvalues of a given symmetric matrix and store in result vectors.booleanisDoublePrecision()static booleanisInterrupted()Get flag if the previous computation was interrupted from outside.static voidprintEigenvalues(int dim, PdVector eValue)Sort eigenvalues by increasing eigenvalue and print to JavaView console.static voidprintEigenvectors(int dim, PdVector eValue, PdVector[] eVector)Sort eigenvalues and eigenvectors by increasing eigenvalue and print to JavaView console.voidsetDoublePrecision(boolean flag)Set flag weather computations are done in double or single precision.static voidsetInterrupted(boolean flag)Flag set from outside to interrupt the current computation.static booleantest(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)Test method validates if given eigenvectors are indeed eigenvectors of given matrix.-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, init, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, update, updatePanels
-
-
-
-
Field Detail
-
FAILURE
public static final int FAILURE
Return value of computation method if failure.- See Also:
- Constant Field Values
-
INTERRUPTED
public static final int INTERRUPTED
Return value of computation method if interrupted from outside.- See Also:
- Constant Field Values
-
-
Method Detail
-
setInterrupted
public static void setInterrupted(boolean flag)
Flag set from outside to interrupt the current computation. When a computation method is called then this flag is reset.
-
isInterrupted
public static boolean isInterrupted()
Get flag if the previous computation was interrupted from outside. Call this method after computeEigenvectors.
-
setDoublePrecision
public void setDoublePrecision(boolean flag)
Set flag weather computations are done in double or single precision.
-
isDoublePrecision
public boolean isDoublePrecision()
-
computeEigenvectors
public static int computeEigenvectors(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)
Compute eigenvectors and eigenvalues of a given symmetric matrix and store in result vectors. Method modifies the original matrix for internal use.This method uses double-precision. See
fcomputeEigenvectorswhich uses float-precision.- Parameters:
mat- Matrix whose eigenvalues and -vectors should be computed.dim- Size of square matrix, length of vectorseValue- Vector to store the computed eigenvalueseVector- Array of vectors to store the computed eigenvectors- Returns:
- Number of used iterations, or -1 if failure or -2 if interrupted.
- Author:
- Numerical Recipes, changed to Java and adapted by Konrad Polthier
- Version:
- 21.07.02, 2.20 revised (kp) Allow interruption of computation.
08.09.99, 2.10 revised (kp) Keep input matrix untouched.
07.09.99, 2.00 revised (kp) Converted to static method.
24.04.99, 1.10 revised (kp) eVectors were transposed, corrected.
00.00.98, 1.00 created (kp)
-
fcomputeEigenvectors
public static int fcomputeEigenvectors(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)
Compute eigenvectors and eigenvalues of a given symmetric matrix and store in result vectors. Method modifies the original matrix for internal use.This method uses float-precision. See
computeEigenvectorswhich uses double-precision.- Parameters:
mat- Matrix whose eigenvalues and -vectors should be computed.dim- Size of square matrix, length of vectorseValue- Vector to store the computed eigenvalueseVector- Array of vectors to store the computed eigenvectors- Returns:
- Number of used iterations, or -1 if failure or -2 if interrupted.
- Author:
- Numerical Recipes, changed to Java and adapted by Konrad Polthier
- Version:
- 26.10.02, 1.00 created (kp) From same double-precision version.
-
printEigenvectors
public static void printEigenvectors(int dim, PdVector eValue, PdVector[] eVector)Sort eigenvalues and eigenvectors by increasing eigenvalue and print to JavaView console.- Parameters:
dim- number of eigenvectorseValue- array of eigenvalueseVector- array of eigenvectors- Author:
- Konrad Polthier
-
printEigenvalues
public static void printEigenvalues(int dim, PdVector eValue)Sort eigenvalues by increasing eigenvalue and print to JavaView console.- Parameters:
dim- number of eigenvectorseValue- array of eigenvalues- Author:
- Konrad Polthier
-
test
public static boolean test(PdMatrix mat, int dim, PdVector eValue, PdVector[] eVector)
Test method validates if given eigenvectors are indeed eigenvectors of given matrix. Difference between given and evaluated eigenvalue is printed to JavaView console.- Parameters:
dim- number of eigenvectorseValue- array of eigenvalues- Author:
- Konrad Polthier
-
-
"