org.apache.mahout.math.Matrix.timesSquared()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.apache.mahout.math.Matrix.timesSquared()方法的一些代码示例,展示了Matrix.timesSquared()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.timesSquared()方法的具体详情如下:
包路径:org.apache.mahout.math.Matrix
类名称:Matrix
方法名:timesSquared

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);
}

相关文章