Skip to content

Commit 101a92b

Browse files
authored
Inplace Chebyshev transform (#79)
* Inplace chebyshev transform * version bump to v0.4.11 * Add tests
1 parent 1d3e065 commit 101a92b

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-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 = "ApproxFunOrthogonalPolynomials"
22
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
3-
version = "0.4.10"
3+
version = "0.4.11"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Spaces/Chebyshev/Chebyshev.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ transform(::Chebyshev,vals::AbstractVector,plan) = plan*vals
7272
itransform(::Chebyshev,cfs::AbstractVector,plan) = plan*cfs
7373
plan_transform(::Chebyshev,vals::AbstractVector) = plan_chebyshevtransform(vals)
7474
plan_itransform(::Chebyshev,cfs::AbstractVector) = plan_ichebyshevtransform(cfs)
75+
plan_transform!(::Chebyshev, vals::AbstractVector) = plan_chebyshevtransform!(vals)
76+
plan_itransform!(::Chebyshev, cfs::AbstractVector) = plan_ichebyshevtransform!(cfs)
7577

7678
## Evaluation
7779

test/ChebyshevTest.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ApproxFunOrthogonalPolynomials, ApproxFunBase, LinearAlgebra, Test
2-
import ApproxFunBase: testspace, recA, recB, recC
3-
import ApproxFunOrthogonalPolynomials: forwardrecurrence
2+
import ApproxFunBase: testspace, recA, recB, recC, transform!, itransform!
3+
import ApproxFunOrthogonalPolynomials: forwardrecurrence
44

55
@testset "Chebyshev" begin
66
@testset "Forward recurrence" begin
@@ -208,4 +208,16 @@ using ApproxFunOrthogonalPolynomials, ApproxFunBase, LinearAlgebra, Test
208208
@test S.a==-0.5
209209
@test S.b==-0.5
210210
end
211+
212+
@testset "inplace transform" begin
213+
for T in [Float32, Float64, BigFloat]
214+
for v in Any[rand(T, 10), rand(complex(T), 10)]
215+
v2 = copy(v)
216+
transform!(Chebyshev(), v)
217+
@test transform(Chebyshev(), v2) == v
218+
itransform!(Chebyshev(), v)
219+
@test v2 v
220+
end
221+
end
222+
end
211223
end

0 commit comments

Comments
 (0)