本文整理汇总了Java中cern.colt.matrix.DoubleMatrix2D.zSum方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleMatrix2D.zSum方法的具体用法?Java DoubleMatrix2D.zSum怎么用?Java DoubleMatrix2D.zSum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cern.colt.matrix.DoubleMatrix2D
的用法示例。
在下文中一共展示了DoubleMatrix2D.zSum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zdemo2
import cern.colt.matrix.DoubleMatrix2D; //导入方法依赖的package包/类
/**
* Demonstrates advanced sorting.
* Sorts by sum of slice.
*/
public static void zdemo2() {
Sorting sort = quickSort;
DoubleMatrix3D matrix = DoubleFactory3D.dense.descending(4,3,2);
DoubleMatrix2DComparator comp = new DoubleMatrix2DComparator() {
public int compare(DoubleMatrix2D a, DoubleMatrix2D b) {
double as = a.zSum();
double bs = b.zSum();
return as < bs ? -1 : as == bs ? 0 : 1;
}
};
System.out.println("unsorted:"+matrix);
System.out.println("sorted :"+sort.sort(matrix,comp));
}
示例2: doubleTest26
import cern.colt.matrix.DoubleMatrix2D; //导入方法依赖的package包/类
/**
*/
public static void doubleTest26(int size) {
System.out.println("\n\n");
System.out.println("initializing...");
boolean dense = true;
DoubleMatrix2D A;
DoubleFactory2D factory;
if (dense)
factory = Factory2D.dense;
else
factory = Factory2D.sparse;
double value = 0.5;
A = factory.make(size,size,value);
Property.generateNonSingular(A);
cern.colt.Timer timer = new cern.colt.Timer().start();
DoubleMatrix2DComparator fun = new DoubleMatrix2DComparator() {
public int compare(DoubleMatrix2D a, DoubleMatrix2D b) {
return a.zSum() == b.zSum() ? 1 : 0;
}
};
System.out.println(A);
System.out.println(Algebra.ZERO.inverse(A));
timer.stop().display();
System.out.println("done.");
}