Esempio n. 1
0
 def test_times_rdd(self):
     mat1 = MatrixRDD(self.sc.parallelize([(1, array([1, 2, 3])), (2, array([4, 5, 6]))]))
     mat2 = MatrixRDD(self.sc.parallelize([(1, array([7, 8, 9])), (2, array([10, 11, 12]))]))
     truth = array([[47, 52, 57], [64, 71, 78], [81, 90, 99]])
     resultA = mat1.times(mat2)
     resultB = mat1.times(mat2, "accum")
     assert array_equal(resultA, truth)
     assert array_equal(resultB, truth)
Esempio n. 2
0
 def test_times_rdd(self):
     mat1 = MatrixRDD(
         self.sc.parallelize([(1, array([1, 2, 3])), (2, array([4, 5,
                                                                6]))]))
     mat2 = MatrixRDD(
         self.sc.parallelize([(1, array([7, 8, 9])), (2, array([10, 11,
                                                                12]))]))
     truth = array([[47, 52, 57], [64, 71, 78], [81, 90, 99]])
     resultA = mat1.times(mat2)
     resultB = mat1.times(mat2, "accum")
     assert array_equal(resultA, truth)
     assert array_equal(resultB, truth)
Esempio n. 3
0
 def test_times_array(self):
     mat1 = MatrixRDD(
         self.sc.parallelize([(1, array([1, 2, 3])), (2, array([4, 5,
                                                                6]))]))
     mat2 = array([[7, 8], [9, 10], [11, 12]])
     truth = [array([58, 64]), array([139, 154])]
     result = mat1.times(mat2).collect()
     assert array_equal(result, truth)
Esempio n. 4
0
 def test_times_array(self):
     mat1 = MatrixRDD(self.sc.parallelize([(1, array([1, 2, 3])), (2, array([4, 5, 6]))]))
     mat2 = array([[7, 8], [9, 10], [11, 12]])
     truth = [array([58, 64]), array([139, 154])]
     result = mat1.times(mat2).collect()
     assert array_equal(result, truth)