Package com.imsl.math
Class ComplexMatrix
java.lang.Object
com.imsl.math.ComplexMatrix
Complex matrix manipulation functions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumIndicates which matrix type is used. -
Method Summary
Modifier and TypeMethodDescriptionstatic Complex[][]Add two rectangularComplexarrays, a + b.static voidcheckMatrix(Complex[][] a) Check that all of the rows in theComplexmatrix have the same length.static voidCheckMatrix(Complex[][] a) Deprecated.static voidcheckSquareMatrix(Complex[][] a) Check that theComplexmatrix is square.static voidCheckSquareMatrix(Complex[][] a) Deprecated.UsecheckSquareMatrix(Complex[][])instead.static doublefrobeniusNorm(Complex[][] a) Return the Frobenius norm of aComplexmatrix.static doubleinfinityNorm(Complex[][] a) Return the infinity norm of aComplexmatrix.static booleanisHermitian(Complex[][] a) Check if theComplexmatrix is Hermitian.static booleanisSymmetric(Complex[][] a) Check if theComplexmatrix is symmetric.static Complex[]Multiply the rectangular array a and the column vector x, bothComplex.static Complex[][]Multiply twoComplexrectangular arrays, a * b.static Complex[][]Multiply twoComplexrectangular arrays,a*b, using multiplejava.lang.Threads.static Complex[]multiply(Complex[][] a, ComplexMatrix.MatrixType aType, Complex[] x) Multiply the rectangular array a and the column vector x, bothComplex.static Complex[][]multiply(Complex[][] a, ComplexMatrix.MatrixType aType, Complex[][] b, ComplexMatrix.MatrixType bType, int numberOfThreads) Multiply twoComplexrectangular arrays of typeMatrixType,a*b, using multiplejava.lang.Threads.static Complex[]Return the product of the row vector x and the rectangular array a, bothComplex.static Complex[]multiply(Complex[] x, Complex[][] a, ComplexMatrix.MatrixType aType) Return the product of the row vector x and the rectangular array a, bothComplex.static Complexmultiply(Complex[] x, Complex[][] a, ComplexMatrix.MatrixType aType, Complex[] y, boolean equalVectors) Compute vector-matrix-vector product trans(conj(x)) * a * y.static doubleReturn theComplexmatrix one norm.static Complex[][]Subtract twoComplexrectangular arrays, a - b.static Complex[][]Return the transpose of aComplexmatrix.
-
Method Details
-
checkMatrix
Check that all of the rows in theComplexmatrix have the same length.- Parameters:
a- aComplexmatrix- Throws:
IllegalArgumentException- This exception is thrown if the lengths of the rows of the input matrix are not uniform.
-
CheckMatrix
Deprecated.UsecheckMatrix(Complex[][])instead.Check that all of the rows in theComplexmatrix have the same length.- Parameters:
a- aComplexmatrix- Throws:
IllegalArgumentException- This exception is thrown if the lengths of the rows of the input matrix are not uniform.
-
checkSquareMatrix
Check that theComplexmatrix is square.- Parameters:
a- aComplexmatrix- Throws:
IllegalArgumentException- This exception is thrown if the matrix is not square.
-
CheckSquareMatrix
Deprecated.UsecheckSquareMatrix(Complex[][])instead.Check that theComplexmatrix is square.- Parameters:
a- aComplexmatrix- Throws:
IllegalArgumentException- This exception is thrown if the matrix is not square.
-
transpose
Return the transpose of aComplexmatrix.- Parameters:
a- aComplexmatrix- Returns:
- the
Complexmatrix transpose of the argument - Throws:
IllegalArgumentException- This exception is thrown if the lengths of the rows of the input matrix are not uniform.
-
multiply
Return the product of the row vector x and the rectangular array a, bothComplex.- Parameters:
x- aComplexrow vectora- aComplexrectangular matrix- Returns:
- a
Complexvector 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
Return the product of the row vector x and the rectangular array a, bothComplex.- Parameters:
x- aComplexrow vectora- aComplexrectangular matrixaType- aMatrixTypeindicating if matrixais general, symmetric or Hermitian- Returns:
- a
Complexvector 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
Multiply the rectangular array a and the column vector x, bothComplex.- Parameters:
a- aComplexrectangular matrixx- aComplexvector- Returns:
- a
Complexvector 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
Multiply the rectangular array a and the column vector x, bothComplex.- Parameters:
a- aComplexrectangular matrixaType- aMatrixTypeindicating if matrixais general, symmetric or Hermitianx- aComplexvector- Returns:
- a
Complexvector 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
Multiply twoComplexrectangular arrays, a * b.- Parameters:
a- aComplexrectangular arrayb- aComplexrectangular array- Returns:
- the
Complexmatrix product ofatimesb - 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 inais not equal to the number of rows inb.
-
multiply
Multiply twoComplexrectangular arrays,a*b, using multiplejava.lang.Threads.- Parameters:
a- aComplexrectangular arrayb- aComplexrectangular arraynumberOfThreads- Anintwhich specifies the number ofjava.lang.Threadinstances to use. IfnumberOfThreadsis less than 1, thennumberOfThreads= 1 is used.- Returns:
- the
Complexmatrix product ofatimesb - 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 inais not equal to the number of rows inb.
-
multiply
public static Complex[][] multiply(Complex[][] a, ComplexMatrix.MatrixType aType, Complex[][] b, ComplexMatrix.MatrixType bType, int numberOfThreads) Multiply twoComplexrectangular arrays of typeMatrixType,a*b, using multiplejava.lang.Threads.- Parameters:
a- aComplexrectangular arrayaType- aMatrixTypeindicating if matrixais general, symmetric or Hermitianb- aComplexrectangular arraybType- amatrixTypeindicating if matrixbis general, symmetric or HermitiannumberOfThreads- Anintwhich specifies the number ofjava.lang.Threadinstances to use. IfnumberOfThreadsis less than 1, thennumberOfThreads= 1 is used.- Returns:
- the
Complexmatrix product ofatimesb - 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 inais not equal to the number of rows inb, or (3) a symmetric or Hermitian input matrixaorbis 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- aComplexvectora- aComplexrectangular matrixaType- aMatrixTypeindicating if matrixais general, symmetric or Hermitiany- aComplexvectorequalVectors- abooleanindicating if the two vectorsxandyare numerically equal- Returns:
- a
Complexscalar representing the product of the arguments,trans(conj(x))*a*y
-
add
Add two rectangularComplexarrays, a + b.- Parameters:
a- aComplexrectangular arrayb- aComplexrectangular array- Returns:
- the
Complexmatrix 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
Subtract twoComplexrectangular arrays, a - b.- Parameters:
a- aComplexrectangular arrayb- aComplexrectangular array- Returns:
- the
Complexmatrix 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
Return theComplexmatrix one norm.- Parameters:
a- aComplexrectangular array- Returns:
- a
doublevalue 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
Return the Frobenius norm of aComplexmatrix.- Parameters:
a- aComplexrectangular matrix- Returns:
- a
doublevalue 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
Return the infinity norm of aComplexmatrix.- Parameters:
a- aComplexrectangular matrix- Returns:
- a
doublevalue 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
Check if theComplexmatrix is symmetric.- Parameters:
a- aComplexrectangular array- Returns:
- a
booleanwhich istrueif the matrix is symmetric andfalseotherwise. - Throws:
IllegalArgumentException- This exception is thrown if the lengths of the rows of the input matrix are not uniform.
-
isHermitian
Check if theComplexmatrix is Hermitian.- Parameters:
a- aComplexrectangular array- Returns:
- a
booleanwhich istrueif the matrix is Hermitian andfalseotherwise. - Throws:
IllegalArgumentException- This exception is thrown if the lengths of the rows of the input matrix are not uniform.
-
checkMatrix(Complex[][])instead.