当前位置: 首页>>代码示例>>Java>>正文


Java Matrix.numRows方法代码示例

本文整理汇总了Java中no.uib.cipr.matrix.Matrix.numRows方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix.numRows方法的具体用法?Java Matrix.numRows怎么用?Java Matrix.numRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在no.uib.cipr.matrix.Matrix的用法示例。


在下文中一共展示了Matrix.numRows方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transBmultAdd

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Matrix transBmultAdd(double alpha, Matrix B, Matrix C) {
    checkTransBmultAdd(B, C);
    if (alpha == 0)
        return C;
    for (int i = 0; i < numRows; i++) {
        Node row = links.startOfRow(i);
        if (row != null)
            for (int j = 0; j < B.numRows(); j++) {
                Node node = row;
                double v = 0;
                while (node != null && node.row == i) {
                    v += (B.get(j, node.col) * node.val);
                    node = node.rowTail;
                }
                if (v != 0)
                    C.add(i, j, alpha * v);
            }
    }
    return C;
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:22,代码来源:LinkedSparseMatrix.java

示例2: transABmultAdd

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Matrix transABmultAdd(double alpha, Matrix B, Matrix C) {
    checkTransABmultAdd(B, C);
    if (alpha == 0)
        return C;
    for (int i = 0; i < numColumns; i++) {
        Node row = links.startOfCol(i);
        if (row != null)
            for (int j = 0; j < B.numRows(); j++) {
                Node node = row;
                double v = 0;
                while (node != null && node.col == i) {
                    v += (B.get(j, node.row) * node.val);
                    node = node.colTail;
                }
                if (v != 0)
                    C.add(i, j, alpha * v);
            }
    }
    return C;
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:22,代码来源:LinkedSparseMatrix.java

示例3: calculateCodifferential

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
private static <
	V extends Vertex<V,E,F>,
	E extends Edge<V,E,F>,
	F extends Face<V,E,F>,
	HDS extends HalfEdgeDataStructure<V, E, F>
> Matrix calculateCodifferential(HDS heds, AdapterSet adapters, int dim) {
	Matrix hs0inv = invertDiagonalMatrix(getHodgeStar(heds, adapters, dim));
	Matrix hs1 = getHodgeStar(heds, adapters, dim+1);
	Matrix bd = getBoundaryOperator(heds, adapters, dim);
	
	int[][] nz = getColumnNonZeros(bd);
	Matrix M = new CompColMatrix(bd.numRows(),bd.numColumns(),nz);
	M.set(bd);
	for(MatrixEntry me : M) {
		double val = me.get();
		me.set(-1.0*hs0inv.get(me.row(), me.row())*hs1.get(me.column(), me.column())*val);
	}
	return M;
}
 
开发者ID:sechel,项目名称:jtem-halfedgetools,代码行数:20,代码来源:DiscreteDifferentialOperators.java

示例4: getQRDecomposition

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Pair<IMatrix, IMatrix> getQRDecomposition() {
   Matrix input = internalMatrix.copy();

   // If the Matrix has the wrong dimensions
   if (input.numRows() < input.numColumns()) {
      input = input.transpose(new LinkedSparseMatrix(input.numColumns(), input.numRows()));
   }

   QR rs = QR.factorize(input);
   return Pair.of(new SparseDoubleMatrix(rs.getQ()), new SparseDoubleMatrix(rs.getR()));
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:13,代码来源:SparseDoubleMatrix.java

示例5: getQRDecomposition

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Pair<IMatrix, IMatrix> getQRDecomposition() throws MatrixDecompositionException {
   Matrix input = internalMatrix.copy();

   // If the Matrix has the wrong dimensions
   if (input.numRows() < input.numColumns()) {
      input = input.transpose(new DenseDoubleMatrix(input.numColumns(), input.numRows()).internalMatrix);
   }

   QR rs = QR.factorize(input);
   return Pair.of(new DenseDoubleMatrix(rs.getQ()), new DenseDoubleMatrix(rs.getR()));
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:13,代码来源:DenseDoubleMatrix.java

示例6: checkSizes

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
/**
 * Checks sizes of input data for {@link #solve(Matrix, Vector, Vector)}.
 * Throws an exception if the sizes does not match.
 */
protected void checkSizes(Matrix A, Vector b, Vector x) {
    if (!A.isSquare())
        throw new IllegalArgumentException("!A.isSquare()");
    if (b.size() != A.numRows())
        throw new IllegalArgumentException("b.size() != A.numRows()");
    if (b.size() != x.size())
        throw new IllegalArgumentException("b.size() != x.size()");
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:13,代码来源:AbstractIterativeSolver.java

示例7: setMatrix

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
public void setMatrix(Matrix A) {
    if (A.numRows() != invdiag.length)
        throw new IllegalArgumentException(
                "Matrix size differs from preconditioner size");

    for (int i = 0; i < invdiag.length; ++i) {
        invdiag[i] = A.get(i, i);
        if (invdiag[i] == 0) // Avoid zero-division
            throw new RuntimeException("Zero diagonal on row " + (i + 1));
        else
            invdiag[i] = 1 / invdiag[i];
    }
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:14,代码来源:DiagonalPreconditioner.java

示例8: testGetSimilarityMatrix

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
/**
 * Checks to see if the similarity matrix is computed correctly given <code>M</code>
 */
@Test
public void testGetSimilarityMatrix() {
    Matrix M = new DenseMatrix(new double[][] {
        new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 },
        new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 },
        new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0 },
        new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
        new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 },
        new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 },
        new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
        new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0 },
        new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 },
        new double[] { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 }
    });

    List<String> labels = Lists.newArrayListWithCapacity(M.numRows());
    for (int i = 0; i < M.numRows(); i++) {
        labels.add("L" + i);
    }

    LabeledMTJMatrix<String> M_l = LabeledMTJMatrix.of(M, labels);
    LabeledDenseMatrix<String> R = GraphPartition.getSimilarityMatrix(M_l);
    assertEquals(10, R.getMatrix().length);
    assertEquals(10, R.getMatrix()[0].length);
    assertEquals(10, R.getLabels().size());
}
 
开发者ID:OpenChatAlytics,项目名称:OpenChatAlytics,代码行数:30,代码来源:GraphPartitionTest.java

示例9: invertDiagonalMatrix

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
private static CompDiagMatrix invertDiagonalMatrix(Matrix m) {
	CompDiagMatrix minv = new CompDiagMatrix(m.numRows(),m.numColumns());
	Iterator<MatrixEntry> it = m.iterator();
	while(it.hasNext()) {
		MatrixEntry me = it.next();
		minv.set(me.row(),me.column(),1.0/me.get());
	}
	return minv;
}
 
开发者ID:sechel,项目名称:jtem-halfedgetools,代码行数:10,代码来源:DiscreteDifferentialOperators.java


注:本文中的no.uib.cipr.matrix.Matrix.numRows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。