类 MAMatrix
- java.lang.Object
-
- org.meteoinfo.ndarray.MAMatrix
-
public class MAMatrix extends java.lang.ObjectAbstraction for matrix operations. A matrix is a rank-2 Array: m[rows, cols]. All operations done in double precision- 作者:
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 MAVectorcolumn(int j)Get the jth column, return as a MAVector: same backing store.MAMatrixcopy()Create a new MAMatrix that is the same as this one, with a copy of the backing store.MAVectordot(MAVector v)Dot product of matrix and vector: return M dot vdoublegetDouble(int i, int j)intgetNcols()intgetNrows()static MAMatrixmultiply(MAMatrix m1, MAMatrix m2)Matrix multiply: return m1 * m2.voidpostMultiplyDiagonal(MAVector diag)Matrix multiply by a diagonal matrix, store result in this: this = this * diagvoidpreMultiplyDiagonal(MAVector diag)Matrix multiply by a diagonal matrix, store result in this: this = diag * thisMAVectorrow(int i)Get the ith row, return as a MAVector: same backing store.voidsetDouble(int i, int j, double val)MAMatrixtranspose()Create a MAMatrix that is the transpose of this one, with the same backing store.
-
-
-
构造器详细资料
-
MAMatrix
public MAMatrix(int nrows, int ncols)Create an MAMatrix of the given shape.- 参数:
nrows- number of rowsncols- number of cols
-
MAMatrix
public MAMatrix(Array a)
Create an MAMatrix using the given rank-2 array.- 参数:
a- rank-2 array- 抛出:
java.lang.IllegalArgumentException- is a is not rank 2
-
-
方法详细资料
-
getNrows
public int getNrows()
-
getNcols
public int getNcols()
-
getDouble
public double getDouble(int i, int j)
-
setDouble
public void setDouble(int i, int j, double val)
-
copy
public MAMatrix copy()
Create a new MAMatrix that is the same as this one, with a copy of the backing store.
-
transpose
public MAMatrix transpose()
Create a MAMatrix that is the transpose of this one, with the same backing store. Use copy() to get a copy.
-
column
public MAVector column(int j)
Get the jth column, return as a MAVector: same backing store.
-
row
public MAVector row(int i)
Get the ith row, return as a MAVector: same backing store.
-
dot
public MAVector dot(MAVector v)
Dot product of matrix and vector: return M dot v- 参数:
v- dot product with this vector- 返回:
- MAVector result: new vector
- 抛出:
java.lang.IllegalArgumentException- if ncols != v.getSize().
-
multiply
public static MAMatrix multiply(MAMatrix m1, MAMatrix m2)
Matrix multiply: return m1 * m2.- 参数:
m1- left matrixm2- right matrix- 返回:
- MAMatrix result: new matrix
- 抛出:
java.lang.IllegalArgumentException- if m1.getNcols() != m2.getNrows().
-
postMultiplyDiagonal
public void postMultiplyDiagonal(MAVector diag)
Matrix multiply by a diagonal matrix, store result in this: this = this * diag- 参数:
diag- diagonal matrix stored as a Vector- 抛出:
java.lang.IllegalArgumentException- if ncols != diag.getNelems().
-
preMultiplyDiagonal
public void preMultiplyDiagonal(MAVector diag)
Matrix multiply by a diagonal matrix, store result in this: this = diag * this- 参数:
diag- diagonal matrix stored as a Vector- 抛出:
java.lang.IllegalArgumentException- if nrows != diag.getNelems().
-
-