Skip to content

Commit 23aaf7e

Browse files
committed
Add docstring to the rank(::QRPivoted) method
With the release of Julia 1.12, LinearAlgebra.jl is adding dispatches for rank to SVD and QRPivoted objects, allowing the re-use of existing matrix factorizations where they have already been computed. The SVD method already has an appropriate docstring; this PR adds a near-identical one to the QRPivoted method as well.
1 parent c4a477f commit 23aaf7e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/qr.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,19 @@ function ldiv!(A::QRCompactWY{T}, B::AbstractMatrix{T}) where {T}
535535
return B
536536
end
537537

538+
"""
539+
rank(A::QRPivoted{<:Any, T}; atol::Real=0, rtol::Real=min(n,m)*ϵ) where {T}
540+
541+
Compute the numerical rank of the QR factorization `A` by counting how many diagonal entries of
542+
`A.factors` are greater than `max(atol, rtol*Δ₁)` where `Δ₁` is the largest calculated such entry.
543+
This is equivalent to the default [`rank(::AbstractMatrix)`](@ref) method except that it re-uses an existing QR factorization.
544+
`atol` and `rtol` are the absolute and relative tolerances, respectively.
545+
The default relative tolerance is `n*ϵ`, where `n` is the size of the smallest dimension of `A`
546+
and `ϵ` is the [`eps`](@ref) of the element type of `A`.
547+
548+
!!! compat "Julia 1.12"
549+
The `rank(::QRPivoted)` method requires at least Julia 1.12.
550+
"""
538551
function rank(A::QRPivoted; atol::Real=0, rtol::Real=min(size(A)...) * eps(real(float(eltype(A)))) * iszero(atol))
539552
m = min(size(A)...)
540553
m == 0 && return 0

0 commit comments

Comments
 (0)