Skip to content

Support plots #36

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 6 commits into from
May 6, 2021
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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"

[compat]
ArrayLayouts = "0.6.2"
ArrayLayouts = "0.6.2, 0.7"
BandedMatrices = "0.16.5"
BlockArrays = "0.15"
BlockBandedMatrices = "0.10"
ContinuumArrays = "0.7.2"
ContinuumArrays = "0.7.3"
DomainSets = "0.4, 0.5"
FFTW = "1.1"
FastGaussQuadrature = "0.4.3"
Expand Down
11 changes: 4 additions & 7 deletions examples/ultrasphericalspectralmethod.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using ContinuumArrays, FillArrays, InfiniteArrays, Plots
using ClassicalOrthogonalPolynomials, Plots

T = Chebyshev()
C = Ultraspherical(2)
D = Derivative(axes(T,1))
A = (C\(D^2*T))+100(C\T)

n = 100
c = [T[[-1,1],1:n]; A[1:n-2,1:n]] \ [1;2;zeros(n-2)]
u = T*Vcat(c,Zeros(∞))

xx = range(-1,1;length=1000)
plot(xx,u[xx])
c = Vcat(T[[-1,1],:], A) \ [1;2;zeros(∞)]
u = T*c

plot(u)
2 changes: 1 addition & 1 deletion src/ClassicalOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import QuasiArrays: cardinality, checkindex, QuasiAdjoint, QuasiTranspose, Inclu

import InfiniteArrays: OneToInf, InfAxes, Infinity, AbstractInfUnitRange, InfiniteCardinal, InfRanges
import ContinuumArrays: Basis, Weight, basis, @simplify, Identity, AbstractAffineQuasiVector, ProjectionFactorization,
inbounds_getindex, grid, transform, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, Expansion,
inbounds_getindex, grid, plotgrid, transform, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, Expansion,
AffineQuasiVector, AffineMap, WeightLayout, WeightedBasisLayout, WeightedBasisLayouts, demap, AbstractBasisLayout, BasisLayout,
checkpoints, weight, unweightedbasis, MappedBasisLayouts, __sum
import FastTransforms: Λ, forwardrecurrence, forwardrecurrence!, _forwardrecurrence!, clenshaw, clenshaw!,
Expand Down
6 changes: 6 additions & 0 deletions src/classical/jacobi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ function grid(Pn::SubQuasiArray{T,2,<:AbstractJacobi,<:Tuple{Inclusion,AbstractU
ChebyshevGrid{1,T}(maximum(jr))
end

function plotgrid(Pn::SubQuasiArray{T,2,<:AbstractJacobi,<:Tuple{Inclusion,AbstractUnitRange}}) where T
kr,jr = parentindices(Pn)
ChebyshevGrid{2,T}(40maximum(jr))
end


function ldiv(::Legendre{V}, f::AbstractQuasiVector) where V
T = ChebyshevT{V}()
[cheb2leg(paddeddata(T \ f)); zeros(V,∞)]
Expand Down
4 changes: 4 additions & 0 deletions test/test_chebyshev.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
V = view(T,:,[1,3,4])
@test (U\(D*V))[1:5,:] == (U \ (V'D')')[1:5,:] == (U\(D*T))[1:5,[1,3,4]]
end

@testset "plot" begin
@test ContinuumArrays.plotgrid(ChebyshevT()[:,1:5]) == ChebyshevGrid{2}(200)
end
end

struct QuadraticMap{T} <: Map{T} end
Expand Down