Class VisualNumerics.math.DoubleMatrix
All Packages Class Hierarchy This Package Previous Next Index
Class VisualNumerics.math.DoubleMatrix
java.lang.Object
|
+----VisualNumerics.math.DoubleMatrix
- public class DoubleMatrix
- extends Object
Double precision matrix manipulation functions.
This class cannot be instantiated because all of its methods are static.
-
add(double[][], double[][])
-
Add two rectangular arrays, a + b.
-
determinant(double[][])
-
Return the determinant of the matrix from its LU factorization.
-
frobeniusNorm(double[][])
-
Return the frobenius norm of a matrix.
-
infinityNorm(double[][])
-
Return the infinity norm of a matrix.
-
inverse(double[][])
-
Return the inverse of the matrix a using its LU factorization.
-
multiply(double[], double[][])
-
Return the product of the row vector x and the rectangular array a.
-
multiply(double[][], double[])
-
Multiply the rectangular array a and the column vector x.
-
multiply(double[][], double[][])
-
Multiply two rectangular arrays, a * b.
-
oneNorm(double[][])
-
Return the matrix one norm.
-
QRsolve(double[][], double[])
-
Solve ax=b for x, using the QR decomposition of a.
-
solve(double[][], double[])
-
Solve ax=b for x using the LU factorization of a.
-
subtract(double[][], double[][])
-
Take the difference between two arrays, a - b.
-
trace(double[][])
-
Return the sum of the diagonal elements.
-
transpose(double[][])
- Return the transpose of a matrix.
DoubleMatrix
public DoubleMatrix()
transpose
public static double[][] transpose(double a[][]) throws IllegalArgumentException
- Return the transpose of a matrix.
- Parameters:
- a - A matrix with elements of type double.
- Returns:
- The matrix transpose of the argument.
- Throws: IllegalArgumentException
- This exception is thrown when the lengths of
the rows of the input matrix are not uniform.
multiply
public static double[] multiply(double x[],
double a[][]) throws IllegalArgumentException
- Return the product of the row vector x and the rectangular array a.
- Parameters:
- x - A row vector with elements of type double.
- a - A rectangular matrix with elements of type double.
- Returns:
- The product of the arguments.
- 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 elements
in the input vector is not equal to the number of rows of the matrix.
multiply
public static double[] multiply(double a[][],
double x[]) throws IllegalArgumentException
- Multiply the rectangular array a and the column vector x.
- Parameters:
- a - A rectangular matrix with elements of type double.
- x - A vector with elements of type double.
- Returns:
- The product of the arguments.
- 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 double[][] multiply(double a[][],
double b[][]) throws IllegalArgumentException
- Multiply two rectangular arrays, a * b.
- Parameters:
- a - An (m x n) rectangular array with elements of type double.
- b - An (n x p) rectangular array with elements of type double.
- Returns:
- The matrix product of the two arguments with dimensions (m x p).
- Throws: IllegalArgumentException
- This exception is thrown when (1) the lengths of the
rows of either of the input matrices are not uniform, and (2) the number of columns in
a is not equal to the number of rows in b.
add
public static double[][] add(double a[][],
double b[][]) throws IllegalArgumentException
- Add two rectangular arrays, a + b.
- Parameters:
- a - A rectangular array with elements of type double.
- b - A rectangular array with elements of type double.
- Returns:
- The sum of the two arrays.
- Throws: IllegalArgumentException
- This exception is thrown when (1) the lengths of the
rows of either of the input matrices are not uniform, and (2) corresponding
dimensions of the two matrices are not equal to each other.
subtract
public static double[][] subtract(double a[][],
double b[][]) throws IllegalArgumentException
- Take the difference between two arrays, a - b.
- Parameters:
- a - A rectangular array with elements of type double.
- b - A rectangular array with elements of type double.
- Returns:
- The difference between the two arrays.
- Throws: IllegalArgumentException
- This exception is thrown when (1) the lengths of the
rows of either of the input matrices are not uniform, and (2) corresponding
dimensions of the two matrices are not equal to each other.
solve
public static double[] solve(double a[][],
double b[]) throws IllegalArgumentException, MathException
- Solve ax=b for x using the LU factorization of a.
- Parameters:
- a - A square matrix with elements of type double.
- b - A column vector with elements of type double.
- Returns:
- A column vector containing the solution to the linear system
of equations.
- 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 rows
in the input matrix is not equal to the number of elements in x.
- Throws: MathException
- This exception is thrown when the matrix is singular.
inverse
public static double[][] inverse(double a[][]) throws IllegalArgumentException, MathException
- Return the inverse of the matrix a using its LU factorization.
- Parameters:
- a - A square matrix with elements of type double.
- Returns:
- The matrix inverse of a.
- Throws: IllegalArgumentException
- This exception is thrown when (1) the lengths of the
rows of the input matrix are not uniform, and (2) the input matrix is
not square.
- Throws: MathException
- This exception is thrown when the matrix is singular.
determinant
public static double determinant(double a[][]) throws IllegalArgumentException, MathException
- Return the determinant of the matrix from its LU factorization.
- Parameters:
- a - A square matrix with elements of type double.
- Returns:
- A double value equal to the determinant of the matrix.
- Throws: IllegalArgumentException
- This exception is thrown when (1) the lengths of the
rows of the input matrix are not uniform, and (2) the input matrix is
not square.
- Throws: MathException
- This exception is thrown when the matrix is singular.
QRsolve
public static double[] QRsolve(double a[][],
double b[]) throws IllegalArgumentException, MathException
- Solve ax=b for x, using the QR decomposition of a.
When A is not square, it returns the least squares solution.
- Parameters:
- a - A rectangular array with elements of type double.
- b - A column vector with elements of type double.
- Returns:
- A column vector with elements containing the
least squares solution to the linear system.
- 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 rows in the
input matrix is not equal to the number of elements in the input vector.
- Throws: MathException
- This exception is thrown when the upper triangular matrix R from
the QR factorization has a zero diagonal element.
trace
public static double trace(double a[][]) throws MathException
- Return the sum of the diagonal elements.
- Parameters:
- a - A square matrix with elements of type double.
- Returns:
- A double value equal to the sum of the diagonal elements.
- Throws: MathException
- This exception is thrown when the matrix is not square.
oneNorm
public static double oneNorm(double array[][])
- Return the matrix one norm.
- Parameters:
- array - A rectangular array with elements of type double.
- Returns:
- A double value equal to the maximum of the column sums
of the absolute values of the array elements.
frobeniusNorm
public static double frobeniusNorm(double array[][])
- Return the frobenius norm of a matrix.
- Parameters:
- array - A rectangular matrix with elements of type double.
- Returns:
- A double value equal to the frobenius norm of the matrix.
infinityNorm
public static double infinityNorm(double array[][])
- Return the infinity norm of a matrix.
- Parameters:
- array - A rectangular matrix with elements of type double.
- Returns:
- A double value equal to the maximum of the row sums
of the absolute values of the array elements.
All Packages Class Hierarchy This Package Previous Next Index