From 4ff3eeabe02bd93523908fa9f34eaad42524583e Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Sat, 30 Nov 2024 20:00:25 +0000 Subject: [PATCH] increase cov --- Project.toml | 2 +- src/InfiniteArrays.jl | 6 +++--- test/test_infbanded.jl | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index e2050fb..011b14e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InfiniteArrays" uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" -version = "0.15.0" +version = "0.15.0-dev" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/InfiniteArrays.jl b/src/InfiniteArrays.jl index a2a5cfe..5181e74 100644 --- a/src/InfiniteArrays.jl +++ b/src/InfiniteArrays.jl @@ -28,8 +28,8 @@ end using Base.Broadcast import ArrayLayouts: AbstractBandedLayout, LayoutMatrix, LayoutVecOrMat, LayoutVecOrMats, LayoutVector, MemoryLayout, - RangeCumsum, UnknownLayout, reshapedlayout, sub_materialize, sublayout, MatLdivVec, - subdiagonaldata, diagonaldata, supdiagonaldata + RangeCumsum, UnknownLayout, reshapedlayout, sub_materialize, materialize!, sublayout, MatLdivVec, + subdiagonaldata, diagonaldata, supdiagonaldata, triangularlayout import Base.Broadcast: BroadcastStyle, Broadcasted, DefaultArrayStyle, axistype, broadcasted @@ -39,7 +39,7 @@ import Infinities: InfiniteCardinal, Infinity, ∞ import LazyArrays: AbstractLazyLayout, AbstractCachedVector, ApplyLayout, CachedArray, CachedVector, InvColumnLayout, AbstractLazyBandedLayout, LazyArrayStyle, LazyLayout, LazyMatrix, PaddedColumns, _padded_sub_materialize, sub_paddeddata, - ApplyBandedLayout, BroadcastBandedLayout + ApplyBandedLayout, BroadcastBandedLayout, islazy_layout import LinearAlgebra: AdjOrTrans, HermOrSym, diag, norm, norm1, norm2, normp diff --git a/test/test_infbanded.jl b/test/test_infbanded.jl index 01e57c2..192d8ee 100644 --- a/test/test_infbanded.jl +++ b/test/test_infbanded.jl @@ -84,6 +84,11 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian S = SymTridiagonal(Fill(1,∞), Fill(2,∞)) @test (S + 2I)[1:10,1:10] == (2I + S)[1:10,1:10] == S[1:10,1:10] + 2I @test BandedMatrix(S, (2,3))[1:10,1:10] == S[1:10,1:10] + + B = Bidiagonal(Fill(1,∞), Fill(2,∞), :U) + @test (B*B)[1:10,1:10] == B[1:10,1:11] * B[1:11,1:10] + + @test (B \ [1:10; zeros(∞)])[1:10] == B[1:10,1:10] \ (1:10) end @testset "constant data" begin @@ -202,7 +207,7 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian @testset "SubArray broadcasting" begin A = BandedMatrix(2 => 1:∞) - @test exp.(A[1:2:∞,1:2:∞])[1:10,1:10] ≈ exp.(A[1:2:20,1:2:20]) + @test exp.(A[1:2:∞,1:2:∞])[1:10,1:10] ≈ exp.(A)[1:2:20,1:2:20] ≈ exp.(A[1:2:20,1:2:20]) @test A[band(2)][1:5] == 1:5 @test _BandedMatrix((1:∞)', ∞, -1,1)[band(1)][1:5] == 2:6 @test exp.(view(A,band(2)))[1:10] ≈ exp.(1:10) @@ -210,6 +215,9 @@ const InfBandCartesianIndices = InfiniteArraysBandedMatricesExt.InfBandCartesian @test BandedMatrices.banded_similar(Int, (∞,5), (1,1)) isa BandedMatrix @test BandedMatrices.banded_similar(Int, (5,∞), (1,1)) isa Adjoint{<:Any,<:BandedMatrix} + @test (A+A)[2:∞,3:∞] isa SubArray + @test (A*A)[2:∞,3:∞] isa SubArray + A = BandedMatrix{Int}((2 => 1:∞,), (∞,∞), (0,2)) @test eltype(A) == Int @test bandwidths(A) == (0,2)