Skip to content

Commit bd0c6cb

Browse files
authored
Support ApproxFun v0.2 (#8)
* Support ApproxFun v0.2 * v0.2.4
1 parent 7c82789 commit bd0c6cb

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
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.2.3"
3+
version = "0.2.4"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
@@ -21,7 +21,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2121

2222
[compat]
2323
AbstractFFTs = "0.4"
24-
ApproxFunBase = "0.1.6"
24+
ApproxFunBase = "0.2"
2525
BandedMatrices = "0.11, 0.12"
2626
BlockArrays = "0.9, 0.10"
2727
BlockBandedMatrices = "0.5"

src/ApproxFunOrthogonalPolynomials.jl

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,54 @@ import SpecialFunctions: sinpi, cospi, airy, besselh,
9292
eta, zeta, gamma, polygamma, invdigamma, digamma, trigamma,
9393
abs, sign, log, expm1, tan, abs2, sqrt, angle, max, min, cbrt, log,
9494
atan, acos, asin, erfc, inv
95-
95+
96+
points(d::IntervalOrSegmentDomain{T},n::Integer; kind::Int=1) where {T} =
97+
fromcanonical.(Ref(d), chebyshevpoints(float(real(eltype(T))), n; kind=kind)) # eltype to handle point
98+
bary(v::AbstractVector{Float64}, d::IntervalOrSegmentDomain, x::Float64) = bary(v,tocanonical(d,x))
99+
100+
function FastTransforms.chebyshevtransform!(X::AbstractMatrix{T};kind::Integer=1) where T<:fftwNumber
101+
if kind == 1
102+
if size(X) == (1,1)
103+
X
104+
else
105+
X=r2r!(X,REDFT10)
106+
X[:,1]/=2;X[1,:]/=2;
107+
lmul!(1/(size(X,1)*size(X,2)),X)
108+
end
109+
elseif kind == 2
110+
if size(X) == (1,1)
111+
X
112+
else
113+
X=r2r!(X,REDFT00)
114+
lmul!(1/((size(X,1)-1)*(size(X,2)-1)),X)
115+
X[:,1]/=2;X[:,end]/=2
116+
X[1,:]/=2;X[end,:]/=2
117+
X
118+
end
119+
end
120+
end
121+
122+
function FastTransforms.ichebyshevtransform!(X::AbstractMatrix{T};kind::Integer=1) where T<:fftwNumber
123+
if kind == 1
124+
if size(X) == (1,1)
125+
X
126+
else
127+
X[1,:]*=2;X[:,1]*=2
128+
X = r2r(X,REDFT01)
129+
lmul!(1/4,X)
130+
end
131+
elseif kind == 2
132+
if size(X) == (1,1)
133+
X
134+
else
135+
X[1,:]*=2;X[end,:]*=2;X[:,1]*=2;X[:,end]*=2
136+
X=chebyshevtransform!(X;kind=kind)
137+
X[1,:]*=2;X[end,:]*=2;X[:,1]*=2;X[:,end]*=2
138+
lmul!((size(X,1)-1)*(size(X,2)-1)/4,X)
139+
end
140+
end
141+
end
142+
96143
include("ultraspherical.jl")
97144
include("Domains/Domains.jl")
98145
include("Spaces/Spaces.jl")

test/MultivariateTest.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using ApproxFunBase, ApproxFunOrthogonalPolynomials, LinearAlgebra, SpecialFunctions, BlockBandedMatrices, Test
2-
import ApproxFunBase: testbandedblockbandedoperator, testraggedbelowoperator, factor, Block, cfstype,
3-
blocklengths, block, tensorizer, Vec, ArraySpace, ∞,
4-
testblockbandedoperator, chebyshevtransform
5-
2+
import ApproxFunBase: testbandedblockbandedoperator, testraggedbelowoperator, factor, Block, cfstype,
3+
blocklengths, block, tensorizer, Vec, ArraySpace, ∞,
4+
testblockbandedoperator
5+
import ApproxFunOrthogonalPolynomials: chebyshevtransform
66

77
@testset "Multivariate" begin
88
@testset "Square" begin

0 commit comments

Comments
 (0)