本文整理汇总了Java中no.uib.cipr.matrix.MatrixEntry类的典型用法代码示例。如果您正苦于以下问题:Java MatrixEntry类的具体用法?Java MatrixEntry怎么用?Java MatrixEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatrixEntry类属于no.uib.cipr.matrix包,在下文中一共展示了MatrixEntry类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: iterator
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Iterator<MatrixEntry> iterator() {
return new Iterator<MatrixEntry>() {
Node cur = links.head;
ReusableMatrixEntry entry = new ReusableMatrixEntry();
@Override
public boolean hasNext() {
return cur != null;
}
@Override
public MatrixEntry next() {
entry.row = cur.row;
entry.col = cur.col;
entry.val = cur.val;
cur = cur.rowTail;
return entry;
}
@Override
public void remove() {
throw new UnsupportedOperationException("TODO");
}
};
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:27,代码来源:LinkedSparseMatrix.java
示例2: calculateCodifferential
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的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: transform
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
/**
* Optimized method for matrix and diagonal matrix multiplication
*
* @param documents
* A List of documents
* @return sparse input matrix
*/
public Matrix transform(List<String> documents) {
Matrix X = this.countVocab(documents);
if (this.useIdf) {
// theoretically, use X * idf_diagonal should be faster.
// unfortunately, the writer of mtj doesn't optimize it.
// I use a manully optimization to make it faster.
for(MatrixEntry e: X){
e.set(e.get() * this.idfDiag[e.column()]);
}
}
// normalization
this.rowNormalize(X);
return X;
}
开发者ID:Jetpie,项目名称:naive-bayes-java,代码行数:23,代码来源:TfidfVectorizer.java
示例4: asDenseMatrix
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public DenseDoubleMatrix asDenseMatrix() {
DenseDoubleMatrix result = new DenseDoubleMatrix(internalMatrix.numRows(), internalMatrix.numColumns());
for (MatrixEntry matrixEntry : internalMatrix) {
result.setValue(matrixEntry.row(), matrixEntry.column(), matrixEntry.get());
}
return result;
}
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:9,代码来源:SparseDoubleMatrix.java
示例5: asSparseMatrix
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public SparseDoubleMatrix asSparseMatrix() {
SparseDoubleMatrix result = new SparseDoubleMatrix(internalMatrix.numRows(), internalMatrix.numColumns());
for (MatrixEntry matrixEntry : internalMatrix) {
if (Double.compare(matrixEntry.get(), 0.0) != 0)
result.setValue(matrixEntry.row(), matrixEntry.column(), matrixEntry.get());
}
return result;
}
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:10,代码来源:DenseDoubleMatrix.java
示例6: getFrobeniusNorm
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public double getFrobeniusNorm() {
double norm = 0;
for (MatrixEntry matrixEntry : internalMatrix) {
norm += matrixEntry.get() * matrixEntry.get();
}
return Math.sqrt(norm);
}
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:9,代码来源:AMatrix.java
示例7: scale
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Matrix scale(double alpha) {
if (alpha == 0)
zero();
else if (alpha != 1)
for (MatrixEntry e : this)
set(e.row(), e.column(), e.get() * alpha);
return this;
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:10,代码来源:LinkedSparseMatrix.java
示例8: next
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
public MatrixEntry next() {
entry.update(column, cursor);
// Next position is in the same column
if (cursor < columnPointer[column + 1] - 1)
cursor++;
// Next position is at the following (non-empty) column
else {
column++;
nextNonEmptyColumn();
}
return entry;
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:16,代码来源:CompColMatrix.java
示例9: next
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
public MatrixEntry next() {
entry.update(diagonal, index);
// Move along current diagonal
if (index < diag[diagonal].length - 1)
index++;
// Move to the next diagonal
else {
diagonal++;
index = 0;
}
return entry;
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:16,代码来源:CompDiagMatrix.java
示例10: getSubMatrix
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
/**
* @see AbstractMatrix#getSubMatrix(int, int, int, int)
*/
@Override
// optimized for sparse matrices
// Non optimal for dense matrices (we only need it for sparse matrices)
public AbstractMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn) {
if (startRow > endRow) {
throw new IllegalArgumentException("startRow > endRow");
}
if (startColumn > endColumn) {
throw new IllegalArgumentException("startColumn > endColumn");
}
final int n = endRow - startRow + 1;
final int m = endColumn - startColumn + 1;
FlexCompRowMatrix subMatrix = new FlexCompRowMatrix(n, m);
Iterator<MatrixEntry> it = this.matrix.iterator();
while (it.hasNext()) {
MatrixEntry entry = it.next();
int row = entry.row();
int column = entry.column();
if (row >= startRow && row <= endRow && column >= startColumn && column <= endColumn) {
int subMatrixRow = row - startRow;
int subMatrixColumn = column - startColumn;
subMatrix.set(subMatrixRow, subMatrixColumn, entry.get());
}
}
return new MtjMatrix(subMatrix);
}
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:33,代码来源:MtjMatrix.java
示例11: setSubMatrix
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
/**
* @see AbstractMatrix#setSubMatrix(AbstractMatrix, int, int)
*/
@Override
public void setSubMatrix(AbstractMatrix subMatrix, int row, int column) {
if (subMatrix instanceof MtjMatrix) {
no.uib.cipr.matrix.AbstractMatrix s = ((MtjMatrix) subMatrix).getMatrix();
Iterator<MatrixEntry> it = s.iterator();
while (it.hasNext()) {
MatrixEntry entry = it.next();
int i = row + entry.row();
int j = column + entry.column();
double value = entry.get();
this.matrix.set(i, j, value);
}
}
}
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:18,代码来源:MtjMatrix.java
示例12: invertDiagonalMatrix
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的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
示例13: forEach
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
protected void forEach(final ElementVisitorFunction func) {
for (final MatrixEntry entry : this.matrix) {
func.visit(
entry.row(),
entry.column(),
entry.get(),
entry::set);
}
}
开发者ID:NemProject,项目名称:nem.core,代码行数:11,代码来源:MtjSparseMatrix.java
示例14: iterator
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Iterator<MatrixEntry> iterator() {
return new RowMatrixIterator();
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:5,代码来源:FlexCompRowMatrix.java
示例15: next
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
public MatrixEntry next() {
SuperIteratorEntry<VectorEntry> se = iterator.next();
entry.update(se.index(), se.get());
return entry;
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:6,代码来源:FlexCompRowMatrix.java
示例16: iterator
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Iterator<MatrixEntry> iterator() {
return new CompColMatrixIterator();
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:5,代码来源:CompColMatrix.java
示例17: iterator
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Iterator<MatrixEntry> iterator() {
return new CompDiagMatrixIterator();
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:5,代码来源:CompDiagMatrix.java
示例18: iterator
import no.uib.cipr.matrix.MatrixEntry; //导入依赖的package包/类
@Override
public Iterator<MatrixEntry> iterator() {
return new ColMatrixIterator();
}
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:5,代码来源:FlexCompColMatrix.java
注:本文中的no.uib.cipr.matrix.MatrixEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论