Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions src/bunchkaufman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ BunchKaufman{T}(B::BunchKaufman) where {T} =
BunchKaufman(convert(Matrix{T}, B.LD), B.ipiv, B.uplo, B.symmetric, B.rook, B.info)
Factorization{T}(B::BunchKaufman) where {T} = BunchKaufman{T}(B)

AbstractMatrix(B::BunchKaufman) = B.uplo == 'U' ? B.P'B.U*B.D*B.U'B.P : B.P'B.L*B.D*B.L'B.P
AbstractArray(B::BunchKaufman) = AbstractMatrix(B)
Matrix(B::BunchKaufman) = Array(AbstractArray(B))
Array(B::BunchKaufman) = Matrix(B)


size(B::BunchKaufman) = size(getfield(B, :LD))
size(B::BunchKaufman, d::Integer) = size(getfield(B, :LD), d)
issymmetric(B::BunchKaufman) = B.symmetric
Expand Down
9 changes: 9 additions & 0 deletions test/bunchkaufman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,13 @@ end
@test B.U * B.D * B.U' ≈ S
end

@testset "BunchKaufman array constructors #1461" begin
a = randn(5,5)
A = a'a
for ul in (:U, :L)
B = bunchkaufman(Symmetric(A, ul))
@test A ≈ Array(B) ≈ Matrix(B) ≈ AbstractArray(B) ≈ AbstractMatrix(B)
end
end

end # module TestBunchKaufman