本文整理了Java中org.apache.mahout.math.Matrix.timesSquared()
方法的一些代码示例,展示了Matrix.timesSquared()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.timesSquared()
方法的具体详情如下:
包路径:org.apache.mahout.math.Matrix
类名称:Matrix
方法名:timesSquared
暂无
代码示例来源:origin: apache/mahout
@Test
public void testTimesSquaredTimesVector() {
Vector vectorA = new DenseVector(vectorAValues);
Vector ttA = test.timesSquared(vectorA);
Vector ttASlow = test.transpose().times(test.times(vectorA));
assertTrue("M'Mv != M.timesSquared(v): " + ttA + " != " + ttASlow,
ttASlow.minus(ttA).norm(2) < 1.0e-12);
}
代码示例来源:origin: cloudera/mahout
@Test
public void testTimesSquaredTimesVector() {
Vector vectorA = new DenseVector(vectorAValues);
Vector ttA = test.timesSquared(vectorA);
Vector ttASlow = test.transpose().times(test.times(vectorA));
assertTrue("M'Mv != M.timesSquared(v): " + ttA + " != " + ttASlow,
ttASlow.minus(ttA).norm(2) < 1.0e-12);
}
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
@Test
public void testMatrixTimesSquaredVector() throws Exception {
Vector v = new RandomAccessSparseVector(50);
v.assign(1.0);
Matrix m = SolverTest.randomSequentialAccessSparseMatrix(100, 90, 50, 20, 1.0);
DistributedRowMatrix dm = randomDistributedMatrix(100, 90, 50, 20, 1.0, false);
dm.setConf(getConfiguration());
Vector expected = m.timesSquared(v);
Vector actual = dm.timesSquared(v);
assertEquals(0.0, expected.getDistanceSquared(actual), 1.0e-9);
}
内容来源于网络,如有侵权,请联系作者删除!