Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MatrixAlgebraKit"
uuid = "6c742aac-3347-4629-af66-fc926824e5e4"
authors = ["Jutho <[email protected]> and contributors"]
version = "0.2.3"
version = "0.2.4"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
6 changes: 6 additions & 0 deletions src/implementations/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ function svd_full!(A::AbstractMatrix, USVᴴ, alg::LAPACK_SVDAlgorithm)
fill!(S, zero(eltype(S)))
m, n = size(A)
minmn = min(m, n)
if minmn == 0
one!(U)
zero!(S)
one!(Vᴴ)
return USVᴴ
end
if alg isa LAPACK_QRIteration
isempty(alg.kwargs) ||
throw(ArgumentError("LAPACK_QRIteration does not accept any keyword arguments"))
Expand Down
4 changes: 2 additions & 2 deletions test/svd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using MatrixAlgebraKit: TruncatedAlgorithm, TruncationKeepAbove, diagview
@testset "svd_compact! for T = $T" for T in (Float32, Float64, ComplexF32, ComplexF64)
rng = StableRNG(123)
m = 54
@testset "size ($m, $n)" for n in (37, m, 63)
@testset "size ($m, $n)" for n in (37, m, 63, 0)
k = min(m, n)
if LinearAlgebra.LAPACK.version() < v"3.12.0"
algs = (LAPACK_DivideAndConquer(), LAPACK_QRIteration(), LAPACK_Bisection(),
Expand Down Expand Up @@ -57,7 +57,7 @@ end
@testset "svd_full! for T = $T" for T in (Float32, Float64, ComplexF32, ComplexF64)
rng = StableRNG(123)
m = 54
@testset "size ($m, $n)" for n in (37, m, 63)
@testset "size ($m, $n)" for n in (37, m, 63, 0)
@testset "algorithm $alg" for alg in
(LAPACK_DivideAndConquer(), LAPACK_QRIteration())
A = randn(rng, T, m, n)
Expand Down