java.lang.Object
com.marginallyclever.convenience.helpers.BigMatrixHelper

public abstract class BigMatrixHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[][]
    createMatrix(int rows, int cols)
     
    static double
    determinant(double[][] matrix)
    Method that calculates determinant of given matrix
    static double[][]
    invert(double[][] a)
    invert an N*N matrix.
    static double[]
    matrix4dToArray(javax.vecmath.Matrix4d m)
    Convert a Matrix4d to an array of doubles.
    static double[][]
    minor(double[][] matrix, int row, int column)
    Method that creates minor of given matrix
    static double[]
    multiply(double[][] a, double[] x)
    matrix-vector multiplication (y = A * x)
    static double[][]
    multiplyMatrices(double[][] x, double[][] y)
    Method that multiplies two matrices and returns the result
    static void
    printMatrix(double[][] matrix)
    Method that prints matrix
    static double[][]
    transpose(double[][] matrix)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BigMatrixHelper

      public BigMatrixHelper()
  • Method Details

    • invert

      public static double[][] invert(double[][] a)
      invert an N*N matrix. See ...
      Parameters:
      a - the matrix to invert.
      Returns:
      the result.
    • transpose

      public static double[][] transpose(double[][] matrix)
    • determinant

      public static double determinant(double[][] matrix)
      Method that calculates determinant of given matrix
      Parameters:
      matrix - matrix of which we need to know determinant
      Returns:
      determinant of given matrix
    • minor

      public static double[][] minor(double[][] matrix, int row, int column)
      Method that creates minor of given matrix
      Parameters:
      matrix - matrix of which we need to create minor
      row - row of element to exclude
      column - column of element to exclude
      Returns:
      minor of given matrix
    • multiplyMatrices

      public static double[][] multiplyMatrices(double[][] x, double[][] y)
      Method that multiplies two matrices and returns the result
      Parameters:
      x - first matrix
      y - second matrix
      Returns:
      result after multiplication
    • multiply

      public static double[] multiply(double[][] a, double[] x)
      matrix-vector multiplication (y = A * x)
      Parameters:
      a - matrix
      x - vector
      Returns:
      result of multiplication
    • printMatrix

      public static void printMatrix(double[][] matrix)
      Method that prints matrix
      Parameters:
      matrix - matrix to print
    • createMatrix

      public static double[][] createMatrix(int rows, int cols)
    • matrix4dToArray

      public static double[] matrix4dToArray(javax.vecmath.Matrix4d m)
      Convert a Matrix4d to an array of doubles. Matrix4d is row-major and OpenGL is column-major.
      Parameters:
      m - the matrix to convert
      Returns:
      a double array of length 16