Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linalg: Moore-Penrose pseudo-inverse (pinv) #899

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

perazz
Copy link
Contributor

@perazz perazz commented Nov 27, 2024

Compute pseudo-inverse of a square or rectangular matrix using singular value decomposition (SVD).
Array $A$, real or complex, has rank n==2.

The pseudo-inverse $A^{+}$ is a generalization of the matrix inverse and satisfies the following properties:

  • $A \cdot A^{+} \cdot A = A$
  • $A^{+} \cdot A \cdot A^{+} = A^{+}$
  • $(A \cdot A^{+})^H = A \cdot A^{+}$
  • $(A^{+} \cdot A)^H = A^{+} \cdot A$

The user may specify an eigenvalue cutoff relative tolerance, rtol.

Proposed interface

  • ap = pinv(a [, rtol] [, err]): function interface
  • call pseudoinvert(a, ap [, rtol] [, err]): subroutine interface (preallocated ap)
  • .pinv.a: operator interface

Key facts

Progress

  • base implementation
  • tests
  • documentation
  • submodule
  • examples

Prior art

  • Numpy: linalg.pinv(a, rcond=None, hermitian=False, *, rtol=<no value>)
  • Scipy: pinv(a, *, atol=None, rtol=None, return_rank=False, check_finite=True)
  • Matlab: B = pinv(a [,tol])

cc: @jvdp1 @jalvesz @Beliavsky @CRquantum @fortran-lang/stdlib

@perazz perazz marked this pull request as ready for review November 27, 2024 17:18
@perazz perazz changed the title linalg: Moore-Penrose pseudo-inverse linalg: Moore-Penrose pseudo-inverse (pinv) Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant