Skip to content

Support ApproxFun v0.2 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFunOrthogonalPolynomials"
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
version = "0.2.3"
version = "0.2.4"

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

[compat]
AbstractFFTs = "0.4"
ApproxFunBase = "0.1.6"
ApproxFunBase = "0.2"
BandedMatrices = "0.11, 0.12"
BlockArrays = "0.9, 0.10"
BlockBandedMatrices = "0.5"
Expand Down
49 changes: 48 additions & 1 deletion src/ApproxFunOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,54 @@ import SpecialFunctions: sinpi, cospi, airy, besselh,
eta, zeta, gamma, polygamma, invdigamma, digamma, trigamma,
abs, sign, log, expm1, tan, abs2, sqrt, angle, max, min, cbrt, log,
atan, acos, asin, erfc, inv


points(d::IntervalOrSegmentDomain{T},n::Integer; kind::Int=1) where {T} =
fromcanonical.(Ref(d), chebyshevpoints(float(real(eltype(T))), n; kind=kind)) # eltype to handle point
bary(v::AbstractVector{Float64}, d::IntervalOrSegmentDomain, x::Float64) = bary(v,tocanonical(d,x))

function FastTransforms.chebyshevtransform!(X::AbstractMatrix{T};kind::Integer=1) where T<:fftwNumber
if kind == 1
if size(X) == (1,1)
X
else
X=r2r!(X,REDFT10)
X[:,1]/=2;X[1,:]/=2;
lmul!(1/(size(X,1)*size(X,2)),X)
end
elseif kind == 2
if size(X) == (1,1)
X
else
X=r2r!(X,REDFT00)
lmul!(1/((size(X,1)-1)*(size(X,2)-1)),X)
X[:,1]/=2;X[:,end]/=2
X[1,:]/=2;X[end,:]/=2
X
end
end
end

function FastTransforms.ichebyshevtransform!(X::AbstractMatrix{T};kind::Integer=1) where T<:fftwNumber
if kind == 1
if size(X) == (1,1)
X
else
X[1,:]*=2;X[:,1]*=2
X = r2r(X,REDFT01)
lmul!(1/4,X)
end
elseif kind == 2
if size(X) == (1,1)
X
else
X[1,:]*=2;X[end,:]*=2;X[:,1]*=2;X[:,end]*=2
X=chebyshevtransform!(X;kind=kind)
X[1,:]*=2;X[end,:]*=2;X[:,1]*=2;X[:,end]*=2
lmul!((size(X,1)-1)*(size(X,2)-1)/4,X)
end
end
end

include("ultraspherical.jl")
include("Domains/Domains.jl")
include("Spaces/Spaces.jl")
Expand Down
8 changes: 4 additions & 4 deletions test/MultivariateTest.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using ApproxFunBase, ApproxFunOrthogonalPolynomials, LinearAlgebra, SpecialFunctions, BlockBandedMatrices, Test
import ApproxFunBase: testbandedblockbandedoperator, testraggedbelowoperator, factor, Block, cfstype,
blocklengths, block, tensorizer, Vec, ArraySpace, ∞,
testblockbandedoperator, chebyshevtransform

import ApproxFunBase: testbandedblockbandedoperator, testraggedbelowoperator, factor, Block, cfstype,
blocklengths, block, tensorizer, Vec, ArraySpace, ∞,
testblockbandedoperator
import ApproxFunOrthogonalPolynomials: chebyshevtransform

@testset "Multivariate" begin
@testset "Square" begin
Expand Down