Пример #1
0
def test_eig_inv():
    """Test matrix pseudoinversion with setting smallest eigenvalue to zero."""
    # create rank-deficient array
    a = np.array([[1., 0., 1.], [0., 1., 0.], [1., 0., 1.]])

    # test inversion
    a_inv = np.linalg.pinv(a)
    a_inv_eig = _eig_inv(a, 2)

    assert_almost_equal(a_inv, a_inv_eig)
Пример #2
0
def test_eig_inv():
    """Test matrix pseudoinversion with setting smallest eigenvalue to zero."""
    # create rank-deficient array
    a = np.array([[1., 0., 1.], [0., 1., 0.], [1., 0., 1.]])

    # test inversion
    a_inv = np.linalg.pinv(a)
    a_inv_eig = _eig_inv(a, 2)

    assert_almost_equal(a_inv, a_inv_eig)