|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.ma2.MAMatrix
public class MAMatrix
Abstraction for matrix operations. A matrix is a rank-2 Array: m[rows, cols]. All operations done in double precision (??)
Constructor Summary | |
---|---|
MAMatrix(Array a)
Create an MAMatrix using the given rank-2 array. |
|
MAMatrix(int nrows,
int ncols)
Create an MAMatrix of the given shape. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MAMatrix(int nrows, int ncols)
nrows
- number of rowsncols
- number of colspublic MAMatrix(Array a)
a
- rank-2 array
java.lang.IllegalArgumentException
- is a is not rank 2Method Detail |
---|
public int getNrows()
public int getNcols()
public double getDouble(int i, int j)
public void setDouble(int i, int j, double val)
public MAMatrix copy()
public MAMatrix transpose()
public MAVector column(int j)
public MAVector row(int i)
public MAVector dot(MAVector v)
v
- dot product with this vector
java.lang.IllegalArgumentException
- if ncols != v.getSize().public static MAMatrix multiply(MAMatrix m1, MAMatrix m2)
m1
- left matrixm2
- right matrix
java.lang.IllegalArgumentException
- if m1.getNcols() != m2.getNrows().public void postMultiplyDiagonal(MAVector diag)
diag
- diagonal matrix stored as a Vector
java.lang.IllegalArgumentException
- if ncols != diag.getNelems().public void preMultiplyDiagonal(MAVector diag)
diag
- diagonal matrix stored as a Vector
java.lang.IllegalArgumentException
- if nrows != diag.getNelems().
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |