Package mathvoyage.matrix
Class Matrix
java.lang.Object
mathvoyage.matrix.Matrix
voyager.Matrix class
-
Constructor Summary
ConstructorsConstructorDescriptionMatrix(double[][] data) Instantiates a new Matrix.Matrix(double[] data, int rows, int cols) Instantiates a new Matrix.Matrix(int[][] data) Instantiates a new Matrix.Matrix(int[] data, int rows, int cols) Instantiates a new Matrix.Matrix(int rows, int cols) Instantiates a new Matrix.Matrix(int rows, int cols, double value) Instantiates a new Matrix. -
Method Summary
Modifier and TypeMethodDescriptionAdd matrix.doubleget(int row, int col) Get double.intgetCols()Get cols int.double[][]getData()Get data double [ ] [ ].doubleGet determinant double.intgetRows()Get rows int.inverse()Inverse matrix.booleanIs equal boolean.multiply(double b) Multiply matrix.Multiply matrix.pow(int exponant) Pow matrix.voidPrint matrix.Subtract matrix.Transpose matrix.
-
Constructor Details
-
Matrix
public Matrix(double[][] data) Instantiates a new Matrix.- Parameters:
data- the data
-
Matrix
public Matrix(int[][] data) Instantiates a new Matrix.- Parameters:
data- the data
-
Matrix
public Matrix(int rows, int cols) Instantiates a new Matrix.- Parameters:
rows- the rowscols- the cols
-
Matrix
public Matrix(double[] data, int rows, int cols) Instantiates a new Matrix.- Parameters:
data- the datarows- the rowscols- the cols
-
Matrix
public Matrix(int[] data, int rows, int cols) Instantiates a new Matrix.- Parameters:
data- the datarows- the rowscols- the cols
-
Matrix
public Matrix(int rows, int cols, double value) Instantiates a new Matrix.- Parameters:
rows- the rowscols- the colsvalue- the value
-
-
Method Details
-
getDeterminant
public double getDeterminant()Get determinant double.- Returns:
- the double
-
getRows
public int getRows()Get rows int.- Returns:
- the int
-
getCols
public int getCols()Get cols int.- Returns:
- the int
-
getData
public double[][] getData()Get data double [ ] [ ].- Returns:
- the double [ ] [ ]
-
get
public double get(int row, int col) Get double.- Parameters:
row- the rowcol- the col- Returns:
- the double
-
add
Add matrix.- Parameters:
b- the b- Returns:
- the matrix
-
subtract
Subtract matrix.- Parameters:
b- the b- Returns:
- the matrix
-
multiply
Multiply matrix.- Parameters:
b- the b- Returns:
- the matrix
-
multiply
Multiply matrix.- Parameters:
b- the b- Returns:
- the matrix
-
transpose
Transpose matrix.- Returns:
- the matrix
-
inverse
Inverse matrix.- Returns:
- the matrix
-
printMatrix
public void printMatrix()Print matrix. -
pow
Pow matrix.- Parameters:
exponant- the exponant- Returns:
- the matrix
-
isEqual
Is equal boolean.- Parameters:
a- the a- Returns:
- the boolean
-