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


Java Matrix.set方法代码示例

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


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

示例1: ignoredTimedTransMult

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
public void ignoredTimedTransMult() {
    Stopwatch watch = Stopwatch.createUnstarted();
    DenseMatrix dense = new DenseMatrix(1000, 1000);
    int[][] nz = Utilities.getRowPattern(dense.numRows(),
            dense.numColumns(), 100);
    Utilities.rowPopulate(dense, nz);
    log.info("created matrices");
    Matrix sparse = new LinkedSparseMatrix(dense.numRows(),
            dense.numColumns());
    sparse.set(dense);

    for (Matrix m : Lists.newArrayList(dense, sparse)) {
        log.info("starting " + m.getClass());
        Matrix t = new DenseMatrix(m);
        Matrix o = new DenseMatrix(dense.numRows(), dense.numColumns());
        log.info("warming up " + m.getClass() + " " + o.getClass());
        for (int i = 0; i < 10; i++)
            m.transAmult(t, o);
        log.info("starting " + m.getClass() + " " + o.getClass());
        watch.start();
        for (int i = 0; i < 100; i++)
            m.transAmult(t, o);
        watch.stop();
        log.info(m.getClass() + " " + o.getClass() + " " + watch);
    }
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:27,代码来源:LinkedSparseMatrixTest.java

示例2: 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

示例3: ignoredTimedMult

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
public void ignoredTimedMult() {
    Stopwatch watch = Stopwatch.createUnstarted();
    DenseMatrix dense = new DenseMatrix(1000, 1000);
    int[][] nz = Utilities.getRowPattern(dense.numRows(),
            dense.numColumns(), 100);
    Utilities.rowPopulate(dense, nz);
    log.info("created matrices");
    Matrix sparse = new LinkedSparseMatrix(dense.numRows(),
            dense.numColumns());
    sparse.set(dense);

    for (Matrix m : Lists.newArrayList(dense, sparse)) {
        log.info("starting " + m.getClass());
        Matrix t = new DenseMatrix(m);
        t.transpose();
        Matrix o = new DenseMatrix(dense.numRows(), dense.numColumns());
        log.info("warming up " + m.getClass() + " " + o.getClass());
        for (int i = 0; i < 10; i++)
            m.mult(t, o);
        log.info("starting " + m.getClass() + " " + o.getClass());
        watch.start();
        for (int i = 0; i < 100; i++)
            m.mult(t, o);
        watch.stop();
        log.info(m.getClass() + " " + o.getClass() + " " + watch);
    }
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:28,代码来源:LinkedSparseMatrixTest.java

示例4: loadMatrix

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
/**
 * Loads the neural network weight matrix.
 */
private void loadMatrix(final Matrix matrix, final File file) throws IOException {
	final Iterator<String> lines = Util.readFileLineByLine(file);
	int row = 0;
	while (lines.hasNext()) {
		final String line = lines.next();
		final String[] fields = line.split(" ");
		for (int i = 0; i < fields.length; i++) {
			matrix.set(row, i, Double.valueOf(fields[i]));
		}

		row++;
	}
}
 
开发者ID:uwnlp,项目名称:EasySRL,代码行数:17,代码来源:TaggerEmbeddings.java

示例5: loadMatrix

import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
/**
 * Loads the neural network weight matrix.
 */
private void loadMatrix(Matrix matrix, File file) throws IOException
{
  Iterator<String> lines = Util.readFileLineByLine(file);
  int row=0;
  while (lines.hasNext()) {
    String line = lines.next();
    String[] fields = line.split(" ");
    for (int i = 0 ; i < fields.length; i++) {
      matrix.set(row, i, Double.valueOf(fields[i]));
    }

    row++;
  }
}
 
开发者ID:mikelewis0,项目名称:easyccg,代码行数:18,代码来源:TaggerEmbeddings.java


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