From 34f7b329040e0583308dc8d151cc73092eb1a01d Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sun, 30 Mar 2025 12:18:13 +0530 Subject: [PATCH 1/3] Simplify bkcopy_oftype implementation --- src/bunchkaufman.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bunchkaufman.jl b/src/bunchkaufman.jl index a44f1a1c..4c2ea728 100644 --- a/src/bunchkaufman.jl +++ b/src/bunchkaufman.jl @@ -128,7 +128,7 @@ function bunchkaufman!(A::StridedMatrix{<:BlasFloat}, rook::Bool = false; check: end bkcopy_oftype(A, S) = eigencopy_oftype(A, S) -bkcopy_oftype(A::Symmetric{<:Complex}, S) = Symmetric(copytrito!(similar(parent(A), S, size(A)), A.data, A.uplo), sym_uplo(A.uplo)) +bkcopy_oftype(A::Symmetric{<:Complex}, S) = copyto!(similar(A, S), A) """ bunchkaufman(A, rook::Bool=false; check = true) -> S::BunchKaufman From 8a493c94c49400d090e5a3581980f0f879a00ecd Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sun, 30 Mar 2025 12:52:58 +0530 Subject: [PATCH 2/3] Add test --- test/bunchkaufman.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/bunchkaufman.jl b/test/bunchkaufman.jl index 68c519d1..6d9d4321 100644 --- a/test/bunchkaufman.jl +++ b/test/bunchkaufman.jl @@ -257,4 +257,10 @@ end @test B.U * B.D * B.U' ≈ S end +@testset "complex Symmetric" begin + S = Symmetric(rand(ComplexF64,4,4)) + B = bunchkaufman(S) + @test B.U * B.D * transpose(B.U) ≈ B.P * S * transpose(B.P) +end + end # module TestBunchKaufman From cad69ade1efefdbaa1977522e5ea4fc768a338cb Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sun, 30 Mar 2025 12:57:39 +0530 Subject: [PATCH 3/3] Use copymutable_oftype --- src/bunchkaufman.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bunchkaufman.jl b/src/bunchkaufman.jl index 4c2ea728..f7eb4d6f 100644 --- a/src/bunchkaufman.jl +++ b/src/bunchkaufman.jl @@ -128,7 +128,7 @@ function bunchkaufman!(A::StridedMatrix{<:BlasFloat}, rook::Bool = false; check: end bkcopy_oftype(A, S) = eigencopy_oftype(A, S) -bkcopy_oftype(A::Symmetric{<:Complex}, S) = copyto!(similar(A, S), A) +bkcopy_oftype(A::Symmetric{<:Complex}, S) = copymutable_oftype(A, S) """ bunchkaufman(A, rook::Bool=false; check = true) -> S::BunchKaufman