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

Specify how to obtain all inverses #1835

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/Matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3553,11 +3553,15 @@ end
@doc raw"""
is_invertible_with_inverse(A::MatrixElem{T}; side::Symbol = :left) where {T <: RingElement}

Given an $n\times m$ matrix $A$ over a ring, return a tuple `(flag, B)`.
If `side` is `:right` and `flag` is true, $B$ is the right inverse of $A$
i.e. $AB$ is the $n\times n$ unit matrix. If `side` is `:left` and `flag` is
true, $B$ is the left inverse of $A$ i.e. $BA$ is the $m\times m$ unit matrix.
If `flag` is false, no right or left inverse exists.
Given an $n \times m$ matrix $A$ over a ring, return a tuple `(flag, B)`. If
`side` is `:right` and `flag` is true, $B$ is a right inverse of $A$ i.e. $A B$
is the $n \times n$ unit matrix. If `side` is `:left` and `flag` is true, $B$
is a left inverse of $A$ i.e. $B A$ is the $m \times m$ unit matrix. If `flag`
is false, no right or left inverse exists.
fingolfin marked this conversation as resolved.
Show resolved Hide resolved

To get the space of all inverses, note that if $B$ and $C$ are both right
inverses, then $A (B - C) = 0$, and similar for left inverses. Hence from one
inverse one can find all by making suitable use of [`kernel`](@ref).
"""
function is_invertible_with_inverse(A::MatrixElem{T}; side::Symbol = :left) where {T <: RingElement}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an issue of this PR, but for the record: I am surprised that this function can do strictly more (namely handle non-square matrices) than its is_invertible sibling.

if (side == :left && nrows(A) < ncols(A)) || (side == :right && ncols(A) < nrows(A))
Expand Down
Loading