Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ BlockArrays = "1.0"
BlockBandedMatrices = "0.13"
FillArrays = "1.0"
InfiniteArrays = "0.15"
LazyArrays = "2.2.3"
LazyArrays = "2.8"
MatrixFactorizations = "3.0"
StaticArrays = "1.0"
julia = "1.10"
Expand Down
5 changes: 4 additions & 1 deletion src/LazyBandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ import ArrayLayouts: MemoryLayout, bidiagonallayout, bidiagonaluplo, diagonaldat
materialize!, MulAdd, MatMulVecAdd
import LazyArrays: ApplyLayout, AbstractPaddedLayout, PaddedLayout, PaddedColumns, BroadcastLayout, LazyArrayStyle, LazyLayout,
arguments, call, tuple_type_memorylayouts, paddeddata, _broadcast_sub_arguments, resizedata!,
_cumsum, convexunion, applylayout, AbstractLazyBandedLayout, ApplyBandedLayout, BroadcastBandedLayout, LazyBandedLayout
_cumsum, convexunion, applylayout, AbstractLazyBandedLayout, ApplyBandedLayout, BroadcastBandedLayout, LazyBandedLayout, applied_eltype
import BandedMatrices: AbstractBandedMatrix, BandedStyle, bandwidths, isbanded
import BlockBandedMatrices: AbstractBlockBandedLayout, AbstractBandedBlockBandedLayout, BlockRange1, Block1, blockbandwidths, subblockbandwidths,
BlockBandedStyle, BandedBlockBandedStyle, isblockbanded, isbandedblockbanded
import BlockArrays: BlockSlices, BlockSlice1, BlockSlice, blockvec, AbstractBlockLayout, blockcolsupport, blockrowsupport, BlockLayout, block, blockindex, viewblock, AbstractBlockedUnitRange
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 All @@ -34,6 +35,8 @@ const AbstractLazyBandedBlockBandedLayout = LazyArraysBlockBandedMatricesExt.Abs
const ApplyBandedBlockBandedLayout = LazyArraysBlockBandedMatricesExt.ApplyBandedBlockBandedLayout
const LazyBlockBandedLayouts = LazyArraysBlockBandedMatricesExt.LazyBlockBandedLayouts

const BlockVec = LazyArraysBlockArraysExt.BlockVec


export DiagTrav, KronTrav, blockkron, BlockKron, BlockBroadcastArray, BlockVcat, BlockHcat, BlockHvcat, unitblocks

Expand Down
22 changes: 0 additions & 22 deletions src/blockconcat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,28 +488,6 @@ MemoryLayout(::Type{BlockBroadcastArray{T,N,FF,Args}}) where {T,N,FF,Args} = blo

resize!(c::BlockBroadcastVector{T,typeof(vcat)}, N::Block{1}) where T = BlockBroadcastVector{T}(vcat, resize!.(c.args, N)...)

####
# 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]))



Expand Down
31 changes: 0 additions & 31 deletions test/test_blockconcat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -421,35 +421,4 @@ end
end
end

@testset "BlockVec" begin
X = randn(5,4)
b = BlockVec(X)
@test size(b) == (20,)
@test length(b) == 20
@test MemoryLayout(b) isa ApplyLayout{typeof(blockvec)}
@test b == vec(X)
@test view(b, Block(3)) ≡ view(X, :, 3)
@test b[Block(3)] isa Vector
b[5] = 6
@test X[5] == 6
@test resize!(b, Block(2)) == b[Block.(1:2)]

c = BlockVec(X')
@test c == vec(X')
@test view(c, Block(3)) ≡ view(X', :, 3)
@test resize!(c, Block(2)) == c[Block.(1:2)]

c = BlockVec(transpose(X))
@test c == vec(transpose(X))
@test view(c, Block(3)) ≡ view(transpose(X), :, 3)
@test resize!(c, Block(2)) == c[Block.(1:2)]

X = cache(Zeros(5,6));
X[1,1] = 2
c = BlockVec(X);
@test MemoryLayout(c) isa PaddedColumns
@test paddeddata(c) isa BlockVec
@test paddeddata(c) == [2]
end

end # module
Loading