Skip to content
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
2 changes: 1 addition & 1 deletion src/MultivariateOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Base: axes, in, ==, +, -, /, *, ^, \, copy, copyto!, OneTo, getindex, siz
import Base.Broadcast: Broadcasted, broadcasted, DefaultArrayStyle
import DomainSets: boundary, EuclideanDomain

import QuasiArrays: LazyQuasiMatrix, LazyQuasiArrayStyle, domain, vec_layout, reshape_layout
import QuasiArrays: LazyQuasiMatrix, LazyQuasiArrayStyle, domain, vec_layout, reshape_layout, pointchoice
import ContinuumArrays: @simplify, Weight, weight, grid, plotgrid, TransformFactorization, ExpansionLayout, plotvalues, unweighted, plan_transform, checkpoints, transform_ldiv, AbstractBasisLayout, basis_axes, Inclusion, grammatrix, weaklaplacian, layout_broadcasted, laplacian, abslaplacian, laplacian_axis, abslaplacian_axis, diff_layout, operatororder, broadcastbasis, KronExpansionLayout

import ArrayLayouts: MemoryLayout, sublayout, sub_materialize
Expand Down
3 changes: 3 additions & 0 deletions src/disk.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ClassicalOrthogonalPolynomials.checkpoints(d::UnitDisk{T}) where T = [SVector{2,T}(0.1,0.2), SVector{2,T}(0.2,0.3)]
pointchoice(d::UnitDisk{T}) where T = SVector{2,T}(0,0)

"""
ZernikeWeight(a, b)
Expand Down Expand Up @@ -71,6 +72,8 @@ summary(io::IO, P::Zernike) = print(io, "Zernike($(P.a), $(P.b))")

orthogonalityweight(Z::Zernike) = ZernikeWeight(Z.a, Z.b)

basis_axes(::Inclusion{<:Any,<:UnitDisk}, v) = Zernike()

zerniker(ℓ, m, a, b, r::T) where T = sqrt(convert(T,2)^(m+a+b+2-iszero(m))/π) * r^m * normalizedjacobip((ℓ-m) ÷ 2, b, m+a, 2r^2-1)
zerniker(ℓ, m, b, r) = zerniker(ℓ, m, zero(b), b, r)
zerniker(ℓ, m, r) = zerniker(ℓ, m, zero(r), r)
Expand Down
4 changes: 0 additions & 4 deletions src/rect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ function *(A::TensorPlan, B::AbstractArray)
B
end

checkpoints(P::ProductDomain) = tensorgrid(map(checkpoints, components(P))...)
tensorgrid(x,y) = SVector.(x, y')


function plan_transform(P::KronPolynomial{d,<:Any,<:Fill}, (B,)::Tuple{Block{1}}, dims=1:1) where d
@assert only(dims) == 1

Expand Down
22 changes: 12 additions & 10 deletions test/test_disk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,18 @@ import ForwardDiff: hessian
g = MultivariateOrthogonalPolynomials.plotgrid(W[:,1:3])
@test all(rep[1].args .≈ (first.(g),last.(g),u[g]))
end

@testset "sum" begin
P = Zernike()
x,y = coordinates(P)
@test sum(expand(P, 𝐱 -> 1)) ≈ π
@test sum(expand(P, 𝐱 -> let (x,y) = 𝐱; exp(x*cos(y)) end)) ≈ sum(exp.(x.*cos.(y))) ≈ sum(exp.(x.*cos.(y)) for (x,y) in UnitDisk()) ≈ 3.4898933353782744
@test [sum(P[:,k] .* P[:,j]) for k=1:10, j=1:10] ≈ I
end

@testset "Show" begin
@test stringmime("text/plain", Zernike()) == "Zernike(0.0, 0.0)"
end
end

@testset "Fractional Laplacian on Unit Disk" begin
Expand Down Expand Up @@ -560,14 +572,4 @@ end
end
end
end

@testset "sum" begin
P = Zernike()
@test sum(expand(P, 𝐱 -> 1)) ≈ π
@test sum(expand(P, 𝐱 -> ((x,y) = 𝐱; exp(x*cos(y))))) ≈ 3.4898933353782744
end

@testset "Show" begin
@test stringmime("text/plain", Zernike()) == "Zernike(0.0, 0.0)"
end
end
Loading