def nullspace(A, atol=1e-13, rtol=0):
 A = np.atleast_2d(A)
 (u, s, vh) = svd(A)
 tol = max(atol, (rtol * s[0]))
 nnz = (s >= tol).sum()
 ns = vh[nnz:].conj().T
 return ns

def nullspace ( A , atol = 1e-13 , rtol = 0 ) : A = np . atleast_2d ( A ) ( u , s , vh ) = svd ( A ) tol = max ( atol , ( rtol * s [ 0 ] ) ) nnz = ( s >= tol ) . sum ( ) ns = vh [ nnz : ] . conj ( ) . T return ns
compute an approximate basis for the nullspace of a .