Package mathvoyage

Class vmath.matrix

java.lang.Object
mathvoyage.vmath.matrix
Enclosing class:
vmath

public static class vmath.matrix extends Object
Contains functions to calculate the determinant, inverse, transpose, addition, subtraction, multiplication, and more of matrices.
Author:
Adib Sakhawat
  • Constructor Details

    • matrix

      public matrix()
  • Method Details

    • add

      public static Matrix add(Matrix a, Matrix b)
      Returns the addition of two matrices.
      Parameters:
      a - The first matrix
      b - The second matrix
      Returns:
      The addition of the two matrices
    • subtract

      public static Matrix subtract(Matrix a, Matrix b)
      Returns the subtraction of two matrices.
      Parameters:
      a - The first matrix
      b - The second matrix
      Returns:
      The subtraction of the two matrices
    • multiply

      public static Matrix multiply(Matrix a, Matrix b)
      Returns the multiplication of two matrices.
      Parameters:
      a - The first matrix
      b - The second matrix
      Returns:
      The multiplication of the two matrices
    • multiply

      public static Matrix multiply(Matrix m, double x)
      Returns the multiplication of a matrix and a number.
      Parameters:
      m - The matrix
      x - The number
      Returns:
      The multiplication of the matrix and the number
    • transpose

      public static Matrix transpose(Matrix a)
      Returns the transpose of a matrix.
      Parameters:
      a - The matrix
      Returns:
      The transpose of the matrix
    • inverse

      public static Matrix inverse(Matrix a)
      Returns the inverse of a matrix.
      Parameters:
      a - The matrix
      Returns:
      The inverse of the matrix
    • determinant

      public static double determinant(Matrix a)
      Returns the determinant of a matrix.
      Parameters:
      a - The matrix
      Returns:
      The determinant of the matrix
    • zeros

      public static Matrix zeros(int rows, int cols)
      Returns a matrix of zeros of the given size.
      Parameters:
      rows - The number of rows
      cols - The number of columns
      Returns:
      The matrix of zeros
    • ones

      public static Matrix ones(int rows, int cols)
      Returns a matrix of ones of the given size.
      Parameters:
      rows - The number of rows
      cols - The number of columns
      Returns:
      The matrix of ones
    • eye

      public static Matrix eye(int n)
      Returns an identity matrix of the given size.
      Parameters:
      n - The size of the matrix
      Returns:
      The identity matrix
    • compare

      public static boolean compare(Matrix a, Matrix b)
      Compares two matrices.
      Parameters:
      a - The first matrix
      b - The second matrix
      Returns:
      true if the matrices are equal, else false
    • pow

      public static Matrix pow(Matrix a, int power)
      Returns the power of a matrix.
      Parameters:
      a - The matrix
      power - The power
      Returns:
      The power of the matrix