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
5 changes: 5 additions & 0 deletions src/adjtrans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,8 @@ diagview(A::Adjoint, k::Integer = 0) = _vecadjoint(diagview(parent(A), -k))
# triu and tril
triu!(A::AdjOrTransAbsMat, k::Integer = 0) = wrapperop(A)(tril!(parent(A), -k))
tril!(A::AdjOrTransAbsMat, k::Integer = 0) = wrapperop(A)(triu!(parent(A), -k))

function fillstored!(A::AdjOrTransAbsMat, v)
fillstored!(parent(A), wrapperop(A)(v))
return A
end
6 changes: 6 additions & 0 deletions src/bunchkaufman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,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) = convert(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
4 changes: 2 additions & 2 deletions src/cholesky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ Factorization{T}(C::CholeskyPivoted) where {T} = CholeskyPivoted{T}(C)

AbstractMatrix(C::Cholesky) = C.uplo == 'U' ? C.U'C.U : C.L*C.L'
AbstractArray(C::Cholesky) = AbstractMatrix(C)
Matrix(C::Cholesky) = Array(AbstractArray(C))
Matrix(C::Cholesky) = convert(Array, AbstractArray(C))
Array(C::Cholesky) = Matrix(C)

function AbstractMatrix(F::CholeskyPivoted)
Expand All @@ -655,7 +655,7 @@ function AbstractMatrix(F::CholeskyPivoted)
U'U
end
AbstractArray(F::CholeskyPivoted) = AbstractMatrix(F)
Matrix(F::CholeskyPivoted) = Array(AbstractArray(F))
Matrix(F::CholeskyPivoted) = convert(Array, AbstractArray(F))
Array(F::CholeskyPivoted) = Matrix(F)

copy(C::Cholesky) = Cholesky(copy(C.factors), C.uplo, C.info)
Expand Down
2 changes: 2 additions & 0 deletions src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ function fillband!(A::AbstractMatrix{T}, x, l, u) where T
return A
end

fillstored!(A::AbstractMatrix, v) = fill!(A, v)

diagind(m::Integer, n::Integer, k::Integer=0) = diagind(IndexLinear(), m, n, k)
diagind(::IndexLinear, m::Integer, n::Integer, k::Integer=0) =
k <= 0 ? range(1-k, step=m+1, length=min(m+k, n)) : range(k*m+1, step=m+1, length=min(m, n-k))
Expand Down
11 changes: 11 additions & 0 deletions test/adjtrans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -771,4 +771,15 @@ end
end
end

@testset "fillstored!" begin
A = rand(ComplexF64, 4, 4)
U = UpperTriangular(A)
@testset for (op, f) in ((Adjoint, adjoint), (Transpose, transpose))
@test LinearAlgebra.fillstored!(op(A), 1) == op(fill(1, size(A)))
@test LinearAlgebra.fillstored!(op(A), 2im) == op(fill(f(2im), size(A)))
@test LinearAlgebra.fillstored!(op(U), 1) == op(triu(fill(1, size(U))))
@test LinearAlgebra.fillstored!(op(U), 2im) == op(triu(fill(f(2im), size(U))))
end
end

end # module TestAdjointTranspose
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