def test_GramSchmidt_vector(self): P1 = np.array([0, 0, 0]) P2 = np.array([2, 0, 0]) P3 = np.array([1, 1, 0]) result = vector.GramSchmidt(P1, P2, P3) correct = array([1., 0., 0., 0., 1., 0., 0., 0., 1.]) self.assertTrue(np.all(np.abs(result - correct) < self.delta))
def test_GramSchmidt(self): P1 = np.array([[0, 0, 0], [1,2,3]]) P2 = np.array([[1, 0, 0], [4,1,0]]) P3 = np.array([[1, 1, 0], [9,-1,1]]) result = vector.GramSchmidt(P1,P2,P3) correct = array([[ 1. , 0. , 0. , 0. , 1. , 0. , 0. , 0. , 1. ], [ 0.6882472 , -0.22941573, -0.6882472 , 0.62872867, -0.28470732, 0.72363112, -0.36196138, -0.93075784, -0.05170877]]) self.assertTrue(np.all(np.abs(result-correct)<self.delta))