From 66f6aaeaa6b7e2d1b49b77fa6de7a0cb495dfac4 Mon Sep 17 00:00:00 2001 From: Arhik Date: Fri, 19 Jul 2024 08:36:31 +0530 Subject: [PATCH 1/2] propertynames for SVD respects private argument --- stdlib/LinearAlgebra/src/svd.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/LinearAlgebra/src/svd.jl b/stdlib/LinearAlgebra/src/svd.jl index 7a88c4a6e14c4..a3017f336992a 100644 --- a/stdlib/LinearAlgebra/src/svd.jl +++ b/stdlib/LinearAlgebra/src/svd.jl @@ -206,8 +206,10 @@ function getproperty(F::SVD, d::Symbol) end end -Base.propertynames(F::SVD, private::Bool=false) = - private ? (:V, fieldnames(typeof(F))...) : (:U, :S, :V, :Vt) +Base.propertynames(F::SVD, private::Bool=false) = begin + fldnames = fieldnames(typeof(F)) + private ? (:V, fldnames...) : fldnames +end """ svdvals!(A) From 70828395b2187770189e838f2c9e2d61daa2e71c Mon Sep 17 00:00:00 2001 From: Arhik Date: Fri, 19 Jul 2024 09:28:17 +0530 Subject: [PATCH 2/2] update tests for svd propertynames --- stdlib/LinearAlgebra/test/svd.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/LinearAlgebra/test/svd.jl b/stdlib/LinearAlgebra/test/svd.jl index 9e8b5d5cda7d2..7f942d6269414 100644 --- a/stdlib/LinearAlgebra/test/svd.jl +++ b/stdlib/LinearAlgebra/test/svd.jl @@ -78,7 +78,8 @@ aimg = randn(n,n)/2 @test_throws FieldError usv.Z b = rand(eltya,n) @test usv\b ≈ a\b - @test Base.propertynames(usv) == (:U, :S, :V, :Vt) + @test Base.propertynames(usv) == (:U, :S, :Vt) + @test Base.propertynames(usv, true) == (:V, :U, :S, :Vt) @test size(usv) == size(a) if eltya <: BlasFloat svdz = svd!(Matrix{eltya}(undef,0,0))