Skip to content

Commit 2447612

Browse files
authored
interlace => ApproxFunBase.interlace (#738)
* interlace => ApproxFunBase.interlace * test for the fix Fourier with BigFloat coefficients * test Fourier BigFloat
1 parent 10a7e59 commit 2447612

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Extras/fftGeneric.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ function *(::TransformPlan{T,Fourier{D,R},false},x::AbstractVector{T}) where {T<
116116
v = fft(x)
117117
rmul!(v,convert(T,2)/l)
118118
v[1] /= 2
119-
mod(l,2) == 1 ? interlace(real(v[1:n]),-imag(v[2:n])) :
120-
[interlace(real(v[1:n]),-imag(v[2:n]));-real(v[n+1])/2]
119+
mod(l,2) == 1 ? ApproxFunBase.interlace(real(v[1:n]),-imag(v[2:n])) :
120+
[ApproxFunBase.interlace(real(v[1:n]),-imag(v[2:n]));-real(v[n+1])/2]
121121
end
122122

123123
function *(::ITransformPlan{T,Fourier{D,R},false},x::AbstractVector{T}) where {T<:BigFloat,D,R}

test/NumberTypeTest.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ using ApproxFun, ApproxFunOrthogonalPolynomials, Test
2121
@test norm(single_double_err) < 10eps(Float64)
2222
end
2323

24+
@testset "BigFloat constructor (Fourier)" begin
25+
f = exp cos
26+
double_f = Fun(f,
27+
Fourier(Interval(Float64(0),2*Float64(π))))
28+
big_f = Fun(f,
29+
Fourier(Interval(BigFloat(0),2*BigFloat(π))))
30+
@test ncoefficients(double_f) <= ncoefficients(big_f)
31+
32+
@test eltype(coefficients(double_f)) == Float64
33+
@test eltype(coefficients(big_f)) == BigFloat
34+
35+
double_big_err = coefficients(double_f) - coefficients(big_f)[1:ncoefficients(double_f)]
36+
@test norm(double_big_err) < 10eps(Float64)
37+
end
38+
2439
@testset "BigFloat roots" begin
2540
a = Fun(ChebyshevInterval{BigFloat}(),BigFloat[1,2,3])
2641
# 12 is some bound on how accurately the polynomial can be evaluated

0 commit comments

Comments
 (0)