Is there a way to find right-inverse (or left-inverse) of a matrix in Julia?

The pseudo-inverse, returned by pinv, is equal to a right inverse (or left inverse), if one exists:

julia> using LinearAlgebra

julia> A = [1 2 3; 0 1 2]
2×3 Matrix{Int64}:
 1  2  3
 0  1  2

julia> A * pinv(A) ≈ I
true

(Edit: Note that right or left inverses are not generally unique, however. Also, in most practical applications, it is a truism of numerical linear algebra that one should avoid computing inverses explicitly if possible.)

4 Likes