Skip to content

Commit e56ebcc

Browse files
authored
test transforms using AFOP (#141)
1 parent 87983c2 commit e56ebcc

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"
2929

3030
[compat]
3131
AbstractFFTs = "0.5, 1"
32+
ApproxFunOrthogonalPolynomials = "0.4"
3233
BandedMatrices = "0.16, 0.17"
3334
BlockArrays = "0.14, 0.15, 0.16"
3435
BlockBandedMatrices = "0.10, 0.11"
@@ -50,7 +51,8 @@ ToeplitzMatrices = "0.6, 0.7"
5051
julia = "1.5"
5152

5253
[extras]
54+
ApproxFunOrthogonalPolynomials = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
5355
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
5456

5557
[targets]
56-
test = ["Random"]
58+
test = ["ApproxFunOrthogonalPolynomials", "Random"]

src/Space.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,13 @@ function CanonicalTransformPlan(space,v)
384384
csp = canonicalspace(space)
385385
CanonicalTransformPlan(eltype(v),space,plan_transform(csp,v),csp)
386386
end
387-
function plan_transform(sp::Space,vals)
387+
function checkcanonicalspace(sp)
388388
csp = canonicalspace(sp)
389-
if sp == csp
390-
error("Override for $sp")
391-
end
389+
sp == csp && error("Override for $sp")
390+
csp
391+
end
392+
function plan_transform(sp::Space,vals)
393+
csp = checkcanonicalspace(sp)
392394
CanonicalTransformPlan(sp,plan_transform(csp,vals),csp)
393395
end
394396

@@ -398,10 +400,7 @@ function ICanonicalTransformPlan(space,v)
398400
ICanonicalTransformPlan(eltype(v),space,plan_itransform(csp,cfs),csp)
399401
end
400402
function plan_itransform(sp::Space,v)
401-
csp = canonicalspace(sp)
402-
if sp == csp
403-
error("Override for $sp")
404-
end
403+
csp = checkcanonicalspace(sp)
405404
cfs = coefficients(v,sp,csp)
406405
ICanonicalTransformPlan(sp,plan_itransform(csp,cfs),csp)
407406
end

test/SpacesTest.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ApproxFunBase, Test
22
import ApproxFunBase: PointSpace, HeavisideSpace, PiecewiseSegment, dimension, Vec, checkpoints
3+
using ApproxFunOrthogonalPolynomials
34

45
@testset "Spaces" begin
56
@testset "PointSpace" begin
@@ -165,4 +166,10 @@ import ApproxFunBase: PointSpace, HeavisideSpace, PiecewiseSegment, dimension, V
165166
@test union(b, b) == b
166167
end
167168
end
169+
170+
@testset "ApproxFunOrthogonalPolynomials" begin
171+
v = rand(4)
172+
v2 = transform(NormalizedChebyshev(), v)
173+
@test itransform(NormalizedChebyshev(), v2) v
174+
end
168175
end

0 commit comments

Comments
 (0)