本文整理汇总了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);
}
}
示例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;
}
示例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);
}
}
示例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++;
}
}
示例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++;
}
}