Beispiel #1
0
def benchmark_ssvd(ctx, timer):
    DIM = (1280, 1280)
    #A = expr.randn(*DIM, dtype=np.float64)
    A = np.random.randn(*DIM)
    A = expr.from_numpy(A)
    t1 = datetime.now()
    U, S, VT = svd(A)
    t2 = datetime.now()
    cost_time = millis(t1, t2)

    print "total cost time:%s ms" % (cost_time)
Beispiel #2
0
def benchmark_ssvd(ctx, timer):
  DIM = (1280, 1280)
  #A = expr.randn(*DIM, dtype=np.float64)
  A = np.random.randn(*DIM)
  A = expr.from_numpy(A)
  t1 = datetime.now()
  U,S,VT = svd(A)
  t2 = datetime.now()
  cost_time = millis(t1, t2)
    
  print "total cost time:%s ms" % (cost_time)
Beispiel #3
0
 def test_ssvd(self):
   ctx = blob_ctx.get() 
   # Create a sparse matrix.
   A = expr.randn(*DIM, tile_hint = (int(DIM[0]/ctx.num_workers), DIM[1]), 
                  dtype=np.float64)
   
   U,S,VT = svd(A)
   U2,S2,VT2 = linalg.svd(A.glom(), full_matrices=0)
   
   assert np.allclose(absolute(U.glom()), absolute(U2))
   assert np.allclose(absolute(S), absolute(S2))
   assert np.allclose(absolute(VT), absolute(VT2))
Beispiel #4
0
    def test_ssvd(self):
        ctx = blob_ctx.get()
        # Create a sparse matrix.
        A = expr.randn(*DIM,
                       tile_hint=(int(DIM[0] / ctx.num_workers), DIM[1]),
                       dtype=np.float64)

        U, S, VT = svd(A)
        U2, S2, VT2 = linalg.svd(A.glom(), full_matrices=0)

        assert np.allclose(absolute(U.glom()), absolute(U2))
        assert np.allclose(absolute(S), absolute(S2))
        assert np.allclose(absolute(VT), absolute(VT2))