def testEigSymmetric(self):
    q_expected = np.array([[(1.0 / np.sqrt(2)), ((- 1.0) / np.sqrt(2))], [(1.0 / np.sqrt(2)), (1.0 / np.sqrt(2))]])
    pandas_testing.assert_almost_equal(q_expected.T.dot(q_expected), np.identity(2))
    lambda_expected = np.diag([3.0, 2.0])
    a = q_expected.dot(lambda_expected).dot(q_expected.T)
    (lambda_computed, q_computed) = transform.eig_symmetric(a)
    pandas_testing.assert_almost_equal(np.diag(lambda_expected), lambda_computed)
    pandas_testing.assert_almost_equal(np.identity(2), q_expected.T.dot(q_expected))
    for i in range(q_expected.shape[0]):
        ev_expected = q_expected[:, i]
        ev_computed = q_computed[:, i]
        pandas_testing.assert_almost_equal(1.0, np.abs(ev_expected.dot(ev_computed)))
def testEigSymmetric(self):
    q_expected = np.array([[(1.0 / np.sqrt(2)), ((- 1.0) / np.sqrt(2))], [(1.0 / np.sqrt(2)), (1.0 / np.sqrt(2))]])
    pandas_testing.assert_almost_equal(q_expected.T.dot(q_expected), np.identity(2))
    lambda_expected = np.diag([3.0, 2.0])
    a = q_expected.dot(lambda_expected).dot(q_expected.T)
    (lambda_computed, q_computed) = transform.eig_symmetric(a)
    pandas_testing.assert_almost_equal(np.diag(lambda_expected), lambda_computed)
    pandas_testing.assert_almost_equal(np.identity(2), q_expected.T.dot(q_expected))
    for i in range(q_expected.shape[0]):
        ev_expected = q_expected[:, i]
        ev_computed = q_computed[:, i]
        pandas_testing.assert_almost_equal(1.0, np.abs(ev_expected.dot(ev_computed)))