Class Matrix

java.lang.Object
org.openscience.cdk.math.Matrix

public class Matrix extends Object
This class contains a matrix.
Author:
Stephan Michels <stephan@vern.chem.tu-berlin.de>
Source code:
main
Belongs to CDK module:
qm
Created on:
2001-06-07
  • Field Details

    • matrix

      public final double[][] matrix
      the content of this matrix
    • rows

      public final int rows
      the number of rows of this matrix
    • columns

      public int columns
      the number of columns of this matrix
  • Constructor Details

    • Matrix

      public Matrix(int rows, int columns)
      Creates a new Matrix.
    • Matrix

      public Matrix(double[][] array)
      Creates a Matrix with content of an array.
  • Method Details

    • 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.
    • add

      public Matrix add(Matrix b)
      Adds two matrices.
    • sub

      public Matrix sub(Matrix b)
      Subtracts from two matrices.
    • mul

      public Matrix mul(Matrix b)
      Multiplies this Matrix with another one.
    • mul

      public Vector mul(Vector a)
      Multiplies a Vector with 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.
    • similar

      public Matrix similar(Matrix U)
      Similar transformation Ut * M * U
    • contraction

      public double contraction()
    • toString

      public String toString()
      Return a matrix as a String.
      Overrides:
      toString in class Object
    • 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
    • normalize

      public Matrix normalize(Matrix S)
      Normalizes the vectors of this matrix.