Skip to content

Commit 0ebe9de

Browse files
committed
Tests pass!
1 parent 3dcca4c commit 0ebe9de

24 files changed

+121
-378
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
11
# ApproxFunOrthogonalPolynomials.jl
22
Support for orthogonal polynomial-based spaces in ApproxFun
3+
4+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaApproximation.github.io/ApproxFun.jl/stable)
5+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaApproximation.github.io/ApproxFun.jl/latest)
6+
[![Build Status](https://travis-ci.org/JuliaApproximation/ApproxFun.jl.svg?branch=master)](https://travis-ci.org/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl)
7+
[![Build status](https://ci.appveyor.com/api/projects/status/q3e3ihfbxnrjn7ji?svg=true)](https://ci.appveyor.com/project/dlfivefifty/approxfunorthogonalpolynomials-jl)
8+
[![Coverage Status](https://img.shields.io/coveralls/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl.svg)](https://coveralls.io/r/JuliaApproximation/ApproxFunOrthogonalPolynomials.jl?branch=master)
9+
[![Join the chat at https://gitter.im/JuliaApproximation/ApproxFun.jl](https://badges.gitter.im/JuliaApproximation/ApproxFun.jl.svg)](https://gitter.im/JuliaApproximation/ApproxFun.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10+
11+
12+
13+
[ApproxFun.jl](https://github.com/JuliaApproximation/ApproxFun.jl) is a package for approximating functions. This package implements Fourier based spaces to ApproxFun.

src/ApproxFunOrthogonalPolynomials.jl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module ApproxFunOrthogonalPolynomials
2-
using Base, LinearAlgebra, Reexport, BandedMatrices, AbstractFFTs, FFTW, InfiniteArrays, FillArrays, FastTransforms, IntervalSets,
3-
DomainSets, Statistics, SpecialFunctions
2+
using Base, LinearAlgebra, Reexport, BandedMatrices, BlockBandedMatrices, AbstractFFTs, FFTW, InfiniteArrays, BlockArrays, FillArrays, FastTransforms, IntervalSets,
3+
DomainSets, Statistics, SpecialFunctions, FastGaussQuadrature
44

55
@reexport using ApproxFunBase
66

@@ -17,30 +17,33 @@ import ApproxFunBase: normalize!, flipsign, FiniteRange, Fun, MatrixFun, UnsetSp
1717
ConcreteConversion, ConcreteMultiplication, ConcreteDerivative, ConcreteIntegral,
1818
ConcreteVolterra, Volterra, VolterraWrapper,
1919
MultiplicationWrapper, ConversionWrapper, DerivativeWrapper, Evaluation, EvaluationWrapper,
20-
Conversion, Multiplication, Derivative, Integral, bandwidths,
20+
Conversion, defaultConversion, defaultcoefficients, default_Fun, Multiplication, Derivative, Integral, bandwidths,
2121
ConcreteEvaluation, ConcreteDefiniteLineIntegral, ConcreteDefiniteIntegral, ConcreteIntegral,
22-
DefiniteLineIntegral, DefiniteIntegral, ConcreteDefiniteIntegral, ConcreteDefiniteLineIntegral,
22+
DefiniteLineIntegral, DefiniteIntegral, ConcreteDefiniteIntegral, ConcreteDefiniteLineIntegral, IntegralWrapper,
2323
ReverseOrientation, ReverseOrientationWrapper, ReverseWrapper, Reverse, NegateEven, Dirichlet, ConcreteDirichlet,
2424
TridiagonalOperator, SubOperator, Space, @containsconstants, spacescompatible,
2525
hasfasttransform, canonicalspace, domain, setdomain, prectype, domainscompatible,
2626
plan_transform, plan_itransform, plan_transform!, plan_itransform!, transform, itransform, hasfasttransform,
27-
CanonicalTransformPlan,
27+
CanonicalTransformPlan, ICanonicalTransformPlan,
2828
Integral,
2929
domainspace, rangespace, boundary,
3030
union_rule, conversion_rule, maxspace_rule, conversion_type, maxspace, hasconversion, points,
3131
rdirichlet, ldirichlet, lneumann, rneumann, ivp, bvp,
3232
linesum, differentiate, integrate, linebilinearform, bilinearform,
33-
UnsetNumber, coefficienttimes,
33+
UnsetNumber, coefficienttimes, subspace_coefficients, sumspacecoefficients, specialfunctionnormalizationpoint,
3434
Segment, IntervalOrSegmentDomain, PiecewiseSegment, isambiguous, Vec, eps, isperiodic,
3535
arclength, complexlength,
3636
invfromcanonicalD, fromcanonical, tocanonical, fromcanonicalD, tocanonicalD, canonicaldomain, setcanonicaldomain, mappoint,
3737
reverseorientation, checkpoints, evaluate, mul_coefficients, coefficients, isconvertible,
3838
clenshaw, ClenshawPlan, sineshaw,
3939
toeplitz_getindex, toeplitz_axpy!, sym_toeplitz_axpy!, hankel_axpy!, ToeplitzOperator, SymToeplitzOperator, hankel_getindex,
4040
SpaceOperator, ZeroOperator, InterlaceOperator,
41-
interlace!, reverseeven!, negateeven!, cfstype, pad!,
42-
extremal_args, hesseneigvals, chebyshev_clenshaw, recA, recB, recC, roots, chebmult_getindex, intpow, alternatingsum,
43-
domaintype, diagindshift, rangetype, weight, isapproxinteger, default_Dirichlet, scal!
41+
interlace!, reverseeven!, negateeven!, cfstype, pad!, alternatesign!, mobius,
42+
extremal_args, hesseneigvals, chebyshev_clenshaw, recA, recB, recC, roots,splitatroots,
43+
chebmult_getindex, intpow, alternatingsum,
44+
domaintype, diagindshift, rangetype, weight, isapproxinteger, default_Dirichlet, scal!, dotu,
45+
components, promoterangespace, promotedomainspace,
46+
block, blockstart, blockstop, blocklengths, isblockbanded, pointscompatible
4447

4548
import DomainSets: Domain, indomain, UnionDomain, ProductDomain, FullSpace, Point, elements, DifferenceDomain,
4649
Interval, ChebyshevInterval, boundary, ∂, rightendpoint, leftendpoint,
@@ -74,6 +77,8 @@ import FastTransforms: ChebyshevTransformPlan, IChebyshevTransformPlan, plan_che
7477
plan_chebyshevtransform!, plan_ichebyshevtransform, plan_ichebyshevtransform!,
7578
pochhammer
7679

80+
import BlockBandedMatrices: blockbandwidths, subblockbandwidths
81+
7782
# we need to import all special functions to use Calculus.symbolic_derivatives_1arg
7883
# we can't do importall Base as we replace some Base definitions
7984
import SpecialFunctions: sinpi, cospi, airy, besselh,

src/Domains/IntervalCurve.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
2-
3-
1+
export IntervalCurve
42

53
struct IntervalCurve{S<:Space,T,VT} <: SegmentDomain{T}
64
curve::Fun{S,T,VT}

src/Spaces/Ultraspherical/ContinuousSpace.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
export ContinuousSpace
22

33
struct ContinuousSpace{T,R} <: Space{PiecewiseSegment{T},R}
44
domain::PiecewiseSegment{T}

src/roots.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,6 @@ extrema(f::Fun{ContinuousSpace{T,R},T}) where {T<:Real,R<:Real} =
266266
mapreduce(extrema,(x,y)->extrema([x...;y...]),components(f))
267267

268268

269-
270-
271-
272-
273-
## Root finding for Laurent expansion
274-
275-
276-
277269
function roots(f::Fun{P}) where P<:ContinuousSpace
278270
rts=mapreduce(roots,vcat,components(f))
279271
k=1

src/specialfunctions.jl

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -300,40 +300,5 @@ function jumplocations(f::Fun{S}) where{S<:Union{PiecewiseSpace,ContinuousSpace}
300300
locs[isjump]
301301
end
302302

303-
#
304-
# These formulæ, appearing in Eq. (2.5) of:
305-
#
306-
# A.-K. Kassam and L. N. Trefethen, Fourth-order time-stepping for stiff PDEs, SIAM J. Sci. Comput., 26:1214--1233, 2005,
307-
#
308-
# are derived to implement ETDRK4 in double precision without numerical instability from cancellation.
309-
#
310-
311-
expα_asy(x) = (exp(x)*(4-3x+x^2)-4-x)/x^3
312-
expβ_asy(x) = (exp(x)*(x-2)+x+2)/x^3
313-
expγ_asy(x) = (exp(x)*(4-x)-4-3x-x^2)/x^3
314-
315-
# TODO: General types
316-
317-
expα_taylor(x::Union{Float64,ComplexF64}) = @evalpoly(x,1/6,1/6,3/40,1/45,5/1008,1/1120,7/51840,1/56700,1/492800,1/4790016,11/566092800,1/605404800,13/100590336000,1/106748928000,1/1580833013760,1/25009272288000,17/7155594141696000,1/7508956815360000)
318-
expβ_taylor(x::Union{Float64,ComplexF64}) = @evalpoly(x,1/6,1/12,1/40,1/180,1/1008,1/6720,1/51840,1/453600,1/4435200,1/47900160,1/566092800,1/7264857600,1/100590336000,1/1494484992000,1/23712495206400,1/400148356608000,1/7155594141696000,1/135161222676480000)
319-
expγ_taylor(x::Union{Float64,ComplexF64}) = @evalpoly(x,1/6,0/1,-1/120,-1/360,-1/1680,-1/10080,-1/72576,-1/604800,-1/5702400,-1/59875200,-1/691891200,-1/8717829120,-1/118879488000,-1/1743565824000,-1/27360571392000,-1/457312407552000,-1/8109673360588800)
320-
321-
expα(x::Float64) = abs(x) < 17/16 ? expα_taylor(x) : expα_asy(x)
322-
expβ(x::Float64) = abs(x) < 19/16 ? expβ_taylor(x) : expβ_asy(x)
323-
expγ(x::Float64) = abs(x) < 15/16 ? expγ_taylor(x) : expγ_asy(x)
324-
325-
expα(x::ComplexF64) = abs2(x) < (17/16)^2 ? expα_taylor(x) : expα_asy(x)
326-
expβ(x::ComplexF64) = abs2(x) < (19/16)^2 ? expβ_taylor(x) : expβ_asy(x)
327-
expγ(x::ComplexF64) = abs2(x) < (15/16)^2 ? expγ_taylor(x) : expγ_asy(x)
328-
329-
expα(x) = expα_asy(x)
330-
expβ(x) = expβ_asy(x)
331-
expγ(x) = expγ_asy(x)
332-
333-
334-
for f in (:(exp),:(expm1),:expα,:expβ,:expγ)
335-
@eval $f(op::Operator) = OperatorFunction(op,$f)
336-
end
337-
338303

339304

test/ETDRK4Test.jl

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/ExtrasTest.jl

Lines changed: 0 additions & 145 deletions
This file was deleted.

test/FullPDETest.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,62 +171,62 @@ import ApproxFun: resizedata!, CachedOperator, RaggedMatrix, testbandedblockband
171171

172172
KO=Δ.op.ops[1].ops[1].op
173173

174-
M=ApproxFun.BandedBlockBandedMatrix(view(KO,1:4,1:4))
175-
@test norm(ApproxFun.BandedBlockBandedMatrix(view(KO,1:4,2:4))-M[:,2:4]) < 10eps()
176-
@test norm(ApproxFun.BandedBlockBandedMatrix(view(KO,1:4,3:4))-M[:,3:4]) < 10eps()
174+
M=BandedBlockBandedMatrix(view(KO,1:4,1:4))
175+
@test norm(BandedBlockBandedMatrix(view(KO,1:4,2:4))-M[:,2:4]) < 10eps()
176+
@test norm(BandedBlockBandedMatrix(view(KO,1:4,3:4))-M[:,3:4]) < 10eps()
177177
end
178178

179179

180180
@testset "Check resizing" begin
181181
d=ChebyshevInterval()^2
182182
A=[Dirichlet(d);Laplacian()+100I]
183183
QRR = qr(A)
184-
@time ApproxFun.resizedata!(QRR.R_cache,:,2000)
184+
@time ApproxFunBase.resizedata!(QRR.R_cache,:,2000)
185185
@test norm(QRR.R_cache.data[1:200,1:200] - A[1:200,1:200]) ==0
186186

187-
@time ApproxFun.resizedata!(QRR,:,200)
187+
@time ApproxFunBase.resizedata!(QRR,:,200)
188188
j=56
189189
v=QRR.R_cache.op[1:100,j]
190190
@test norm(ldiv_coefficients(QRR.Q,v;maxlength=300)[j+1:end]) < 100eps()
191191

192192
j=195
193-
v=QRR.R_cache.op[1:ApproxFun.colstop(QRR.R_cache.op,j),j]
193+
v=QRR.R_cache.op[1:ApproxFunBase.colstop(QRR.R_cache.op,j),j]
194194
@test norm(ldiv_coefficients(QRR.Q,v;maxlength=1000)[j+1:end]) < 100eps()
195195

196196

197197
j=300
198-
v=QRR.R_cache.op[1:ApproxFun.colstop(QRR.R_cache.op,j),j]
198+
v=QRR.R_cache.op[1:ApproxFunBase.colstop(QRR.R_cache.op,j),j]
199199
@test norm(ldiv_coefficients(QRR.Q,v;maxlength=1000)[j+1:end]) < j*20eps()
200200

201-
@test ApproxFun.colstop(QRR.R_cache.op,195)-194 == ApproxFun.colstop(QRR.H,195)
201+
@test ApproxFunBase.colstop(QRR.R_cache.op,195)-194 == ApproxFunBase.colstop(QRR.H,195)
202202

203203

204204
QR1 = qr(A)
205-
@time ApproxFun.resizedata!(QR1.R_cache,:,1000)
205+
@time ApproxFunBase.resizedata!(QR1.R_cache,:,1000)
206206
QR2 = qr([Dirichlet(d);Laplacian()+100I])
207-
@time ApproxFun.resizedata!(QR2.R_cache,:,500)
207+
@time ApproxFunBase.resizedata!(QR2.R_cache,:,500)
208208
n=450;QR1.R_cache.data[1:n,1:n]-QR2.R_cache.data[1:n,1:n]|>norm
209-
@time ApproxFun.resizedata!(QR2.R_cache,:,1000)
209+
@time ApproxFunBase.resizedata!(QR2.R_cache,:,1000)
210210
N=450;QR1.R_cache.data[1:N,1:N]-QR2.R_cache.data[1:N,1:N]|>norm
211211
N=1000;QR1.R_cache.data[1:N,1:N]-QR2.R_cache.data[1:N,1:N]|>norm
212212

213213
QR1 = qr(A)
214-
@time ApproxFun.resizedata!(QR1,:,1000)
214+
@time ApproxFunBase.resizedata!(QR1,:,1000)
215215
QR2 = qr([Dirichlet(d);Laplacian()+100I])
216-
@time ApproxFun.resizedata!(QR2,:,500)
217-
@time ApproxFun.resizedata!(QR2,:,1000)
216+
@time ApproxFunBase.resizedata!(QR2,:,500)
217+
@time ApproxFunBase.resizedata!(QR2,:,1000)
218218

219219
@test norm(QR1.H[1:225,1:1000]-QR2.H[1:225,1:1000]) 10eps()
220220

221221
QR1 = qr(A)
222-
@time ApproxFun.resizedata!(QR1,:,5000)
222+
@time ApproxFunBase.resizedata!(QR1,:,5000)
223223
@time u=\(QR1,[ones((d));0.];tolerance=1E-7)
224224

225225
@test norm((Dirichlet(d)*u-ones((d))).coefficients) < 1E-7
226226
@test norm((A*u-Fun([ones((d));0.])).coefficients) < 1E-7
227227
@test norm(((A*u)[2]-(Laplacian(space(u))+100I)*u).coefficients) < 1E-10
228-
@test eltype(ApproxFun.promotedomainspace(Laplacian(),space(u))) == Float64
229-
@test eltype(ApproxFun.promotedomainspace(Laplacian()+100I,space(u))) == Float64
228+
@test eltype(ApproxFunBase.promotedomainspace(Laplacian(),space(u))) == Float64
229+
@test eltype(ApproxFunBase.promotedomainspace(Laplacian()+100I,space(u))) == Float64
230230
@test norm(((A*u)[2]-(Laplacian()+100I)*u).coefficients) < 1E-10
231231
@test norm((Laplacian()*u+100*u - (A*u)[2]).coefficients) < 10E-10
232232
@time v=\(A,[ones((d));0.];tolerance=1E-7)
@@ -282,9 +282,9 @@ import ApproxFun: resizedata!, CachedOperator, RaggedMatrix, testbandedblockband
282282
Dx=Derivative(s);Dt=Derivative(dt)
283283
Bx=[ldirichlet(s);continuity(s,0)]
284284

285-
@test ApproxFun.rangetype(rangespace(continuity(s,0))) == Vector{Float64}
286-
@test ApproxFun.rangetype(rangespace(Bx)) == Vector{Any}
287-
@test ApproxFun.rangetype(rangespace(BxOperator(I,Chebyshev()))) == Vector{Any}
285+
@test ApproxFunBase.rangetype(rangespace(continuity(s,0))) == Vector{Float64}
286+
@test ApproxFunBase.rangetype(rangespace(Bx)) == Vector{Any}
287+
@test ApproxFunBase.rangetype(rangespace(BxOperator(I,Chebyshev()))) == Vector{Any}
288288

289289
rhs = Fun([0,[0,[0,0]],0],rangespace([Ildirichlet(dt);BxI;IDt+(a*Dx)I]))
290290
@test rhs(-0.5,0.0) == [0,[0,[0,0]],0]

0 commit comments

Comments
 (0)