Package de.gsi.math.matrix
Class MatrixFactory
- java.lang.Object
-
- de.gsi.math.matrix.MatrixFactory
-
public class MatrixFactory extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MatrixFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MatrixDconstructWithCopy(double[][] A)Construct a matrix from a copy of a 2-D array.static MatrixDidentity(int m, int n)Generate identity matrixstatic MatrixDrandom(int m, int n)Generate matrix with random elements
-
-
-
Method Detail
-
constructWithCopy
public static MatrixD constructWithCopy(double[][] A)
Construct a matrix from a copy of a 2-D array.- Parameters:
A- Two-dimensional array of doubles.- Returns:
- deep copy
- Throws:
java.lang.IllegalArgumentException- All rows must have the same length
-
identity
public static MatrixD identity(int m, int n)
Generate identity matrix- Parameters:
m- Number of rows.n- Number of colums.- Returns:
- An m-by-n matrix with ones on the diagonal and zeros elsewhere.
-
random
public static MatrixD random(int m, int n)
Generate matrix with random elements- Parameters:
m- Number of rows.n- Number of colums.- Returns:
- An m-by-n matrix with uniformly distributed random elements.
-
-