def test_schmidt(self): numpy.random.seed(10) n = 100 a = numpy.random.random((n,n)) s = numpy.dot(a.T, a) c = orth.schmidt(s) self.assertTrue(numpy.allclose(reduce(numpy.dot, (c.T, s, c)), numpy.eye(n))) x1 = numpy.dot(a, c) x2 = orth.vec_schmidt(a) d = numpy.dot(x1.T,x2) d[numpy.diag_indices(n)] = 0 self.assertAlmostEqual(numpy.linalg.norm(d), 0, 9) self.assertAlmostEqual(numpy.linalg.norm(c), 36.56738258719514, 9) self.assertAlmostEqual(abs(c).sum(), 1123.2089785000373, 7)
def test_schmidt(self): numpy.random.seed(10) n = 100 a = numpy.random.random((n, n)) s = numpy.dot(a.T, a) c = orth.schmidt(s) self.assertTrue( numpy.allclose(reduce(numpy.dot, (c.T, s, c)), numpy.eye(n))) x1 = numpy.dot(a, c) x2 = orth.vec_schmidt(a) d = numpy.dot(x1.T, x2) d[numpy.diag_indices(n)] = 0 self.assertAlmostEqual(numpy.linalg.norm(d), 0, 9) self.assertAlmostEqual(numpy.linalg.norm(c), 36.56738258719514, 9) self.assertAlmostEqual(abs(c).sum(), 1123.2089785000373, 7)