def test_apply_rowwise(self): A = elem.DistMatrix_d_VR_STAR() elem.Uniform(A, 100, self.n) S = sketch.FJLT(self.n, self.sn) SA = np.zeros((100, self.sn), order='F') S.apply(A, SA, "rowwise")
def test_apply_colwise(self): A = elem.DistMatrix_d_VR_STAR() elem.Uniform(A, self.n, 100) S = sketch.FJLT(self.n, self.sn) SA = np.zeros((self.sn, 100), order='F') S.apply(A, SA, "columnwise")
def test_apply_colwise(self): A = elem.DistMatrix_d_VR_STAR() #FIXME: Christos, use your matrix problem factory here elem.Uniform(A, _M, _N) #FIXME: A.Matrix will not work in parallel self.sv = np.linalg.svd(A.Matrix, full_matrices=1, compute_uv=0) for sketch in self.sketches: results = test_helper(A, _M, _N, _R, sketch, [self.svd_bound], MPI) self.check_result(results, str(sketch))
import elem from skylark import sketch, elemhelper from mpi4py import MPI import numpy as np import time # Configuration m = 20000 n = 300 t = 1000 #sketches = { "JLT" : sketch.JLT, "FJLT" : sketch.FJLT, "CWT" : sketch.CWT } sketches = {"JLT": sketch.JLT, "CWT": sketch.CWT} # Set up the random regression problem. A = elem.DistMatrix_d_VR_STAR() elem.Uniform(A, m, n) b = elem.DistMatrix_d_VR_STAR() elem.Uniform(b, m, 1) # Solve using Elemental # Elemental currently does not support LS on VR,STAR. # So we copy. A1 = elem.DistMatrix_d() elem.Copy(A, A1) b1 = elem.DistMatrix_d() elem.Copy(b, b1) x = elem.DistMatrix_d(n, 1) t0 = time.time() elem.LeastSquares(elem.NORMAL, A1, b1, x) telp = time.time() - t0