matrices.py 216 B

12345678
  1. def allclose(A, B, rtol=1e-05, atol=1e-08):
  2. if len(A) != len(B):
  3. return False
  4. for x, y in zip(A, B):
  5. if abs(x-y) > atol + rtol * max(abs(x), abs(y)):
  6. return False
  7. return True