Skip to content

Commit

Permalink
Plotting for weighted bases (#96)
Browse files Browse the repository at this point in the history
* plotting for weighted bases

* tests for basic weighted Chebyshev

* import for tests

* remove redundant test

* version 0.7.5
  • Loading branch information
TSGut authored May 24, 2021
1 parent f3e0d96 commit eab5d3c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ContinuumArrays"
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
version = "0.7.4"
version = "0.7.5"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
2 changes: 2 additions & 0 deletions src/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ end

_plotgrid(_, P) = grid(P)

_plotgrid(::WeightedBasisLayouts, wP) = plotgrid(unweightedbasis(wP))

plotgrid(g) = _plotgrid(MemoryLayout(g), g)

_split_svec(x) = (x,)
Expand Down
21 changes: 19 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ContinuumArrays, QuasiArrays, LazyArrays, IntervalSets, FillArrays, LinearAlgebra, BandedMatrices, FastTransforms, InfiniteArrays, Test, Base64, RecipesBase
import ContinuumArrays: ℵ₁, materialize, AffineQuasiVector, BasisLayout, AdjointBasisLayout, SubBasisLayout, ℵ₁,
MappedBasisLayout, AdjointMappedBasisLayout, MappedWeightedBasisLayout, TransformFactorization, Weight, WeightedBasisLayout, SubWeightedBasisLayout, WeightLayout,
Expansion, basis, invmap, Map, checkpoints
Expansion, basis, invmap, Map, checkpoints, _plotgrid
import QuasiArrays: SubQuasiArray, MulQuasiMatrix, Vec, Inclusion, QuasiDiagonal, LazyQuasiArrayApplyStyle, LazyQuasiArrayStyle
import LazyArrays: MemoryLayout, ApplyStyle, Applied, colsupport, arguments, ApplyLayout, LdivStyle, MulStyle

Expand Down Expand Up @@ -471,7 +471,7 @@ end
end

"""
This is a simple implementation of Chebyshev for testing. Use OrthogonalPolynomialsQuasi
This is a simple implementation of Chebyshev for testing. Use ClassicalOrthogonalPolynomials
for the real implementation.
"""
struct Chebyshev <: Basis{Float64}
Expand Down Expand Up @@ -611,4 +611,21 @@ include("test_basisconcat.jl")
rep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), u)
@test rep[1].args == (L.points,u[L.points])
end

@testset "Chebyshev and weighted Chebyshev" begin
T = Chebyshev(10)
w = ChebyshevWeight()
wT = w .* T
x = axes(T, 1)

u = T * Vcat(rand(3), Zeros(7))
v = wT * Vcat(rand(3), Zeros(7))

rep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), u)
@test rep[1].args == (grid(T), u[grid(T)])
wrep = RecipesBase.apply_recipe(Dict{Symbol, Any}(), v)
@test wrep[1].args == (grid(wT), v[grid(wT)])

@test plotgrid(v) == plotgrid(u) == grid(T) == grid(wT) == _plotgrid(MemoryLayout(v), v) == _plotgrid(MemoryLayout(u), u)
end
end

2 comments on commit eab5d3c

@dlfivefifty
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/37392

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.5 -m "<description of version>" eab5d3c8c1122ed8c9fb432ab0161d0c158ceb02
git push origin v0.7.5

Please sign in to comment.