本文整理汇总了Java中no.uib.cipr.matrix.Matrix.numColumns方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix.numColumns方法的具体用法?Java Matrix.numColumns怎么用?Java Matrix.numColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类no.uib.cipr.matrix.Matrix
的用法示例。
在下文中一共展示了Matrix.numColumns方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multAdd
import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Matrix multAdd(double alpha, Matrix B, Matrix C) {
checkMultAdd(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.numColumns(); j++) {
Node node = row;
double v = 0;
while (node != null && node.row == i) {
v += (B.get(node.col, j) * node.val);
node = node.rowTail;
}
if (v != 0)
C.add(i, j, alpha * v);
}
}
return C;
}
示例2: transAmultAdd
import no.uib.cipr.matrix.Matrix; //导入方法依赖的package包/类
@Override
public Matrix transAmultAdd(double alpha, Matrix B, Matrix C) {
checkTransAmultAdd(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.numColumns(); j++) {
Node node = row;
double v = 0;
while (node != null && node.col == i) {
v += (B.get(node.row, j) * node.val);
node = node.colTail;
}
if (v != 0)
C.add(i, j, alpha * v);
}
}
return C;
}
示例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;
}
示例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()));
}
示例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()));
}
示例6: 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;
}