public class Matrix
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static Matrix |
add(Matrix a,
Matrix b) |
Performs a matrix addition
|
Matrix |
cloneMatrix() |
Creates a deep copy the current matrix
|
static Matrix |
createMatrix(int rows,
int cols,
int[][] data,
boolean copyData) |
Creates a matrix with the provided data
|
static Matrix |
createNullMatrix(int size) |
Creates a null (square) matrix of the specified size
|
static Matrix |
createUnitMatrix(int size) |
Creates a unit (square) matrix of the specified size
|
void |
displayMatrix() |
Prints the current matrix in structured form
|
static Matrix |
multiply(int k,
Matrix a) |
Multiplies a scalar to a matrix
|
static Matrix |
multiply(Matrix a,
Matrix b) |
Performs a matrix multiplication
|
static Matrix |
substract(Matrix a,
Matrix b) |
Performs a matrix subtraction
|
static Matrix |
transpose(Matrix a) |
Transposes a given matrix
|
public static Matrix createMatrix(int rows, int cols, int[][] data, boolean copyData)
rows
- The number of rows in the matrixcols
- The number of columns in the matrixdata
- A two dimensional integer array containing matrix datacopyData
- Specifies whether to copy data from the given arrayMatrix
public static Matrix createNullMatrix(int size)
size
- The size of the square matrixMatrix
public static Matrix createUnitMatrix(int size)
size
- The size of the square matrixMatrix
public Matrix cloneMatrix()
Matrix
with cloned datapublic void displayMatrix()
public static Matrix add(Matrix a, Matrix b)
a
- Matrix
Ab
- Matrix
Bpublic static Matrix substract(Matrix a, Matrix b)
a
- Matrix
Ab
- Matrix
Bpublic static Matrix multiply(int k, Matrix a)
k
- The scalar integera
- Matrix
Apublic static Matrix multiply(Matrix a, Matrix b)
a
- Matrix
Ab
- Matrix
B