<p dir="auto">I am working with bidimensional arrays on Numpy. One of my arrays, H, is random, and I want to compute its pseudoinverse. If I use scipy.linalg.pinv2 everything runs smoothly. However, if I use scipy.linalg.pinv, sometimes problems arise.</p>
<p dir="auto">The problem is that, if the j-th column of H is all 1s, pinv(H) has huge coefficients at the j-th row. This is in turn a problem because, in such cases, np.dot(pinv(H), Y) contains some nan values (Y is an array of small integers).</p>
<p dir="auto">Now, I am not into linear algebra and numeric computation enough to understand if this is a bug or some precision related property of the two functions. If this is not a bug, please close this issue and I apologize.</p>
<p dir="auto">I saved the arrays with np.savetxt(fn, a, '%.2e', ';'): please, see <a href="https://dl.dropboxusercontent.com/u/48242012/example.tar.gz" rel="nofollow">https://dl.dropboxusercontent.com/u/48242012/example.tar.gz</a> to find them.</p>
<p dir="auto">In the provided file, you can see in pinv(H).csv that rows 14, 33, 55, 56 and 99 have huge values, while in pinv2(H) the same rows have more decent values.</p>
<p dir="auto">(I posted the same question on StackOverflow yesterday, but it did not receive much attention: <a href="http://stackoverflow.com/questions/27775986/numpy-scipy-pinv-and-pinv2-behave-differently" rel="nofollow">http://stackoverflow.com/questions/27775986/numpy-scipy-pinv-and-pinv2-behave-differently</a> . I am reposting here just to signal this behaviour and to suggest that it may be documented - I  can survive with pinv2.)</p>
<p dir="auto">I appreciate your efforts.</p>
<p dir="auto">it is currently not possible to install scipy on MacOs 12 + M1 Max</p>
<p dir="auto">python: 3.9.7</p>
<p dir="auto">Running</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="OPENBLAS=&quot;$(brew --prefix openblas)&quot; python3 -m pip install scipy"><pre class="notranslate"><code class="notranslate">OPENBLAS="$(brew --prefix openblas)" python3 -m pip install scipy
</code></pre></div>
<p dir="auto">yields</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  2 warnings generated.
  /opt/homebrew/bin/gfortran -Wall -g -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-12.0-arm64-3.9/scipy/integrate/_quadpackmodule.o -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Lbuild/temp.macosx-12.0-arm64-3.9 -Wl,-rpath,/opt/homebrew/opt/openblas/lib -lquadpack -lmach -lopenblas -lopenblas -lgfortran -o build/lib.macosx-12.0-arm64-3.9/scipy/integrate/_quadpack.cpython-39-darwin.so
  gfortran: warning: could not understand version 12.0
  ld: -rpath can only be used when targeting Mac OS X 10.5 or later
  collect2: error: ld returned 1 exit status
  error: Command &quot;/opt/homebrew/bin/gfortran -Wall -g -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-12.0-arm64-3.9/scipy/integrate/_quadpackmodule.o -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Lbuild/temp.macosx-12.0-arm64-3.9 -Wl,-rpath,/opt/homebrew/opt/openblas/lib -lquadpack -lmach -lopenblas -lopenblas -lgfortran -o build/lib.macosx-12.0-arm64-3.9/scipy/integrate/_quadpack.cpython-39-darwin.so&quot; failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects"><pre class="notranslate"><code class="notranslate">  2 warnings generated.
  /opt/homebrew/bin/gfortran -Wall -g -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-12.0-arm64-3.9/scipy/integrate/_quadpackmodule.o -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Lbuild/temp.macosx-12.0-arm64-3.9 -Wl,-rpath,/opt/homebrew/opt/openblas/lib -lquadpack -lmach -lopenblas -lopenblas -lgfortran -o build/lib.macosx-12.0-arm64-3.9/scipy/integrate/_quadpack.cpython-39-darwin.so
  gfortran: warning: could not understand version 12.0
  ld: -rpath can only be used when targeting Mac OS X 10.5 or later
  collect2: error: ld returned 1 exit status
  error: Command "/opt/homebrew/bin/gfortran -Wall -g -Wall -g -undefined dynamic_lookup -bundle build/temp.macosx-12.0-arm64-3.9/scipy/integrate/_quadpackmodule.o -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -L/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Lbuild/temp.macosx-12.0-arm64-3.9 -Wl,-rpath,/opt/homebrew/opt/openblas/lib -lquadpack -lmach -lopenblas -lopenblas -lgfortran -o build/lib.macosx-12.0-arm64-3.9/scipy/integrate/_quadpack.cpython-39-darwin.so" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects
</code></pre></div>