public class MAMatrix extends Object
Constructor and Description |
---|
MAMatrix(Array a)
Create an MAMatrix using the given rank-2 array.
|
MAMatrix(int nrows,
int ncols)
Create an MAMatrix of the given shape.
|
Modifier and Type | Method and Description |
---|---|
MAVector |
column(int j)
Get the jth column, return as a MAVector: same backing store.
|
MAMatrix |
copy()
Create a new MAMatrix that is the same as this one, with a copy of the backing store.
|
MAVector |
dot(MAVector v)
Dot product of matrix and vector: return M dot v
|
double |
getDouble(int i,
int j) |
int |
getNcols() |
int |
getNrows() |
static MAMatrix |
multiply(MAMatrix m1,
MAMatrix m2)
Matrix multiply: return m1 * m2.
|
void |
postMultiplyDiagonal(MAVector diag)
Matrix multiply by a diagonal matrix, store result in this: this = this * diag
|
void |
preMultiplyDiagonal(MAVector diag)
Matrix multiply by a diagonal matrix, store result in this: this = diag * this
|
MAVector |
row(int i)
Get the ith row, return as a MAVector: same backing store.
|
void |
setDouble(int i,
int j,
double val) |
MAMatrix |
transpose()
Create a MAMatrix that is the transpose of this one, with the same backing store.
|
public MAMatrix(Array a)
a
- rank-2 arrayIllegalArgumentException
- is a is not rank 2public MAMatrix(int nrows, int ncols)
nrows
- number of rowsncols
- number of colspublic MAVector column(int j)
public MAMatrix copy()
public MAVector dot(MAVector v)
v
- dot product with this vectorIllegalArgumentException
- if ncols != v.getSize().public double getDouble(int i, int j)
public int getNcols()
public int getNrows()
public static MAMatrix multiply(MAMatrix m1, MAMatrix m2)
m1
- left matrixm2
- right matrixIllegalArgumentException
- if m1.getNcols() != m2.getNrows().public void postMultiplyDiagonal(MAVector diag)
diag
- diagonal matrix stored as a VectorIllegalArgumentException
- if ncols != diag.getNelems().public void preMultiplyDiagonal(MAVector diag)
diag
- diagonal matrix stored as a VectorIllegalArgumentException
- if nrows != diag.getNelems().public MAVector row(int i)
public void setDouble(int i, int j, double val)
public MAMatrix transpose()