Skip to content

Commit 6ade90a

Browse files
authored
Fix geqp3! documentation (#34784)
1 parent 663ab4a commit 6ade90a

File tree

1 file changed

+15
-32
lines changed

1 file changed

+15
-32
lines changed

stdlib/LinearAlgebra/src/lapack.jl

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -592,18 +592,29 @@ Returns `A` and `tau` modified in-place.
592592
geqlf!(A::AbstractMatrix, tau::AbstractVector)
593593

594594
"""
595-
geqp3!(A, jpvt, tau)
595+
geqp3!(A, [jpvt, tau]) -> (A, tau, jpvt)
596596
597597
Compute the pivoted `QR` factorization of `A`, `AP = QR` using BLAS level 3.
598598
`P` is a pivoting matrix, represented by `jpvt`. `tau` stores the elementary
599-
reflectors. `jpvt` must have length length greater than or equal to `n` if `A`
600-
is an `(m x n)` matrix. `tau` must have length greater than or equal to the
601-
smallest dimension of `A`.
599+
reflectors. The arguments `jpvt` and `tau` are optional and allow
600+
for passing preallocated arrays. When passed, `jpvt` must have length greater
601+
than or equal to `n` if `A` is an `(m x n)` matrix and `tau` must have length
602+
greater than or equal to the smallest dimension of `A`.
602603
603604
`A`, `jpvt`, and `tau` are modified in-place.
604605
"""
605606
geqp3!(A::AbstractMatrix, jpvt::AbstractVector{BlasInt}, tau::AbstractVector)
606607

608+
function geqp3!(A::AbstractMatrix{<:BlasFloat}, jpvt::AbstractVector{BlasInt})
609+
m, n = size(A)
610+
geqp3!(A, jpvt, similar(A, min(m, n)))
611+
end
612+
613+
function geqp3!(A::AbstractMatrix{<:BlasFloat})
614+
m, n = size(A)
615+
geqp3!(A, zeros(BlasInt, n), similar(A, min(m, n)))
616+
end
617+
607618
"""
608619
geqrt!(A, T)
609620
@@ -725,34 +736,6 @@ which parameterize the elementary reflectors of the factorization.
725736
"""
726737
gerqf!(A::AbstractMatrix{<:BlasFloat}) = ((m,n) = size(A); gerqf!(A, similar(A, min(m, n))))
727738

728-
"""
729-
geqp3!(A, jpvt) -> (A, jpvt, tau)
730-
731-
Compute the pivoted `QR` factorization of `A`, `AP = QR` using BLAS level 3.
732-
`P` is a pivoting matrix, represented by `jpvt`. `jpvt` must have length
733-
greater than or equal to `n` if `A` is an `(m x n)` matrix.
734-
735-
Returns `A` and `jpvt`, modified in-place, and `tau`, which stores the elementary
736-
reflectors.
737-
"""
738-
function geqp3!(A::AbstractMatrix{<:BlasFloat}, jpvt::AbstractVector{BlasInt})
739-
m, n = size(A)
740-
geqp3!(A, jpvt, similar(A, min(m, n)))
741-
end
742-
743-
"""
744-
geqp3!(A) -> (A, jpvt, tau)
745-
746-
Compute the pivoted `QR` factorization of `A`, `AP = QR` using BLAS level 3.
747-
748-
Returns `A`, modified in-place, `jpvt`, which represents the pivoting matrix `P`,
749-
and `tau`, which stores the elementary reflectors.
750-
"""
751-
function geqp3!(A::AbstractMatrix{<:BlasFloat})
752-
m, n = size(A)
753-
geqp3!(A, zeros(BlasInt, n), similar(A, min(m, n)))
754-
end
755-
756739
## Tools to compute and apply elementary reflectors
757740
for (larfg, elty) in
758741
((:dlarfg_, Float64),

0 commit comments

Comments
 (0)