Skip to content

Commit eab5d3c

Browse files
authored
Plotting for weighted bases (#96)
* plotting for weighted bases * tests for basic weighted Chebyshev * import for tests * remove redundant test * version 0.7.5
1 parent f3e0d96 commit eab5d3c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ContinuumArrays"
22
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
3-
version = "0.7.4"
3+
version = "0.7.5"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/plotting.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ end
1010

1111
_plotgrid(_, P) = grid(P)
1212

13+
_plotgrid(::WeightedBasisLayouts, wP) = plotgrid(unweightedbasis(wP))
14+
1315
plotgrid(g) = _plotgrid(MemoryLayout(g), g)
1416

1517
_split_svec(x) = (x,)

test/runtests.jl

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ContinuumArrays, QuasiArrays, LazyArrays, IntervalSets, FillArrays, LinearAlgebra, BandedMatrices, FastTransforms, InfiniteArrays, Test, Base64, RecipesBase
22
import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, AdjointBasisLayout, SubBasisLayout, ℵ₁,
33
MappedBasisLayout, AdjointMappedBasisLayout, MappedWeightedBasisLayout, TransformFactorization, Weight, WeightedBasisLayout, SubWeightedBasisLayout, WeightLayout,
4-
Expansion, basis, invmap, Map, checkpoints
4+
Expansion, basis, invmap, Map, checkpoints, _plotgrid
55
import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
66
import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle
77

@@ -471,7 +471,7 @@ end
471471
end
472472

473473
"""
474-
This is a simple implementation of Chebyshev for testing. Use OrthogonalPolynomialsQuasi
474+
This is a simple implementation of Chebyshev for testing. Use ClassicalOrthogonalPolynomials
475475
for the real implementation.
476476
"""
477477
struct Chebyshev <: Basis{Float64}
@@ -611,4 +611,21 @@ include("test_basisconcat.jl")
611611
rep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), u)
612612
@test rep[1].args == (L.points,u[L.points])
613613
end
614+
615+
@testset "Chebyshev and weighted Chebyshev" begin
616+
T = Chebyshev(10)
617+
w = ChebyshevWeight()
618+
wT = w .* T
619+
x = axes(T, 1)
620+
621+
u = T * Vcat(rand(3), Zeros(7))
622+
v = wT * Vcat(rand(3), Zeros(7))
623+
624+
rep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), u)
625+
@test rep[1].args == (grid(T), u[grid(T)])
626+
wrep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), v)
627+
@test wrep[1].args == (grid(wT), v[grid(wT)])
628+
629+
@test plotgrid(v) == plotgrid(u) == grid(T) == grid(wT) == _plotgrid(MemoryLayout(v), v) == _plotgrid(MemoryLayout(u), u)
630+
end
614631
end

0 commit comments

Comments
 (0)