Skip to content

Commit 045b12e

Browse files
authored
BlockArrays v1.0 and LazyArrays v2.0 (#186)
* Support LazyArrays v2.0 * Update test_odes.jl * Update test_normalized.jl * Fix padded * tests pass * Julia v1.10 * Update ci.yml * Update documentation.yml
1 parent c9d5aed commit 045b12e

13 files changed

+53
-52
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
version:
23-
- '1.9'
24-
- '1'
23+
- '1.10'
2524
os:
2625
- ubuntu-latest
2726
- macOS-latest
@@ -49,4 +48,5 @@ jobs:
4948
- uses: julia-actions/julia-processcoverage@v1
5049
- uses: codecov/codecov-action@v4
5150
with:
52-
file: lcov.info
51+
token: ${{ secrets.CODECOV_TOKEN }}
52+
file: lcov.info

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
- uses: actions/checkout@v4
1717
- uses: julia-actions/setup-julia@v1
1818
with:
19-
version: '1.9'
19+
version: '1.10'
2020
- name: Install dependencies
21-
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
21+
run: julia --project=docs/ -e 'using Pkg; Pkg.update(); Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
2222
- name: Build and deploy
2323
env:
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token

Project.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2626

2727
[compat]
2828
ArrayLayouts = "1.3.1"
29-
BandedMatrices = "0.17.17, 1"
30-
BlockArrays = "0.16.9"
31-
BlockBandedMatrices = "0.12"
32-
ContinuumArrays = "0.17.3"
29+
BandedMatrices = "1"
30+
BlockArrays = "1"
31+
BlockBandedMatrices = "0.13"
32+
ContinuumArrays = "0.18"
3333
DomainSets = "0.6, 0.7"
3434
FFTW = "1.1"
35-
FastGaussQuadrature = "0.5, 1"
35+
FastGaussQuadrature = "1"
3636
FastTransforms = "0.15.15, 0.16"
3737
FillArrays = "1"
3838
HypergeometricFunctions = "0.3.4"
39-
InfiniteArrays = "0.12.11, 0.13"
40-
InfiniteLinearAlgebra = "0.6.16, 0.7"
39+
InfiniteArrays = " 0.14"
40+
InfiniteLinearAlgebra = "0.8"
4141
IntervalSets = "0.7"
42-
LazyArrays = "1.0.1"
43-
LazyBandedMatrices = "0.8.5, 0.9"
42+
LazyArrays = "2"
43+
LazyBandedMatrices = "0.10"
4444
QuasiArrays = "0.11"
4545
SpecialFunctions = "1.0, 2"
46-
julia = "1.9"
46+
julia = "1.10"
4747

4848
[extras]
4949
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Base: @_inline_meta, axes, getindex, unsafe_getindex, convert, prod, *, /
1414
findall, searchsortedfirst, diff
1515
import Base.Broadcast: materialize, BroadcastStyle, broadcasted, Broadcasted
1616
import LazyArrays: MemoryLayout, Applied, ApplyStyle, flatten, _flatten, adjointlayout,
17-
sub_materialize, arguments, sub_paddeddata, paddeddata, PaddedLayout, resizedata!, LazyVector, ApplyLayout, call,
17+
sub_materialize, arguments, sub_paddeddata, paddeddata, AbstractPaddedLayout, PaddedColumns, resizedata!, LazyVector, ApplyLayout, call,
1818
_mul_arguments, CachedVector, CachedMatrix, LazyVector, LazyMatrix, axpy!, AbstractLazyLayout, BroadcastLayout,
1919
AbstractCachedVector, AbstractCachedMatrix, paddeddata, cache_filldata!,
2020
simplifiable, PaddedArray, converteltype, simplify

src/adaptivetransform.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ padchop!(cfs, tol, ax...) = pad(chop!(cfs, tol), ax...)
88
padchop(cfs, tol, ax...) = pad(chop(cfs, tol), ax...)
99

1010
# ax will impose block structure for us
11-
padchop!(cfs::PseudoBlockVector, tol, ax...) = padchop!(cfs.blocks, tol, ax...)
11+
padchop!(cfs::BlockedVector, tol, ax...) = padchop!(cfs.blocks, tol, ax...)
1212

1313

1414
padresize!(cfs, m, ax...) = pad(compatible_resize!(cfs, m), ax...)
15-
padresize!(cfs::PseudoBlockVector, m, ax...) = padresize!(cfs.blocks, m, ax...)
15+
padresize!(cfs::BlockedVector, m, ax...) = padresize!(cfs.blocks, m, ax...)
1616

1717

1818
increasingtruncations(::OneToInf) = oneto.(2 .^ (4:∞))
19-
increasingtruncations(::BlockedUnitRange) = broadcast(n -> Block.(oneto(n)), (2 .^ (4:∞)))
19+
increasingtruncations(::BlockedOneTo) = broadcast(n -> Block.(oneto(n)), (2 .^ (4:∞)))
2020

2121

2222
function adaptivetransform_ldiv(A::AbstractQuasiArray{U}, f::AbstractQuasiVector{V}) where {U,V}

src/classical/fourier.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Laurent() = Laurent{ComplexF64}()
99
==(::Fourier, ::Fourier) = true
1010
==(::Laurent, ::Laurent) = true
1111

12-
axes(F::AbstractFourier) = (Inclusion(ℝ), _BlockedUnitRange(1:2:∞))
12+
axes(F::AbstractFourier) = (Inclusion(ℝ), BlockedOneTo(1:2:∞))
1313

1414
function getindex(F::Fourier{T}, x::Real, j::Int)::T where T
1515
isodd(j) && return cos((j÷2)*x)
@@ -139,7 +139,7 @@ import BlockBandedMatrices: _BlockSkylineMatrix
139139

140140
@simplify function *(A::QuasiAdjoint{<:Any,<:Fourier}, B::Fourier)
141141
TV = promote_type(eltype(A),eltype(B))
142-
PseudoBlockArray(Diagonal(Vcat(2convert(TV,π),Fill(convert(TV,π),∞))), (axes(A,1),axes(B,2)))
142+
BlockedArray(Diagonal(Vcat(2convert(TV,π),Fill(convert(TV,π),∞))), (axes(A,1),axes(B,2)))
143143
end
144144

145145
@simplify function *(A::QuasiAdjoint{<:Any,<:Laurent}, B::Laurent)
@@ -153,7 +153,7 @@ function diff(F::Fourier{T}; dims=1) where T
153153
end
154154

155155
function diff(F::Laurent{T}; dims=1) where T
156-
D = Diagonal(PseudoBlockVector((((one(real(T)):∞) 2) .* (1 .- 2 .* iseven.(1:∞))) * convert(T,im), (axes(F,2),)))
156+
D = Diagonal(BlockedVector((((one(real(T)):∞) 2) .* (1 .- 2 .* iseven.(1:∞))) * convert(T,im), (axes(F,2),)))
157157
F * D
158158
end
159159

src/clenshaw.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,22 @@ end
100100
# Clenshaw
101101
###
102102

103-
function unsafe_getindex(f::Mul{<:AbstractOPLayout,<:PaddedLayout}, x::Number)
103+
function unsafe_getindex(f::Mul{<:AbstractOPLayout,<:AbstractPaddedLayout}, x::Number)
104104
P,c = f.A,f.B
105105
_p0(P)*clenshaw(paddeddata(c), recurrencecoefficients(P)..., x)
106106
end
107107

108-
function unsafe_getindex(f::Mul{<:AbstractOPLayout,<:PaddedLayout}, x::Number, jr)
108+
function unsafe_getindex(f::Mul{<:AbstractOPLayout,<:AbstractPaddedLayout}, x::Number, jr)
109109
P,c = f.A,f.B
110110
_p0(P)*clenshaw(view(paddeddata(c),:,jr), recurrencecoefficients(P)..., x)
111111
end
112112

113-
Base.@propagate_inbounds function getindex(f::Mul{<:AbstractOPLayout,<:PaddedLayout}, x::Number, j...)
113+
Base.@propagate_inbounds function getindex(f::Mul{<:AbstractOPLayout,<:AbstractPaddedLayout}, x::Number, j...)
114114
@inbounds checkbounds(ApplyQuasiArray(*,f.A,f.B), x, j...)
115115
unsafe_getindex(f, x, j...)
116116
end
117117

118-
Base.@propagate_inbounds getindex(f::Mul{<:WeightedOPLayout,<:PaddedLayout}, x::Number, j...) =
118+
Base.@propagate_inbounds getindex(f::Mul{<:WeightedOPLayout,<:AbstractPaddedLayout}, x::Number, j...) =
119119
weight(f.A)[x] * (unweighted(f.A) * f.B)[x, j...]
120120

121121
###
@@ -324,7 +324,7 @@ transposelayout(M::ClenshawLayout) = LazyBandedMatrices.LazyBandedLayout()
324324
Base.permutedims(M::Clenshaw{<:Number}) = transpose(M)
325325

326326

327-
function materialize!(M::MatMulVecAdd{<:ClenshawLayout,<:PaddedLayout,<:PaddedLayout})
327+
function materialize!(M::MatMulVecAdd{<:ClenshawLayout,<:AbstractPaddedLayout,<:AbstractPaddedLayout})
328328
α,A,x,β,y = M.α,M.A,M.B,M.β,M.C
329329
length(y) == size(A,1) || throw(DimensionMismatch("Dimensions must match"))
330330
length(x) == size(A,2) || throw(DimensionMismatch("Dimensions must match"))

src/interlace.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ axes(A::SetindexInterlace) = (union(axes.(A.args,1)...), LazyBandedMatrices._blo
154154

155155
ArrayLayouts.zeroeltype(M::Mul{<:Any,<:Any,<:SetindexInterlace}) = convert(eltype(M),M.A.z)
156156

157-
function getindex(f::Mul{BasisLayout,<:PaddedLayout,<:SetindexInterlace{<:Any,<:AbstractFill}}, x::Number)
157+
function getindex(f::Mul{BasisLayout,<:AbstractPaddedLayout,<:SetindexInterlace{<:Any,<:AbstractFill}}, x::Number)
158158
P = getindex_value(f.A.args)
159159
d = length(f.A.args)
160160
X = reshape(paddeddata(f.B),d,:)

src/lanczos.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ Base.BroadcastStyle(::Type{<:LanczosConversion}) = LazyArrays.LazyArrayStyle{2}(
9191

9292
struct LanczosConversionLayout <: AbstractLazyLayout end
9393

94-
LazyArrays.simplifiable(::Mul{LanczosConversionLayout,<:PaddedLayout}) = Val(true)
95-
function copy(M::Mul{LanczosConversionLayout,<:PaddedLayout})
94+
LazyArrays.simplifiable(::Mul{LanczosConversionLayout,<:AbstractPaddedLayout}) = Val(true)
95+
function copy(M::Mul{LanczosConversionLayout,<:AbstractPaddedLayout})
9696
resizedata!(M.A.data, maximum(colsupport(M.B)))
9797
M.A.data.R * M.B
9898
end
9999

100-
function copy(M::Ldiv{LanczosConversionLayout,<:PaddedLayout})
100+
function copy(M::Ldiv{LanczosConversionLayout,<:AbstractPaddedLayout})
101101
resizedata!(M.A.data, maximum(colsupport(M.B)))
102102
M.A.data.R \ M.B
103103
end
@@ -110,7 +110,7 @@ end
110110
MemoryLayout(::Type{<:LanczosConversion}) = LanczosConversionLayout()
111111
triangulardata(R::LanczosConversion) = R
112112
sublayout(::LanczosConversionLayout, ::Type{<:Tuple{KR,Integer}}) where KR =
113-
sublayout(PaddedLayout{UnknownLayout}(), Tuple{KR})
113+
sublayout(PaddedColumns{UnknownLayout}(), Tuple{KR})
114114

115115
function sub_paddeddata(::LanczosConversionLayout, S::SubArray{<:Any,1,<:AbstractMatrix,<:Tuple{Any,Integer}})
116116
P = parent(S)

test/test_fourier.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ import QuasiArrays: MulQuasiArray
4343

4444
@test F == F
4545

46-
@test axes(F,2) isa BlockedUnitRange{InfiniteArrays.InfStepRange{Int,Int}}
47-
@test axes(F) isa Tuple{<:Inclusion,BlockedUnitRange{InfiniteArrays.InfStepRange{Int,Int}}}
46+
@test axes(F,2) isa BlockedOneTo{Int,InfiniteArrays.InfStepRange{Int,Int}}
47+
@test axes(F) isa Tuple{<:Inclusion,BlockedOneTo{Int,InfiniteArrays.InfStepRange{Int,Int}}}
4848
@test axes(F,2)[Block(2)] == 2:3
4949
@test F[0.1,1] == 1.0
5050
@test F[0.1,2] == sin(0.1)
5151
@test F[0.1,1:4] == [1,sin(0.1),cos(0.1),sin(2*0.1)]
5252
@test F[0.1,Block(4)] == [sin(3*0.1),cos(3*0.1)]
5353
@test F[0.1,Block.(1:3)] == [1,sin(0.1),cos(0.1),sin(2*0.1),cos(2*0.1)]
5454

55-
u = F * PseudoBlockVector([[1,2,3]; zeros(∞)], (axes(F,2),));
55+
u = F * BlockedVector([[1,2,3]; zeros(∞)], (axes(F,2),));
5656
@test u[0.1] == 1 + 2sin(0.1) + 3cos(0.1)
5757
end
5858

@@ -84,7 +84,7 @@ import QuasiArrays: MulQuasiArray
8484
@test (F\F)*isa BlockArray
8585
@test (F \ (D*F))[Block.(1:3),Block.(1:3)] == [0 0 0 0 0; 0 0.0 -1 0 0; 0 1 0 0 0; 0 0 0 0 -2; 0 0 0 2 0]
8686

87-
u = F * PseudoBlockVector([[1,2,3,4,5]; zeros(∞)], (axes(F,2),));
87+
u = F * BlockedVector([[1,2,3,4,5]; zeros(∞)], (axes(F,2),));
8888
@test blockisequal(axes(D̃,2),axes(u.args[2],1))
8989
@test (D*u)[0.1] 2cos(0.1) - 3sin(0.1) + 8cos(2*0.1) - 10sin(2*0.1)
9090
end
@@ -134,16 +134,16 @@ end
134134

135135
@test F == F
136136

137-
@test axes(F,2) isa BlockedUnitRange{InfiniteArrays.InfStepRange{Int,Int}}
138-
@test axes(F) isa Tuple{<:Inclusion,BlockedUnitRange{InfiniteArrays.InfStepRange{Int,Int}}}
137+
@test axes(F,2) isa BlockedOneTo{Int,InfiniteArrays.InfStepRange{Int,Int}}
138+
@test axes(F) isa Tuple{<:Inclusion,BlockedOneTo{Int,InfiniteArrays.InfStepRange{Int,Int}}}
139139
@test axes(F,2)[Block(2)] == 2:3
140140
@test F[0.1,1] complex(1.0)
141141
@test F[0.1,2] == exp(-im*0.1)
142142
@test F[0.1,1:4] == [1,exp(-im*0.1),exp(im*0.1),exp(-2im*0.1)]
143143
@test F[0.1,Block(4)] == [exp(-im*3*0.1),exp(im*3*0.1)]
144144
@test F[0.1,Block.(1:3)] == [1,exp(-im*0.1),exp(im*0.1),exp(-2im*0.1),exp(2im*0.1)]
145145

146-
u = F * PseudoBlockVector([[1,2,3]; zeros(∞)], (axes(F,2),));
146+
u = F * BlockedVector([[1,2,3]; zeros(∞)], (axes(F,2),));
147147
@test u[0.1] == 1 + 2exp(-im*0.1) + 3exp(im*0.1)
148148
end
149149

@@ -175,7 +175,7 @@ end
175175
@test (F\F)*isa Diagonal
176176
@test (F \ (D*F))[Block.(1:3),Block.(1:3)] == Diagonal([0,-im,im,-2im,2im])
177177

178-
u = F * PseudoBlockVector([[1,2,3,4,5]; zeros(∞)], (axes(F,2),));
178+
u = F * BlockedVector([[1,2,3,4,5]; zeros(∞)], (axes(F,2),));
179179
@test blockisequal(axes(D̃,2),axes(u.args[2],1))
180180
@test (D*u)[0.1] -2im*exp(-im*0.1) + 3im*exp(im*0.1) - 8im*exp(-im*2*0.1) + 10im*exp(im*2*0.1)
181181
end

test/test_lanczos.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using ClassicalOrthogonalPolynomials, BandedMatrices, ArrayLayouts, QuasiArrays, ContinuumArrays, InfiniteArrays, Test
2-
import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout, orthogonalityweight, golubwelsch, LanczosData
2+
import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedColumns, orthogonalityweight, golubwelsch, LanczosData
33

44
@testset "Lanczos" begin
55
@testset "Legendre" begin
@@ -47,7 +47,7 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout, ort
4747

4848
Q = LanczosPolynomial(exp.(x))
4949
R = P \ Q
50-
@test MemoryLayout(R[:,2]) isa PaddedLayout
50+
@test MemoryLayout(R[:,2]) isa PaddedColumns
5151

5252
A,B,C = recurrencecoefficients(Q)
5353
@test A[1] 1.903680130866564 # emperical from Mathematica
@@ -63,24 +63,24 @@ import ClassicalOrthogonalPolynomials: recurrencecoefficients, PaddedLayout, ort
6363

6464
Q = LanczosPolynomial( 1 ./ (2 .+ x));
6565
R = P \ Q
66-
@test norm(R[1,3:10])  1E-14
66+
@test norm(R[1,3:10]) 1E-14
6767

6868
Q = LanczosPolynomial( 1 ./ (2 .+ x).^2);
6969
R = P \ Q
70-
@test norm(R[1,4:10])  2E-14
70+
@test norm(R[1,4:10]) 2E-14
7171

7272
# polys
7373
Q = LanczosPolynomial( 2 .+ x);
7474
R = P \ Q;
75-
@test norm(inv(R)[1,3:10])  1E-14
75+
@test norm(inv(R)[1,3:10]) 1E-14
7676

7777
w = P * (P \ (1 .+ x))
7878
Q = LanczosPolynomial(w)
7979
@test Q[0.1,5] Normalized(Jacobi(0,1))[0.1,5] 0.742799258138176
8080

8181
Q = LanczosPolynomial( 1 .+ x.^2);
8282
R = P \ Q;
83-
@test norm(inv(R)[1,4:10])  1E-14
83+
@test norm(inv(R)[1,4:10]) 1E-14
8484
end
8585

8686
@testset "Expansion" begin

test/test_normalized.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ClassicalOrthogonalPolynomials, FillArrays, BandedMatrices, ContinuumArrays, ArrayLayouts, LazyArrays, Base64, LinearAlgebra, QuasiArrays, Test
22
import ClassicalOrthogonalPolynomials: NormalizedOPLayout, recurrencecoefficients, Normalized, Clenshaw, weighted, grid, plotgrid
3-
import LazyArrays: CachedVector, PaddedLayout
3+
import LazyArrays: CachedVector, PaddedColumns
44
import ContinuumArrays: MappedWeightedBasisLayout
55

66
@testset "Normalized" begin
@@ -37,7 +37,7 @@ import ContinuumArrays: MappedWeightedBasisLayout
3737
f = Q*[1:5; zeros(∞)]
3838
@test f[0.1] Q[0.1,1:5]'*(1:5) f[[0.1]][1]
3939
x = axes(f,1)
40-
@test MemoryLayout(Q \ (1 .- x.^2)) isa PaddedLayout
40+
@test MemoryLayout(Q \ (1 .- x.^2)) isa PaddedColumns
4141
w = Q * (Q \ (1 .- x.^2));
4242
@test w[0.1] (1-0.1^2) w[[0.1]][1]
4343
end
@@ -212,7 +212,7 @@ import ContinuumArrays: MappedWeightedBasisLayout
212212
n = 10
213213
Pn = Diagonal([Ones(n); Zeros(∞)])
214214
@test (X*Pn - Pn*X)[1:n,1:n] zeros(n,n)
215-
@test MemoryLayout(Pn * Q[y,:]) isa PaddedLayout
215+
@test MemoryLayout(Pn * Q[y,:]) isa PaddedColumns
216216

217217
# @test (x-y) * Q[x,1:n]'*Q[y,1:n] ≈ (x-y) * Q[x,:]'*Pn*Q[y,:] ≈ (x-y) * Q[x,:]'*Pn*Q[y,:]
218218
# Q[x,:]' * ((X*Pn - Pn*X)* Q[y,:])

test/test_odes.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ClassicalOrthogonalPolynomials: oneto
88
import ContinuumArrays: MappedBasisLayout, MappedWeightedBasisLayout, weaklaplacian
99
import LazyArrays: arguments, ApplyMatrix, colsupport, MemoryLayout
1010
import SemiseparableMatrices: VcatAlmostBandedLayout
11+
import BandedMatrices: isbanded
1112

1213
@testset "ODEs" begin
1314
@testset "p-FEM" begin
@@ -219,7 +220,7 @@ import SemiseparableMatrices: VcatAlmostBandedLayout
219220
u = Q * c
220221
@test u[0.1] -0.5922177802211208
221222

222-
Δ = -((D*Q)'*(D*Q))
223+
Δ = -((D*Q)'*(D*Q));
223224
@test bandwidths(Δ) == (0,0)
224225
c = Δ \ (Q'*exp.(x))
225226
u = Q * c
@@ -228,7 +229,7 @@ import SemiseparableMatrices: VcatAlmostBandedLayout
228229

229230
@testset "natural" begin
230231
Q = [one(x) x W]
231-
Δ = -((D*Q)'*(D*Q))
232+
Δ = -((D*Q)'*(D*Q));
232233
M = Q'Q
233234
@test isbanded(Δ)
234235
@test isbanded(M)
@@ -241,7 +242,7 @@ import SemiseparableMatrices: VcatAlmostBandedLayout
241242

242243
@testset "one-sided" begin
243244
Q = [one(x)-x W]
244-
Δ = -((D*Q)'*(D*Q))
245+
Δ = -((D*Q)'*(D*Q));
245246
M = Q'Q;
246247
c =+ M) \ (Q'exp.(x))
247248
u = Q * c

0 commit comments

Comments
 (0)