From 7298a3d6cf717a40d854828b564ceffe670cf65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= Date: Mon, 7 Oct 2024 13:46:43 +0200 Subject: [PATCH 1/2] Clarify how to get all left/right inverses In docstring for `is_invertible_with_inverse`. Co-authored-by: Max Horn Co-authored-by: Tommy Hofmann --- src/Matrix.jl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Matrix.jl b/src/Matrix.jl index da66507b2..93d4fbcb9 100644 --- a/src/Matrix.jl +++ b/src/Matrix.jl @@ -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. + +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} if (side == :left && nrows(A) < ncols(A)) || (side == :right && ncols(A) < nrows(A)) From 2c1675e0d4fe7c3921c705375223abd32480a00d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 7 Oct 2024 21:53:10 +0200 Subject: [PATCH 2/2] Update src/Matrix.jl --- src/Matrix.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Matrix.jl b/src/Matrix.jl index 93d4fbcb9..3ef3a0af4 100644 --- a/src/Matrix.jl +++ b/src/Matrix.jl @@ -3554,10 +3554,10 @@ end 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 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. +`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. 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