JMSLTM Numerical Library 7.2.0
com.imsl.math

## Class Matrix

• ```public class Matrix
extends Object```
Matrix manipulation functions.
Example
• ### Method Summary

Methods
Modifier and Type Method and Description
`static double[][]` ```add(double[][] a, double[][] b)```
Add two rectangular arrays, a + b.
`static void` `checkMatrix(double[][] a)`
Check that all of the rows in the matrix have the same length.
`static void` `checkSquareMatrix(double[][] a)`
Check that the matrix is square.
`static double` `frobeniusNorm(double[][] a)`
Return the Frobenius norm of a matrix.
`static double` `infinityNorm(double[][] a)`
Return the infinity norm of a matrix.
`static double[][]` `inverseLowerTriangular(double[][] a)`
Returns the inverse of the lower triangular matrix a.
`static double[][]` `inverseUpperTriangular(double[][] a)`
Returns the inverse of the upper triangular matrix a.
`static double[]` ```multiply(double[][] a, double[] x)```
Multiply the rectangular array a and the column array x.
`static double[][]` ```multiply(double[][] a, double[][] b)```
Multiply two rectangular arrays, a * b.
`static double[][]` ```multiply(double[][] a, double[][] b, int numberOfThreads)```
Multiply two rectangular arrays, `a` * `b`, using multiple `java.lang.Thread`s.
`static double[]` ```multiply(double[] x, double[][] a)```
Return the product of the row array x and the rectangular array a.
`static double` `oneNorm(double[][] a)`
Return the matrix one norm.
`static double[][]` ```subtract(double[][] a, double[][] b)```
Subtract two rectangular arrays, a - b.
`static double[][]` `transpose(double[][] a)`
Return the transpose of a matrix.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

```public static double[][] add(double[][] a,
double[][] b)```
Add two rectangular arrays, a + b.
Parameters:
`a` - a `double` rectangular array
`b` - a `double` rectangular array
Returns:
a `double` rectangular array representing the matrix sum of the two arguments
• #### checkMatrix

`public static void checkMatrix(double[][] a)`
Check that all of the rows in the matrix have the same length.
Parameters:
`a` - a `double` matrix
• #### checkSquareMatrix

`public static void checkSquareMatrix(double[][] a)`
Check that the matrix is square.
Parameters:
`a` - a `double` matrix
• #### frobeniusNorm

`public static double frobeniusNorm(double[][] a)`
Return the Frobenius norm of a matrix.
Parameters:
`a` - a `double` rectangular array
Returns:
a `double` scalar value equal to the Frobenius norm of the matrix.
• #### infinityNorm

`public static double infinityNorm(double[][] a)`
Return the infinity norm of a matrix.
Parameters:
`a` - a `double` rectangular array
Returns:
a `double` scalar value equal to the maximum of the row sums of the absolute values of the array elements
• #### inverseLowerTriangular

`public static double[][] inverseLowerTriangular(double[][] a)`
Returns the inverse of the lower triangular matrix a.
Parameters:
`a` - a `double` square lower triangular matrix
Returns:
a `double` matrix containing the inverse of `a`
• #### inverseUpperTriangular

`public static double[][] inverseUpperTriangular(double[][] a)`
Returns the inverse of the upper triangular matrix a.
Parameters:
`a` - a `double` square upper triangular matrix
Returns:
a `double` matrix containing the inverse of `a`
• #### multiply

```public static double[] multiply(double[][] a,
double[] x)```
Multiply the rectangular array a and the column array x.
Parameters:
`a` - a `double` rectangular matrix
`x` - a `double` column array
Returns:
a `double` vector representing the product of the arguments, `a`*`x`
• #### multiply

```public static double[][] multiply(double[][] a,
double[][] b)```
Multiply two rectangular arrays, a * b.
Parameters:
`a` - a `double` rectangular array
`b` - a `double` rectangular array
Returns:
the `double` matrix product of `a` times `b`
• #### multiply

```public static double[][] multiply(double[][] a,
double[][] b,
Multiply two rectangular arrays, `a` * `b`, using multiple `java.lang.Thread`s.
Parameters:
`a` - a `double` rectangular array
`b` - a `double` 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 `double` matrix product of `a` times `b`
• #### multiply

```public static double[] multiply(double[] x,
double[][] a)```
Return the product of the row array x and the rectangular array a.
Parameters:
`x` - a `double` row array
`a` - a `double` rectangular matrix
Returns:
a `double` vector representing the product of the arguments, `x`*`a`.
• #### oneNorm

`public static double oneNorm(double[][] a)`
Return the matrix one norm.
Parameters:
`a` - a `double` rectangular array
Returns:
a `double` value equal to the maximum of the column sums of the absolute values of the array elements
• #### subtract

```public static double[][] subtract(double[][] a,
double[][] b)```
Subtract two rectangular arrays, a - b.
Parameters:
`a` - a `double` rectangular array
`b` - a `double` rectangular array
Returns:
a `double` rectangular array representing the matrix difference of the two arguments
• #### transpose

`public static double[][] transpose(double[][] a)`
Return the transpose of a matrix.
Parameters:
`a` - a `double` matrix
Returns:
a `double` matrix which is the transpose of the argument
JMSLTM Numerical Library 7.2.0