2013-03-04 162 views
0

我在Java上使用Jama进行矩阵操作。但是我看不到足够的文档。Jama如何随机播放矩阵?

如何在Jama下洗一个矩阵?

也有一样的东西:

Matrix(:,end) 

得到的只有最后一列像在Matlab的?

回答

0

的文档(以及,至少类的文档)是herehttp://math.nist.gov/javanumerics/jama/doc/

Matrix类有一个方法getMatrix()提取子矩阵:

/** Get a submatrix. 
    @param r Array of row indices. 
    @param c Array of column indices. 
    @return  A(r(:),c(:)) 
    @exception ArrayIndexOutOfBoundsException Submatrix indices 
    */ 

    public Matrix getMatrix (int[] r, int[] c) { 
     Matrix X = new Matrix(r.length,c.length); 
     double[][] B = X.getArray(); 
     try { 
     for (int i = 0; i < r.length; i++) { 
      for (int j = 0; j < c.length; j++) { 
       B[i][j] = A[r[i]][c[j]]; 
      } 
     } 
     } catch(ArrayIndexOutOfBoundsException e) { 
     throw new ArrayIndexOutOfBoundsException("Submatrix indices"); 
     } 
     return X; 
    } 

Jama不是太复杂。将getColumn()方法添加到Matrix.java应该非常容易。