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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
deps/deps.jl
Manifest.toml
.DS_Store
.vscode/settings.json
4 changes: 2 additions & 2 deletions 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.7"
version = "0.11.8"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand All @@ -28,7 +28,7 @@ BlockArrays = "1.0"
BlockBandedMatrices = "0.13"
FillArrays = "1.0"
InfiniteArrays = "0.15"
LazyArrays = "2.8"
LazyArrays = "2.9.3"
MatrixFactorizations = "3.0"
StaticArrays = "1.0"
julia = "1.10"
Expand Down
5 changes: 3 additions & 2 deletions src/LazyBandedMatrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using BandedMatrices, BlockBandedMatrices, BlockArrays, LazyArrays, FillArrays,
import Base: -, +, *, /, \, ==, AbstractMatrix, Matrix, Array, size, conj, real, imag, copy, copymutable,
iszero, isone, one, zero, getindex, setindex!, copyto!, fill, fill!, promote_rule, show, print_matrix, permutedims,
OneTo, oneto, require_one_based_indexing, similar, convert, axes, tail, tuple_type_tail, view, resize!
import Base.Broadcast: Broadcasted, BroadcastStyle, broadcasted, instantiate
import Base.Broadcast: Broadcasted, BroadcastStyle, broadcasted, instantiate, result_style
import LinearAlgebra: transpose, adjoint, istriu, istril, isdiag, tril!, triu!, det, logabsdet,
symmetric, symmetric_type, diag, issymmetric, UniformScaling, char_uplo,
AbstractTriangular, AdjOrTrans, StructuredMatrixStyle, Diagonal
Expand All @@ -17,7 +17,8 @@ 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, applied_eltype
_cumsum, convexunion, applylayout, AbstractLazyBandedLayout, ApplyBandedLayout, BroadcastBandedLayout, LazyBandedLayout, applied_eltype,
CachedArrayStyle
import BandedMatrices: AbstractBandedMatrix, BandedStyle, bandwidths, isbanded
import BlockBandedMatrices: AbstractBlockBandedLayout, AbstractBandedBlockBandedLayout, BlockRange1, Block1, blockbandwidths, subblockbandwidths,
BlockBandedStyle, BandedBlockBandedStyle, isblockbanded, isbandedblockbanded
Expand Down
3 changes: 2 additions & 1 deletion src/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ similar(B::Bidiagonal, ::Type{T}) where {T} = Bidiagonal(similar(B.dv, T), simil
# The method below is moved to SparseArrays for now
# similar(B::Bidiagonal, ::Type{T}, dims::Union{Dims{1},Dims{2}}) where {T} = spzeros(T, dims...)


# Broadcasting
BroadcastStyle(::Type{<:Bidiagonal{<:Any, DV, EV}}) where {DV, EV} = result_style(BandedStyle(), result_style(BroadcastStyle(DV), BroadcastStyle(EV)))

####################
# Generic routines #
Expand Down
12 changes: 11 additions & 1 deletion test/test_bidiag.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module TestBidiag

# This file is based on a part of Julia LinearAlgebra/test/bidiag.jl. License is MIT: https://julialang.org/license
using Test, LazyBandedMatrices, SparseArrays, Random, FillArrays
using Test, LazyBandedMatrices, SparseArrays, Random, FillArrays, LazyArrays, BandedMatrices
import LazyBandedMatrices: Bidiagonal, SymTridiagonal, Tridiagonal
import LinearAlgebra
import LinearAlgebra: mul!, istril, istriu, diagm, isdiag, triu, tril, triu!, tril!, diag, UpperTriangular, LowerTriangular, UnitLowerTriangular, UnitUpperTriangular,
dot, Diagonal
import LazyArrays: CachedArrayStyle
import Base.Broadcast: BroadcastStyle
import BandedMatrices: BandedStyle

@testset "Bidiagonal" begin
n = 10 #Size of test matrix
Expand Down Expand Up @@ -488,6 +491,13 @@ import LinearAlgebra: mul!, istril, istriu, diagm, isdiag, triu, tril, triu!, tr
@test B.dv ≡ 1:5
@test B.ev ≡ Ones{Int}(4)
end

@testset "BroadcastStyle" begin
@test BroadcastStyle(typeof(Bidiagonal(1:3, 1:2, :U))) == BandedStyle()
@test BroadcastStyle(typeof(Bidiagonal(1:3, Accumulate(*, 1:2), :L))) == CachedArrayStyle{2}()
@test BroadcastStyle(typeof(Bidiagonal(Accumulate(*, 1:3), Accumulate(*, 1:2), :U))) == CachedArrayStyle{2}()
@test BroadcastStyle(typeof(Bidiagonal(Accumulate(*, 1:3), 1:2, :L))) == CachedArrayStyle{2}()
end
end # testset

end # module TestBidiagonal
Loading