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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LazyBandedMatrices"
uuid = "d7e5e226-e90b-4449-9968-0f923699bf6f"
authors = ["Sheehan Olver <[email protected]>"]
version = "0.11.5"
version = "0.11.6"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
1 change: 1 addition & 0 deletions src/LazyBandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import BlockArrays: BlockSlices, BlockSlice1, BlockSlice, blockvec, AbstractBloc
import FillArrays: SquareEye

const LazyArraysBlockBandedMatricesExt = Base.get_extension(LazyArrays, :LazyArraysBlockBandedMatricesExt)
const LazyArraysBlockArraysExt = Base.get_extension(LazyArrays, :LazyArraysBlockArraysExt)

const AbstractLazyBlockBandedLayout = LazyArraysBlockBandedMatricesExt.AbstractLazyBlockBandedLayout
const BroadcastBandedBlockBandedLayout = LazyArraysBlockBandedMatricesExt.BroadcastBandedBlockBandedLayout
Expand Down
42 changes: 23 additions & 19 deletions src/blockconcat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -492,25 +492,29 @@ resize!(c::BlockBroadcastVector{T,typeof(vcat)}, N::Block{1}) where T = BlockBro
# BlockVec
####

const BlockVec{T, M<:AbstractMatrix{T}} = ApplyVector{T, typeof(blockvec), <:Tuple{M}}

BlockVec{T}(M::AbstractMatrix{T}) where T = ApplyVector{T}(blockvec, M)
BlockVec(M::AbstractMatrix{T}) where T = BlockVec{T}(M)
axes(b::BlockVec) = (blockedrange(Fill(size(b.args[1])...)),)
size(b::BlockVec) = (length(b.args[1]),)

view(b::BlockVec, K::Block{1}) = view(b.args[1], :, Int(K))
Base.@propagate_inbounds getindex(b::BlockVec, k::Int) = b.args[1][k]
Base.@propagate_inbounds setindex!(b::BlockVec, v, k::Int) = setindex!(b.args[1], v, k)

_resize!(A::AbstractMatrix, m, n) = A[1:m, 1:n]
_resize!(At::Transpose, m, n) = transpose(transpose(At)[1:n, 1:m])
_resize!(Ac::Adjoint, m, n) = (Ac')[1:n, 1:m]'
resize!(b::BlockVec, K::Block{1}) = BlockVec(_resize!(b.args[1], size(b.args[1],1), Int(K)))

applylayout(::Type{typeof(blockvec)}, ::AbstractPaddedLayout) = PaddedColumns{ApplyLayout{typeof(blockvec)}}()
paddeddata(b::BlockVec) = BlockVec(paddeddata(b.args[1]))

# support LazyArrays v2.8 where BlockVec is moved
if isdefined(LazyBandedMatrices.LazyArraysBlockArraysExt, :BlockVec)
const BlockVec = LazyBandedMatrices.LazyArraysBlockArraysExt.BlockVec
else
const BlockVec{T, M<:AbstractMatrix{T}} = ApplyVector{T, typeof(blockvec), <:Tuple{M}}

BlockVec{T}(M::AbstractMatrix{T}) where T = ApplyVector{T}(blockvec, M)
BlockVec(M::AbstractMatrix{T}) where T = BlockVec{T}(M)
axes(b::BlockVec) = (blockedrange(Fill(size(b.args[1])...)),)
size(b::BlockVec) = (length(b.args[1]),)

view(b::BlockVec, K::Block{1}) = view(b.args[1], :, Int(K))
Base.@propagate_inbounds getindex(b::BlockVec, k::Int) = b.args[1][k]
Base.@propagate_inbounds setindex!(b::BlockVec, v, k::Int) = setindex!(b.args[1], v, k)

_resize!(A::AbstractMatrix, m, n) = A[1:m, 1:n]
_resize!(At::Transpose, m, n) = transpose(transpose(At)[1:n, 1:m])
_resize!(Ac::Adjoint, m, n) = (Ac')[1:n, 1:m]'
resize!(b::BlockVec, K::Block{1}) = BlockVec(_resize!(b.args[1], size(b.args[1],1), Int(K)))

applylayout(::Type{typeof(blockvec)}, ::AbstractPaddedLayout) = PaddedColumns{ApplyLayout{typeof(blockvec)}}()
paddeddata(b::BlockVec) = BlockVec(paddeddata(b.args[1]))
end


####
Expand Down
Loading