Skip to content

resizedata! for structured matrices #369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions ext/LazyArraysBandedMatricesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@
olddata = B.data
ν,μ = B.datasize
n,m = max(ν,n), max(μ,m)
resizedata!(B.array, n,m) # B.array might be cached too

Check warning on line 479 in ext/LazyArraysBandedMatricesExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/LazyArraysBandedMatricesExt.jl#L479

Added line #L479 was not covered by tests

if (ν,μ) ≠ (n,m)
l,u = bandwidths(B.array)
Expand Down
15 changes: 14 additions & 1 deletion src/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,25 @@

resizedata!(B::CachedArray, mn...) = resizedata!(MemoryLayout(B.data), MemoryLayout(B.array), B, mn...)
resizedata!(B::AbstractCachedArray, mn...) = resizedata!(MemoryLayout(B.data), UnknownLayout(), B, mn...)
resizedata!(B::SymTridiagonal, m, n) = error("hi $m $n")

Check warning on line 223 in src/cache.jl

View check run for this annotation

Codecov / codecov/patch

src/cache.jl#L223

Added line #L223 was not covered by tests
resizedata!(A, mn...) = A # don't do anything
function resizedata!(A::AdjOrTrans, m, n)
m ≤ 0 || resizedata!(parent(A), n)
resizedata!(parent(A), n, m)

Check warning on line 226 in src/cache.jl

View check run for this annotation

Codecov / codecov/patch

src/cache.jl#L226

Added line #L226 was not covered by tests
A
end

function resizedata!(A::UpperOrLowerTriangular, m, n)
resizedata!(parent(A), m, n)
A

Check warning on line 232 in src/cache.jl

View check run for this annotation

Codecov / codecov/patch

src/cache.jl#L230-L232

Added lines #L230 - L232 were not covered by tests
end

function resizedata!(B::BroadcastVector, n)
for a in B.args
resizedata!(a, n)
end
B

Check warning on line 239 in src/cache.jl

View check run for this annotation

Codecov / codecov/patch

src/cache.jl#L235-L239

Added lines #L235 - L239 were not covered by tests
end

function cache_filldata!(B, inds...)
B.data[inds...] .= view(B.array,inds...)
end
Expand Down
1 change: 1 addition & 0 deletions src/lazybroadcasting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
BroadcastStyle(::Type{<:SubArray{<:Any,1,<:LazyMatrix,<:Tuple{Slice,Any}}}) = LazyArrayStyle{1}()

BroadcastStyle(::Type{<:UpperOrLowerTriangular{<:Any,<:LazyMatrix}}) = LazyArrayStyle{2}()
BroadcastStyle(::Type{<:UpperOrLowerTriangular{<:Any,<:AdjOrTrans{<:Any,<:LazyMatrix}}}) = LazyArrayStyle{2}()

Check warning on line 142 in src/lazybroadcasting.jl

View check run for this annotation

Codecov / codecov/patch

src/lazybroadcasting.jl#L142

Added line #L142 was not covered by tests
BroadcastStyle(::Type{<:LinearAlgebra.HermOrSym{<:Any,<:LazyMatrix}}) = LazyArrayStyle{2}()


Expand Down
Loading