def testQRExecution(self): data = np.random.randn(18, 6) a = tensor(data, chunk_size=(3, 6)) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=(9, 6)) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=3) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data))
def testQRExecution(self): data = np.random.randn(18, 6) a = tensor(data, chunk_size=(3, 6)) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=(9, 6)) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=3) q, r = qr(a) t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) # test for Short-and-Fat QR data = np.random.randn(6, 18) a = tensor(data, chunk_size=(6, 9)) q, r = qr(a, method='sfqr') t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=(3, 3)) q, r = qr(a, method='sfqr') t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data)) a = tensor(data, chunk_size=(6, 3)) q, r = qr(a, method='sfqr') t = q.dot(r) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, data))