def check_simple_cols(self): a = array([[1, 2, 3], [4, 5, 6.0]]) a_pinv = pinv(a) a_pinv2 = pinv2(a) assert_array_almost_equal(a_pinv, a_pinv2)
def check_simple_rows(self): a = array([[1, 2], [3, 4], [5, 6]]) a_pinv = pinv(a) a_pinv2 = pinv2(a) assert_array_almost_equal(a_pinv, a_pinv2)
def check_simple(self): a = array([[1, 2, 3], [4, 5, 6.0], [7, 8, 10]]) a_pinv = pinv(a) assert_array_almost_equal(dot(a, a_pinv), [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) a_pinv = pinv2(a) assert_array_almost_equal(dot(a, a_pinv), [[1, 0, 0], [0, 1, 0], [0, 0, 1]])