Skip to content

Commit 58003a5

Browse files
authored
Document SingularException throw for inv(::AbstractMatrix) (#1331)
I suggest documenting that `inv(::AbstractMatrix)` throws on (numerically) singular matrices, this is different from `inv(::Number)` that returns `Inf`. ```julia inv( 0. ) # Inf, no exception inv( [0;;] ) # SingularException ``` I guess documenting this would mean that `inv` guarantees to return a matrix with only finite (`isfinite`) entries if the argument has only finite entries, but I don't know if the implementation guarantees it / if this should be tested ?
2 parents f0e36ea + 05b703b commit 58003a5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/generic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,8 @@ Matrix inverse. Computes matrix `N` such that
11521152
Computed by solving the left-division
11531153
`N = M \\ I`.
11541154
1155+
A [`SingularException`](@ref) is thrown if `M` fails numerical inversion.
1156+
11551157
# Examples
11561158
```jldoctest
11571159
julia> M = [2 5; 1 3]

0 commit comments

Comments
 (0)