def test_potrf_speed(): t = 5000 mat = gen_random_pd(t, np.float32, F=False, seed=12345) t_s = time.time() our_chol = potrf(mat, upper=False, clean=True, overwrite=False, cuda=False) our_time = time.time() - t_s t_s = time.time() np_chol = np.linalg.cholesky(mat) np_time = time.time() - t_s np.testing.assert_allclose(np_chol, our_chol, rtol=1e-5) print("Time for cholesky(%d): Numpy %.2fs - Our %.2fs" % (t, np_time, our_time))
def pd_data(request): size = request.param return gen_random_pd(size, 'float64', F=False, seed=12)
def mat(self): return gen_random_pd(self.t, np.float64, F=True, seed=12345)
def mat(self): return torch.from_numpy( gen_random_pd(self.t, 'float64', F=False, seed=9))