Package com.imsl.math

Class ComplexMatrix

java.lang.Object
com.imsl.math.ComplexMatrix

public class ComplexMatrix extends Object
Complex matrix manipulation functions.
See Also:
  • Method Details

    • checkMatrix

      public static void checkMatrix(Complex[][] a)
      Check that all of the rows in the Complex matrix have the same length.
      Parameters:
      a - a Complex matrix
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • CheckMatrix

      public static void CheckMatrix(Complex[][] a)
      Deprecated.
      Check that all of the rows in the Complex matrix have the same length.
      Parameters:
      a - a Complex matrix
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • checkSquareMatrix

      public static void checkSquareMatrix(Complex[][] a)
      Check that the Complex matrix is square.
      Parameters:
      a - a Complex matrix
      Throws:
      IllegalArgumentException - This exception is thrown if the matrix is not square.
    • CheckSquareMatrix

      public static void CheckSquareMatrix(Complex[][] a)
      Deprecated.
      Check that the Complex matrix is square.
      Parameters:
      a - a Complex matrix
      Throws:
      IllegalArgumentException - This exception is thrown if the matrix is not square.
    • transpose

      public static Complex[][] transpose(Complex[][] a)
      Return the transpose of a Complex matrix.
      Parameters:
      a - a Complex matrix
      Returns:
      the Complex matrix transpose of the argument
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • multiply

      public static Complex[] multiply(Complex[] x, Complex[][] a)
      Return the product of the row vector x and the rectangular array a, both Complex.
      Parameters:
      x - a Complex row vector
      a - a Complex rectangular matrix
      Returns:
      a Complex vector containing the product of the arguments, x*a.
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of the input matrix are not uniform, or (2) the number of elements in the input vector is not equal to the number of rows of the matrix.
    • multiply

      public static Complex[] multiply(Complex[] x, Complex[][] a, ComplexMatrix.MatrixType aType)
      Return the product of the row vector x and the rectangular array a, both Complex.
      Parameters:
      x - a Complex row vector
      a - a Complex rectangular matrix
      aType - a MatrixType indicating if matrix a is general, symmetric or Hermitian
      Returns:
      a Complex vector containing the product of the arguments, x*a.
      Throws:
      IllegalArgumentException - This exception is thrown when (1) the lengths of the rows of the input matrix are not uniform, or (2) the number of elements in the input vector is not equal to the number of rows of the matrix, or (3) the input matrix is not square in the symmetric or Hermitian case.
    • multiply

      public static Complex[] multiply(Complex[][] a, Complex[] x)
      Multiply the rectangular array a and the column vector x, both Complex.
      Parameters:
      a - a Complex rectangular matrix
      x - a Complex vector
      Returns:
      a Complex vector containing the product of the arguments, a*x
      Throws:
      IllegalArgumentException - This exception is thrown when (1) the lengths of the rows of the input matrix are not uniform, and (2) the number of columns in the input matrix is not equal to the number of elements in the input vector.
    • multiply

      public static Complex[] multiply(Complex[][] a, ComplexMatrix.MatrixType aType, Complex[] x)
      Multiply the rectangular array a and the column vector x, both Complex.
      Parameters:
      a - a Complex rectangular matrix
      aType - a MatrixType indicating if matrix a is general, symmetric or Hermitian
      x - a Complex vector
      Returns:
      a Complex vector containing the product of the arguments, a*x
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of the input matrix are not uniform, or (2) the number of columns in the input matrix is not equal to the number of elements in the input vector, or (3) the input matrix is not square in the symmetric or Hermitian case.
    • multiply

      public static Complex[][] multiply(Complex[][] a, Complex[][] b)
      Multiply two Complex rectangular arrays, a * b.
      Parameters:
      a - a Complex rectangular array
      b - a Complex rectangular array
      Returns:
      the Complex matrix product of a times b
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the number of columns in a is not equal to the number of rows in b.
    • multiply

      public static Complex[][] multiply(Complex[][] a, Complex[][] b, int numberOfThreads)
      Multiply two Complex rectangular arrays, a * b, using multiple java.lang.Threads.
      Parameters:
      a - a Complex rectangular array
      b - a Complex rectangular array
      numberOfThreads - An int which specifies the number of java.lang.Thread instances to use. If numberOfThreads is less than 1, then numberOfThreads = 1 is used.
      Returns:
      the Complex matrix product of a times b
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the number of columns in a is not equal to the number of rows in b.
    • multiply

      public static Complex[][] multiply(Complex[][] a, ComplexMatrix.MatrixType aType, Complex[][] b, ComplexMatrix.MatrixType bType, int numberOfThreads)
      Multiply two Complex rectangular arrays of type MatrixType, a * b, using multiple java.lang.Threads.
      Parameters:
      a - a Complex rectangular array
      aType - a MatrixType indicating if matrix a is general, symmetric or Hermitian
      b - a Complex rectangular array
      bType - a matrixType indicating if matrix b is general, symmetric or Hermitian
      numberOfThreads - An int which specifies the number of java.lang.Thread instances to use. If numberOfThreads is less than 1, then numberOfThreads = 1 is used.
      Returns:
      the Complex matrix product of a times b
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the number of columns in a is not equal to the number of rows in b, or (3) a symmetric or Hermitian input matrix a or b is not square.
    • multiply

      public static Complex multiply(Complex[] x, Complex[][] a, ComplexMatrix.MatrixType aType, Complex[] y, boolean equalVectors)
      Compute vector-matrix-vector product trans(conj(x)) * a * y.
      Parameters:
      x - a Complex vector
      a - a Complex rectangular matrix
      aType - a MatrixType indicating if matrix a is general, symmetric or Hermitian
      y - a Complex vector
      equalVectors - a boolean indicating if the two vectors x and y are numerically equal
      Returns:
      a Complex scalar representing the product of the arguments, trans(conj(x))*a*y
    • add

      public static Complex[][] add(Complex[][] a, Complex[][] b)
      Add two rectangular Complex arrays, a + b.
      Parameters:
      a - a Complex rectangular array
      b - a Complex rectangular array
      Returns:
      the Complex matrix sum of the two arguments
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the matrices are not the same size.
    • subtract

      public static Complex[][] subtract(Complex[][] a, Complex[][] b)
      Subtract two Complex rectangular arrays, a - b.
      Parameters:
      a - a Complex rectangular array
      b - a Complex rectangular array
      Returns:
      the Complex matrix difference of the two arguments.
      Throws:
      IllegalArgumentException - This exception is thrown if (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the matrices are not the same size.
    • oneNorm

      public static double oneNorm(Complex[][] a)
      Return the Complex matrix one norm.
      Parameters:
      a - a Complex rectangular array
      Returns:
      a double value equal to the maximum of the column sums of the absolute values of the array elements
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • frobeniusNorm

      public static double frobeniusNorm(Complex[][] a)
      Return the Frobenius norm of a Complex matrix.
      Parameters:
      a - a Complex rectangular matrix
      Returns:
      a double value equal to the Frobenius norm of the matrix
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • infinityNorm

      public static double infinityNorm(Complex[][] a)
      Return the infinity norm of a Complex matrix.
      Parameters:
      a - a Complex rectangular matrix
      Returns:
      a double value equal to the maximum of the row sums of the absolute values of the array elements.
      Throws:
      IllegalArgumentException - This exception is thrown if the the lengths of the rows of the input matrix are not uniform.
    • isSymmetric

      public static boolean isSymmetric(Complex[][] a)
      Check if the Complex matrix is symmetric.
      Parameters:
      a - a Complex rectangular array
      Returns:
      a boolean which is true if the matrix is symmetric and false otherwise.
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.
    • isHermitian

      public static boolean isHermitian(Complex[][] a)
      Check if the Complex matrix is Hermitian.
      Parameters:
      a - a Complex rectangular array
      Returns:
      a boolean which is true if the matrix is Hermitian and false otherwise.
      Throws:
      IllegalArgumentException - This exception is thrown if the lengths of the rows of the input matrix are not uniform.