java.lang.Object | +--Matrix
Class Matrix provides several static operation on 2-dimensional arrays of double. The methods of class Matrix can operate correctly on 2 dimensional arrays which are rectangular (all rows are of equal length) and non-empty (not null and minimum size double[1][1]).
Constructor Summary | |
Matrix()
|
Method Summary | |
static double[][] |
add(double[][] a,
double[][] b)
Implements 2d-array addition. |
static double[][] |
clone(double[][] m)
Creates an exact copy of a 2d-array. |
static void |
fillRandomData(double[][] m)
Fills a matrix with radmon data in the range [0..1). |
static double[][] |
maxCols(double[][] m)
It produces a single row 2d-array. |
static double[][] |
maxRows(double[][] m)
It produces a single column 2d-array. |
static double[][] |
minCols(double[][] m)
It produces a single row 2d-array. |
static double[][] |
minRows(double[][] m)
It produces a single column 2d-array. |
static double[][] |
multiply(double[][] a,
double[][] b)
Implements 2d-array multiplication. |
static double[][] |
multiply(double factor,
double[][] m)
Implements scalar 2d-array multiplication. |
static void |
print(double[][] m)
Prints the elements of a 2d-array, each row at a different line. |
static double[][] |
subtract(double[][] a,
double[][] b)
Implements 2d-array subtraction. |
static double[][] |
sumCols(double[][] m)
It produces a single row 2d-array. |
static double[][] |
sumRows(double[][] m)
It produces a single column 2d-array. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Matrix()
Method Detail |
public static double[][] add(double[][] a, double[][] b)
a
- The first matrix to be added.b
- The second array to be added.public static double[][] clone(double[][] m)
m
- The array to be copied. Must be rectangular and non-empty.public static void fillRandomData(double[][] m)
m
- The array to be filled. Must be rectangular and non-empty.public static double[][] maxCols(double[][] m)
m
- The matrix of which we compute the maximum column elements.public static double[][] maxRows(double[][] m)
m
- The matrix of which we compute the maximum row elements.public static double[][] minCols(double[][] m)
m
- The matrix of which we compute the minimum column elements.public static double[][] minRows(double[][] m)
m
- The matrix of which we compute the minimum row elements.public static double[][] multiply(double[][] a, double[][] b)
a
- The left matrix of the multiplication.b
- The right matrix of the multiplication.public static double[][] multiply(double factor, double[][] m)
factor
- The factor of the multiplication.m
- The matrix to be multiplied.public static void print(double[][] m)
m
- The array of which the ellements are printed.
Must be rectangular and non-empty.public static double[][] subtract(double[][] a, double[][] b)
a
- The matrix from which we subtract.b
- The matrix to be subtracted.public static double[][] sumCols(double[][] m)
m
- The matrix of which we compute the sum of the column elements.public static double[][] sumRows(double[][] m)
m
- The matrix of which we compute the sum of the row elements.