Skip to content

Commit c19fc31

Browse files
authored
Support plots (#36)
* Support plots * Update ultrasphericalspectralmethod.jl * Update Project.toml * Update test_chebyshev.jl
1 parent c60cf51 commit c19fc31

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
2525
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2626

2727
[compat]
28-
ArrayLayouts = "0.6.2"
28+
ArrayLayouts = "0.6.2, 0.7"
2929
BandedMatrices = "0.16.5"
3030
BlockArrays = "0.15"
3131
BlockBandedMatrices = "0.10"
32-
ContinuumArrays = "0.7.2"
32+
ContinuumArrays = "0.7.3"
3333
DomainSets = "0.4, 0.5"
3434
FFTW = "1.1"
3535
FastGaussQuadrature = "0.4.3"
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using ContinuumArrays, FillArrays, InfiniteArrays, Plots
1+
using ClassicalOrthogonalPolynomials, Plots
22

33
T = Chebyshev()
44
C = Ultraspherical(2)
55
D = Derivative(axes(T,1))
66
A = (C\(D^2*T))+100(C\T)
77

8-
n = 100
9-
c = [T[[-1,1],1:n]; A[1:n-2,1:n]] \ [1;2;zeros(n-2)]
10-
u = T*Vcat(c,Zeros(∞))
11-
12-
xx = range(-1,1;length=1000)
13-
plot(xx,u[xx])
8+
c = Vcat(T[[-1,1],:], A) \ [1;2;zeros(∞)]
9+
u = T*c
1410

11+
plot(u)

src/ClassicalOrthogonalPolynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import QuasiArrays: cardinality, checkindex, QuasiAdjoint, QuasiTranspose, Inclu
2828

2929
import InfiniteArrays: OneToInf, InfAxes, Infinity, AbstractInfUnitRange, InfiniteCardinal, InfRanges
3030
import ContinuumArrays: Basis, Weight, basis, @simplify, Identity, AbstractAffineQuasiVector, ProjectionFactorization,
31-
inbounds_getindex, grid, transform, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, Expansion,
31+
inbounds_getindex, grid, plotgrid, transform, transform_ldiv, TransformFactorization, QInfAxes, broadcastbasis, Expansion,
3232
AffineQuasiVector, AffineMap, WeightLayout, WeightedBasisLayout, WeightedBasisLayouts, demap, AbstractBasisLayout, BasisLayout,
3333
checkpoints, weight, unweightedbasis, MappedBasisLayouts, __sum
3434
import FastTransforms: Λ, forwardrecurrence, forwardrecurrence!, _forwardrecurrence!, clenshaw, clenshaw!,

src/classical/jacobi.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ function grid(Pn::SubQuasiArray{T,2,<:AbstractJacobi,<:Tuple{Inclusion,AbstractU
207207
ChebyshevGrid{1,T}(maximum(jr))
208208
end
209209

210+
function plotgrid(Pn::SubQuasiArray{T,2,<:AbstractJacobi,<:Tuple{Inclusion,AbstractUnitRange}}) where T
211+
kr,jr = parentindices(Pn)
212+
ChebyshevGrid{2,T}(40maximum(jr))
213+
end
214+
215+
210216
function ldiv(::Legendre{V}, f::AbstractQuasiVector) where V
211217
T = ChebyshevT{V}()
212218
[cheb2leg(paddeddata(T \ f)); zeros(V,∞)]

test/test_chebyshev.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ import ContinuumArrays: MappedWeightedBasisLayout, Map
356356
V = view(T,:,[1,3,4])
357357
@test (U\(D*V))[1:5,:] == (U \ (V'D')')[1:5,:] == (U\(D*T))[1:5,[1,3,4]]
358358
end
359+
360+
@testset "plot" begin
361+
@test ContinuumArrays.plotgrid(ChebyshevT()[:,1:5]) == ChebyshevGrid{2}(200)
362+
end
359363
end
360364

361365
struct QuadraticMap{T} <: Map{T} end

0 commit comments

Comments
 (0)