Package org.openscience.cdk.math
Class Matrix
- java.lang.Object
-
- org.openscience.cdk.math.Matrix
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
add(Matrix b)
Adds two matrices.double
contraction()
Matrix
diagonalize(int maxNumRot)
Diagonalize this matrix with the Jacobi algorithm.Matrix
duplicate()
Copies a matrix.static Vector
elimination(Matrix matrix, Vector vector)
Solves a linear equation system with Gauss elimination.int
getColumns()
Returns the number of columns.int
getRows()
Returns the number of rows.Vector
getVectorFromColumn(int index)
Creates a Vector with the content of a column from this Matrix.Vector
getVectorFromDiagonal()
Creates a Vector with the content of the diagonal elements from this Matrix.Vector
getVectorFromRow(int index)
Creates a Vector with the content of a row from this Matrix.Matrix
mul(double a)
Multiplies a scalar with this Matrix.Matrix
mul(Matrix b)
Multiplies this Matrix with another one.Vector
mul(Vector a)
Multiplies a Vector with this Matrix.Matrix
normalize(Matrix S)
Normalizes the vectors of this matrix.Matrix
orthonormalize(Matrix S)
Orthonormalize the vectors of this matrix by Gram-Schmidt.Matrix
similar(Matrix U)
Similar transformation Ut * M * UMatrix
sub(Matrix b)
Subtracts from two matrices.String
toString()
Return a matrix as a String.Matrix
transpose()
Transposes a matrix.
-
-
-
Method Detail
-
getRows
public int getRows()
Returns the number of rows.
-
getColumns
public int getColumns()
Returns the number of columns.
-
getVectorFromRow
public Vector getVectorFromRow(int index)
Creates a Vector with the content of a row from this Matrix.
-
getVectorFromColumn
public Vector getVectorFromColumn(int index)
Creates a Vector with the content of a column from this Matrix.
-
getVectorFromDiagonal
public Vector getVectorFromDiagonal()
Creates a Vector with the content of the diagonal elements from this Matrix.
-
mul
public Matrix mul(double a)
Multiplies a scalar with this Matrix.
-
duplicate
public Matrix duplicate()
Copies a matrix.
-
transpose
public Matrix transpose()
Transposes a matrix.
-
contraction
public double contraction()
-
diagonalize
public Matrix diagonalize(int maxNumRot)
Diagonalize this matrix with the Jacobi algorithm.- Parameters:
maxNumRot
- Count of max. rotations- Returns:
- Matrix m, with m^t * this * m = diagonal
- Keywords:
- Jacobi algorithm, diagonalization
-
elimination
public static Vector elimination(Matrix matrix, Vector vector)
Solves a linear equation system with Gauss elimination.- Keywords:
- Gauss elimination
-
orthonormalize
public Matrix orthonormalize(Matrix S)
Orthonormalize the vectors of this matrix by Gram-Schmidt.- Keywords:
- orthonormalization, Gram-Schmidt algorithm
-
-