本文整理汇总了Java中cc.mallet.types.SparseVector.print方法的典型用法代码示例。如果您正苦于以下问题:Java SparseVector.print方法的具体用法?Java SparseVector.print怎么用?Java SparseVector.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cc.mallet.types.SparseVector
的用法示例。
在下文中一共展示了SparseVector.print方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPrint
import cc.mallet.types.SparseVector; //导入方法依赖的package包/类
public void testPrint ()
{
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
PrintStream out = new PrintStream (baos);
PrintStream oldOut = System.out;
System.setOut (out);
SparseVector standard = new SparseVector (idxs, dbl2);
standard.print ();
assertEquals ("SparseVector[3] = 1.0\nSparseVector[5] = 1.5\nSparseVector[7] = 2.0\nSparseVector[13] = 1.0\nSparseVector[15] = 1.0\n", baos.toString ());
baos.reset ();
SparseVector dense = new SparseVector (null, dbl2);
dense.print ();
assertEquals ("SparseVector[0] = 1.0\nSparseVector[1] = 1.5\nSparseVector[2] = 2.0\nSparseVector[3] = 1.0\nSparseVector[4] = 1.0\n", baos.toString ());
baos.reset ();
SparseVector binary = new SparseVector (idxs, null, idxs.length, idxs.length,
false, false, false);
binary.print ();
assertEquals ("SparseVector[3] = 1.0\nSparseVector[5] = 1.0\nSparseVector[7] = 1.0\nSparseVector[13] = 1.0\nSparseVector[15] = 1.0\n", baos.toString ());
baos.reset ();
}
示例2: testTimesEquals
import cc.mallet.types.SparseVector; //导入方法依赖的package包/类
public void testTimesEquals ()
{
double[] d1 = new double[] {1, 2, 3, 4, 5};
SparseVector m1 = new SparseVector (d1);
SparseVector m2 = new SparseVector (d1);
m2.timesEqualsSparse(m1);
m2.print();
}