public class Matrix extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private int |
columns
The number of columns in the matrix.
|
private byte[][] |
data
The data in the matrix, in row major form.
|
private int |
rows
The number of rows in the matrix.
|
| 构造器和说明 |
|---|
Matrix(byte[][] initData)
Initializes a matrix with the given row-major data.
|
Matrix(int initRows,
int initColumns)
Initialize a matrix of zeros.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Matrix |
augment(Matrix right)
Returns the concatenation of this matrix and the matrix on the right.
|
boolean |
equals(Object other)
Returns true iff this matrix is identical to the other.
|
private void |
gaussianElimination()
Does the work of matrix inversion.
|
byte |
get(int r,
int c)
Returns the value at row r, column c.
|
int |
getColumns()
Returns the number of columns in this matrix.
|
byte[] |
getRow(int row)
Returns one row of the matrix as a byte array.
|
int |
getRows()
Returns the number of rows in this matrix.
|
static Matrix |
identity(int size)
Returns an identity matrix of the given size.
|
Matrix |
invert()
Returns the inverse of this matrix.
|
void |
set(int r,
int c,
byte value)
Sets the value at row r, column c.
|
Matrix |
submatrix(int rmin,
int cmin,
int rmax,
int cmax)
Returns a part of this matrix.
|
void |
swapRows(int r1,
int r2)
Exchanges two rows in the matrix.
|
Matrix |
times(Matrix right)
Multiplies this matrix (the one on the left) by another
matrix (the one on the right).
|
String |
toBigString()
Returns a human-readable string of the matrix contents.
|
String |
toString()
Returns a human-readable string of the matrix contents.
|
private final int rows
private final int columns
private final byte[][] data
public Matrix(int initRows,
int initColumns)
initRows - The number of rows in the matrix.initColumns - The number of columns in the matrix.public Matrix(byte[][] initData)
public static Matrix identity(int size)
public String toString()
public String toBigString()
public int getColumns()
public int getRows()
public byte get(int r,
int c)
public void set(int r,
int c,
byte value)
public boolean equals(Object other)
public Matrix times(Matrix right)
public Matrix augment(Matrix right)
public Matrix submatrix(int rmin, int cmin, int rmax, int cmax)
public byte[] getRow(int row)
public void swapRows(int r1,
int r2)
public Matrix invert()
IllegalArgumentException - when the matrix is singular and
doesn't have an inverse.private void gaussianElimination()
Copyright © 2022. All rights reserved.