title: How can I compare two 2D NumPy arrays of size 40k × 40k?
body: <p>I must compare 2 NumPy arrays of floats. Unfortunately of the order of  10^-3 or smaller, of size 40k × 40k. They must be identical. Can I directly print/mask the elements that differ?</p>
  <p>I tried <code>allclose</code> and <code>isclose</code>:</p>
  <pre><code>&gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; F_sp = np.load('./Matrix/Fmatrix.npy')
  &gt;&gt;&gt; F_org = np.load('./../Org/FMatrix.npy')
  &gt;&gt;&gt; print(&quot; all close? {} &quot;.format(np.allclose(F_sp,F_org,equal_nan=True)))
  all close? False
  
  &gt;&gt;&gt; print(&quot; is close? {} &quot;.format(np.isclose(F_sp,F_org,equal_nan=True)))
  is close? [[ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   ...
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]]
  
  &gt;&gt;&gt; print(&quot; is close? {} &quot;.format(np.isclose(F_sp,F_org,equal_nan=False)))
  is close? [[ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   ...
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]
   [ True  True  True ...  True  True  True]]
  
  &gt;&gt;&gt; np.set_printoptions(threshold=sys.maxsize)
  &gt;&gt;&gt; print(&quot; is close? {} &quot;.format(np.isclose(F_sp,F_org,equal_nan=True)))
  Traceback (most recent call last):
  File &quot;&lt;pyshell#14&gt;&quot;, line 1, in &lt;module&gt;
    print(&quot; is close? {} &quot;.format(np.isclose(F_sp,F_org,equal_nan=True)))
  OverflowError: cannot serialize a string larger than 4GiB
  </code></pre>