本文整理汇总了Java中cern.colt.matrix.impl.SparseDoubleMatrix2D.columns方法的典型用法代码示例。如果您正苦于以下问题:Java SparseDoubleMatrix2D.columns方法的具体用法?Java SparseDoubleMatrix2D.columns怎么用?Java SparseDoubleMatrix2D.columns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.colt.matrix.impl.SparseDoubleMatrix2D
的用法示例。
在下文中一共展示了SparseDoubleMatrix2D.columns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportGraph
import cern.colt.matrix.impl.SparseDoubleMatrix2D; //导入方法依赖的package包/类
@Override
public void exportGraph() {
try {
initialiseOut();
Map<WeightedEdge, Number> map = new HashMap<WeightedEdge, Number>();
Graph<Agent, WeightedEdge> graph = tradeNetworkReport.getGraph();
for(WeightedEdge edge : graph.getEdges()) {
map.put(edge, edge.getValue());
}
SparseDoubleMatrix2D matrix = GraphMatrixOperations
.graphToSparseMatrix(this.tradeNetworkReport.getGraph(),
map);
for (int i = 0; i < matrix.rows(); i++) {
for (int j = 0; j < matrix.columns(); j++) {
out.newData(matrix.get(i, j));
}
out.endRecord();
}
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: ColtSparseDoubleMatrix2D
import cern.colt.matrix.impl.SparseDoubleMatrix2D; //导入方法依赖的package包/类
public ColtSparseDoubleMatrix2D(SparseDoubleMatrix2D m) {
super(m.rows(), m.columns());
this.matrix = m;
}
示例3: createMatrixFromGraph
import cern.colt.matrix.impl.SparseDoubleMatrix2D; //导入方法依赖的package包/类
public void createMatrixFromGraph() {
//creating a map of edges
mapEdgeToCladeBranchLengthValue = new HashMap<Clade,Number>();
for (Clade edg : g3.getEdges()) {
mapEdgeToCladeBranchLengthValue.put(edg, edg.getBranchLength());
}
//populating matrix cells with edge weights, creating weighted matrix
SparseDoubleMatrix2D adjacencyMatrix = GraphMatrixOperations.graphToSparseMatrix(g3, mapEdgeToCladeBranchLengthValue);
SparseDoubleMatrix2D diagonalDegreeMatrix = GraphMatrixOperations.createVertexDegreeDiagonalMatrix(g3);
SparseDoubleMatrix2D laplaceMatrix = new SparseDoubleMatrix2D(adjacencyMatrix.rows(), adjacencyMatrix.columns());
// System.out.println(g3.toString());
// System.out.println(m2.toString());
// String title = "Project name: " + phylo.getForest().getMetaxml().getProjectName();
String columnAxisName = "Cells-ID's";
String rowAxisName = "Cells-ID's";
List<String> rowNames = new LinkedList<String>();
List<String> columnNames = new LinkedList<String>();
// Iterator<Cell> itr = g3.getVertices().iterator();
/* String[] rowNames2 = new String[g3.getVertexCount()];
String[] columnNames2 = new String[g3.getVertexCount()];
while ( itr.hasNext() ) {
rowNames.add(itr.next().getId());
}
for(int i=0; i<rowNames.size(); i++) {
rowNames2 [i] = columnNames2 [i] = rowNames.get(i);
}
hep.aida.bin.BinFunctions1D F = hep.aida.bin.BinFunctions1D.functions; // alias
// hep.aida.bin.BinFunction1D[] aggr = {F.mean, F.rms, F.quantile(0.25), F.median, F.quantile(0.75), F.stdDev, F.min, F.max};
hep.aida.bin.BinFunction1D[] aggr = {F.mean, F.rms, F.stdDev};
String format = "%1.2G";
// DoubleMatrix2D matrix = new DenseDoubleMatrix2D(values);
System.out.println("" + new Formatter(format).toTitleString(adjacencyMatrix, rowNames2, columnNames2, rowAxisName, columnAxisName, "", aggr));
System.out.println("");
// System.out.println(""+ m2.viewSorted(0));
for (int row = 0; row < adjacencyMatrix.rows(); row++) {
for (int column = 0; column < adjacencyMatrix.columns(); column++) {
System.out.println( row +")"+ adjacencyMatrix.getQuick(row, column));
}
}
// System.out.println(m2.toString());
// MatrixIO.show();
*/ }