Checking if a matrix is symmetric in Numpy
问题 I'm trying to make a function with the arguments (a,tol=1e-8) that returns a boolean value that tells the user whether or not the matrix is symmetric (symmetric matrix is equal to its transpose). So far I have: def check_symmetric(a, tol=1e-8): if np.transpose(a, axes=axes) == np.transpose(a, axes=axes): return True def sqr(s): rows = len(s) for row in sq: if len(row) != rows: return False return True if a != sqr(s): raise ValueError although I keep getting an axes isn't defined message so I