JMSLTM Numerical Library 5.0.1

com.imsl.math
Class Matrix

java.lang.Object
  extended by com.imsl.math.Matrix

public class Matrix
extends Object

Matrix manipulation functions.

See Also:
Example

Method Summary
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[] 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 threads)
          Multiply two rectangular arrays, a * b, using multiple threads.
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

add

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
Throws:
IllegalArgumentException - This exception is thrown when (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the matrices are not the same size.

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
Throws:
IllegalArgumentException - This exception is thrown when the lengths of the rows of the input matrix are not uniform.

checkSquareMatrix

public static void checkSquareMatrix(double[][] a)
Check that the matrix is square.

Parameters:
a - a double matrix
Throws:
IllegalArgumentException - This exception is thrown when the matrix is not square.

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

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
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 columns in the input matrix is not equal to the number of elements in the input column vector.

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
Throws:
IllegalArgumentException - This exception is thrown when (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 double[][] multiply(double[][] a,
                                  double[][] b,
                                  int threads)
Multiply two rectangular arrays, a * b, using multiple threads.

Parameters:
a - a double rectangular array
b - a double rectangular array
threads - An int which specifies the number of threads to use. If threads is less than 1, then threads = 1 is used.
Returns:
the double matrix product of a times b
Throws:
IllegalArgumentException - This exception is thrown when (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 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.
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.

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
Throws:
IllegalArgumentException - This exception is thrown when (1) the lengths of the rows of either of the input matrices are not uniform, or (2) the matrices are not the same size.

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
Throws:
IllegalArgumentException - This exception is thrown when the lengths of the rows of the input matrix are not uniform.

JMSLTM Numerical Library 5.0.1

Copyright © 1970-2008 Visual Numerics, Inc.
Built July 8 2008.