def test_house(): """ Simple test of house (Householder transform). Just checks to see if the det(h) == -1, (reflection matrices have this property) """ x = np.ones(5) v, beta, s = rogues.house(x) h = np.eye(5) - beta * np.outer(v, v) d = nl.det(h) npt.assert_almost_equal(d, -1., 12)
def test_house_reflect(): """ Simple test of house (Householder transform). Just checks to see if the input vector is reflected to be all in the x[0] direction """ x = np.ones(5) v, beta, s = rogues.house(x) h = np.eye(5) - beta * np.outer(v, v) d = np.dot(h, x) d2 = np.dot(d, d) npt.assert_almost_equal(d2, d[0] ** 2, 12)