Skip to content

Support LazyArrays v2.0 and BlockArrays v1.0 #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 22, 2024
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1'
- '1.10'
os:
- ubuntu-latest
- macOS-latest
Expand Down
23 changes: 12 additions & 11 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "MultivariateOrthogonalPolynomials"
uuid = "4f6956fd-4f93-5457-9149-7bfc4b2ce06d"
version = "0.6.4"
version = "0.7"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand All @@ -19,29 +19,30 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
SemiseparableMatrices = "f8ebbe35-cbfb-4060-bf7f-b10e4670cf57"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
ArrayLayouts = "1.0.9"
BandedMatrices = "1"
BlockArrays = "0.16.14"
BlockBandedMatrices = "0.12.5"
ClassicalOrthogonalPolynomials = "0.12"
ContinuumArrays = "0.17"
BlockArrays = "1.0"
BlockBandedMatrices = "0.13"
ClassicalOrthogonalPolynomials = "0.13"
ContinuumArrays = "0.18"
DomainSets = "0.6, 0.7"
FastTransforms = "0.15.11, 0.16"
FillArrays = "1.0"
HarmonicOrthogonalPolynomials = "0.5"
InfiniteArrays = "0.13"
InfiniteLinearAlgebra = "0.7"
LazyArrays = "1.0"
LazyBandedMatrices = "0.9"
HarmonicOrthogonalPolynomials = "0.6"
InfiniteArrays = "0.14"
InfiniteLinearAlgebra = "0.8"
LazyArrays = "2.0"
LazyBandedMatrices = "0.10"
QuasiArrays = "0.11"
SpecialFunctions = "1, 2"
StaticArrays = "1"
julia = "1.9"
julia = "1.10"

[extras]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
2 changes: 1 addition & 1 deletion examples/triangleexamples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ u_3 = F \ pad(coefficients(Fun((x,y) -> x*y*(1-x-y), rangespace(L))), size(M,1))
u_4 = F \ pad(coefficients(Fun((x,y) -> exp(-25((x-0.2)^2+(y-0.2)^2)), rangespace(L))), size(M,1))


bnrms = u -> [norm(PseudoBlockArray(u, 1:N)[Block(K)],Inf) for K=1:N]
bnrms = u -> [norm(BlockedArray(u, 1:N)[Block(K)],Inf) for K=1:N]

plot(bnrms(u_1); xscale=:log10, yscale=:log10, linewidth=3, label="1")
plot!(bnrms(u_2); xscale=:log10, yscale=:log10, linewidth=3, linestyle=:dot, label="x^2 + y^2")
Expand Down
2 changes: 1 addition & 1 deletion src/ModalInterlace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ convert(::Type{ModalTrav{T,M}}, v::ModalTrav) where {T,M} = ModalTrav{T,M}(conve

function convert(::Type{ModalTrav{T,M}}, v_in::AbstractVector) where {T,M}
N = (isqrt(8length(v_in)+1)-1) ÷ 2
v = PseudoBlockVector(v_in, OneTo(N))
v = BlockedVector(v_in, OneTo(N))
m = N ÷ 2 + 1
n = 4(m-1) + 1
mat = zeros(T, m, n)
Expand Down
2 changes: 1 addition & 1 deletion src/rect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ end
applylayout(::Type{typeof(*)}, ::Lay, ::DiagTravLayout) where Lay <: AbstractBasisLayout = ExpansionLayout{Lay}()
ContinuumArrays._mul_plotgrid(::Tuple{Any,DiagTravLayout{<:PaddedLayout}}, (P,c)::NTuple{2,Any}) = plotgrid(P, maximum(blockcolsupport(c)))

pad(C::DiagTrav, ::BlockedUnitRange{RangeCumsum{Int,OneToInf{Int}}}) = DiagTrav(pad(C.array, ∞, ∞))
pad(C::DiagTrav, ::BlockedOneTo{Int,RangeCumsum{Int,OneToInf{Int}}}) = DiagTrav(pad(C.array, ∞, ∞))

QuasiArrays.mul(A::BivariateOrthogonalPolynomial, b::DiagTrav) = ApplyQuasiArray(*, A, b)

Expand Down
2 changes: 1 addition & 1 deletion src/triangle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ end
# The functionality will need to be added to LazyBandedMatrices.jl
function tri_forwardrecurrence(N::Int, X, Y, x, y)
T = promote_type(eltype(X),eltype(Y))
ret = PseudoBlockVector{T}(undef, 1:N)
ret = BlockedVector{T}(undef, 1:N)
N < 1 && return ret
ret[1] = 1
N < 2 && return ret
Expand Down
4 changes: 2 additions & 2 deletions test/test_cone.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import MultivariateOrthogonalPolynomials: rectspace, totensor, duffy2legendrecon
A = [1 2 3 5 6;
4 7 8 0 0;
9 0 0 0 0]
B = PseudoBlockArray(A, Ones{Int}(3), [1; Fill(2,2)])
B = BlockedArray(A, Ones{Int}(3), [1; Fill(2,2)])

a = Vector{eltype(A)}()
for N = 1:blocksize(B,2), K=1:N
Expand All @@ -22,7 +22,7 @@ import MultivariateOrthogonalPolynomials: rectspace, totensor, duffy2legendrecon
N = isqrt(length(a))
M = 2N-1
à = zeros(eltype(a), N, M)
B = PseudoBlockArray(Ã, Ones{Int}(3), [1; Fill(2,2)])
B = BlockedArray(Ã, Ones{Int}(3), [1; Fill(2,2)])
k = 1
for N = 1:blocksize(B,2), K=1:N
V = view(B, Block(K,N-K+1))
Expand Down
4 changes: 2 additions & 2 deletions test/test_disk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ForwardDiff: hessian
T = ZernikeTransform{Float64}(N, 0, 0)
Ti = ZernikeITransform{Float64}(N, 0, 0)

v = PseudoBlockArray(randn(sum(1:N)),1:N)
v = BlockedArray(randn(sum(1:N)),1:N)
@test T * (Ti * v) ≈ v


Expand Down Expand Up @@ -60,7 +60,7 @@ import ForwardDiff: hessian
@test_throws ArgumentError ModalTrav([1 2 3 4; 5 6 7 8])

for N = 1:10
v = PseudoBlockArray(1:sum(1:N),1:N)
v = BlockedArray(1:sum(1:N),1:N)
if iseven(N)
@test ModalTrav(v) == [v; zeros(N+1)]
else
Expand Down
4 changes: 2 additions & 2 deletions test/test_modalinterlace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MultivariateOrthogonalPolynomials: ModalInterlace, ModalInterlaceLayout,

@testset "modalTrav" begin
a = ModalTrav(randn(2,5))
b = PseudoBlockArray(a)
b = BlockedArray(a)
v = Vector(a)

@test zero(a) isa ModalTrav
Expand All @@ -12,7 +12,7 @@ import MultivariateOrthogonalPolynomials: ModalInterlace, ModalInterlaceLayout,
@test exp.(a) isa ModalTrav
@test 2a isa ModalTrav
@test a+a isa ModalTrav
@test a+b isa PseudoBlockArray
@test a+b isa BlockedArray
@test a+v isa BlockArray
@test a .+ exp.(a .+ 1) isa ModalTrav

Expand Down
14 changes: 7 additions & 7 deletions test/test_triangle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ import MultivariateOrthogonalPolynomials: tri_forwardrecurrence, grid, TriangleR
@testset "function" begin
P = JacobiTriangle()
𝐱 = SVector(0.1,0.2)
c = PseudoBlockVector([1; Zeros(∞)], (axes(P,2),))
c = BlockedVector([1; Zeros(∞)], (axes(P,2),))
f = P*c
@test MemoryLayout(f) isa ExpansionLayout
@test @inferred(f[𝐱]) == 1.0
c = PseudoBlockVector([1:3; Zeros(∞)], (axes(P,2),))
c = BlockedVector([1:3; Zeros(∞)], (axes(P,2),))
f = P*c
@test f[𝐱] ≈ P[𝐱,1:3]'*(1:3)
c = PseudoBlockVector([1:6; Zeros(∞)], (axes(P,2),))
c = BlockedVector([1:6; Zeros(∞)], (axes(P,2),))
f = P*c
@test f[𝐱] ≈ P[𝐱,1:6]'*(1:6)

c = PseudoBlockVector([randn(5050); Zeros(∞)], (axes(P,2),))
c = BlockedVector([randn(5050); Zeros(∞)], (axes(P,2),))
f = P*c
@test f[𝐱] ≈ P[𝐱,1:5050]'*c[1:5050]

c = PseudoBlockVector([1:10; zeros(∞)], (axes(P,2),))
c = BlockedVector([1:10; zeros(∞)], (axes(P,2),))
f = P*c
𝐱 = SVector(0.1,0.2)
@test f[𝐱] ≈ dot(P[𝐱,1:10],1:10)
Expand Down Expand Up @@ -98,7 +98,7 @@ import MultivariateOrthogonalPolynomials: tri_forwardrecurrence, grid, TriangleR

@testset "relation with transform" begin
P = JacobiTriangle()
c = PseudoBlockVector([1:10; zeros(∞)], (axes(P,2),))
c = BlockedVector([1:10; zeros(∞)], (axes(P,2),))
f = P*c
N = 5
P_N = P[:,Block.(Base.OneTo(N))]
Expand Down Expand Up @@ -375,7 +375,7 @@ import MultivariateOrthogonalPolynomials: tri_forwardrecurrence, grid, TriangleR
X = P \ (x .* P)
Y = P \ (y .* P)

P_ex = PseudoBlockVector{Float64}(undef, 1:5)
P_ex = BlockedVector{Float64}(undef, 1:5)
for n = 0:4, k=0:n
P_ex[Block(n+1)[k+1]] = p(n,k,1,0,0,0.1,0.2)
end
Expand Down
Loading