Skip to content

Parameterize PiecewiseSegment #149

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 4 commits into from
Nov 18, 2022
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.5.15"
version = "0.5.16"

[deps]
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
Expand All @@ -19,7 +19,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
ApproxFunBase = "0.7"
ApproxFunBase = "0.7.34"
ApproxFunBaseTest = "0.1"
Aqua = "0.5"
BandedMatrices = "0.16, 0.17"
Expand Down
43 changes: 20 additions & 23 deletions src/ApproxFunOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,32 @@ import DomainSets: Domain, indomain, UnionDomain, FullSpace, Point,

import BandedMatrices: bandshift, bandwidth, colstop, bandwidths, BandedMatrix

import Base: convert, getindex, *, +, -, ==, <, <=, >, |, !, !=, eltype,
>=, /, ^, \, ∪, transpose, size, copyto!, copy,
map, vcat, hcat, show, stride, sum, cumsum, conj, inv,
complex, reverse, exp, sqrt, abs, sign, issubset, values,
import Base: convert, getindex, eltype, <, <=, +, -, *, /, ^, ==,
show, stride, sum, cumsum, conj, inv,
complex, exp, sqrt, abs, sign, issubset,
first, last, rand, intersect, setdiff,
isless, union, angle, isnan, isapprox, isempty, sort, merge,
minimum, maximum, extrema, argmax, argmin,
zeros, zero, one, promote_rule, length, resize!, isinf,
getproperty, cld, div, real, imag,
max, min, log, acosh, tanh, atanh,
atan, sinh, asinh,
tan, tanh, asin, sec, acos,
sin, cos, sinh, cosh,
asinh, acosh, atanh,
Array, Vector, Matrix, view, ones, split

import LinearAlgebra: norm, mul!, det, eigvals, qr, Tridiagonal, transpose

import FastTransforms: plan_chebyshevtransform, plan_chebyshevtransform!,
isless, union, angle, isnan, isapprox, isempty,
minimum, maximum, extrema, zeros, one, promote_rule,
getproperty, real, imag, max, min, log, acos,
sin, cos, asinh, acosh, atanh, ones
# atan, tan, tanh, asin, sec, sinh, cosh,
# split

using FastTransforms: plan_chebyshevtransform, plan_chebyshevtransform!,
plan_ichebyshevtransform, plan_ichebyshevtransform!,
pochhammer, lgamma, chebyshevtransform!, ichebyshevtransform!
pochhammer, lgamma

import BlockBandedMatrices: blockbandwidths, subblockbandwidths
import BlockBandedMatrices: blockbandwidths

# we need to import all special functions to use Calculus.symbolic_derivatives_1arg
import SpecialFunctions: erfcx, dawson, erf,
import SpecialFunctions: erfcx, dawson,
hankelh1, hankelh2, besselj, bessely, besseli, besselk,
besselkx, hankelh1x, hankelh2x,
expm1, eta, gamma, erfc
besselkx, hankelh1x, hankelh2x
# The following are not extended here.
# Some of these are extended in ApproxFunBase
# erf, erfinv, erfc, erfcinv, erfi, gamma, lgamma, digamma, invdigamma,
# trigamma, airyai, airybi, airyaiprime, airybiprime, besselj0,
# besselj1, bessely0, bessely1

using StaticArrays: SVector

Expand Down
6 changes: 3 additions & 3 deletions src/Spaces/Ultraspherical/ContinuousSpace.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export ContinuousSpace

struct ContinuousSpace{T,R} <: Space{PiecewiseSegment{T},R}
domain::PiecewiseSegment{T}
struct ContinuousSpace{T,R,P<:PiecewiseSegment{T}} <: Space{P,R}
domain::P
end

ContinuousSpace(d::PiecewiseSegment{T}) where {T} =
ContinuousSpace{T,real(eltype(T))}(d)
ContinuousSpace{T,real(eltype(T)),typeof(d)}(d)


Space(d::PiecewiseSegment) = ContinuousSpace(d)
Expand Down
4 changes: 0 additions & 4 deletions src/Spaces/Ultraspherical/DirichletSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@ setdomain(S::ChebyshevDirichlet{l,r},d::Domain) where {l,r} = ChebyshevDirichlet
Base.isless(a::Chebyshev,b::ChebyshevDirichlet) = false
<(a::Chebyshev,b::ChebyshevDirichlet) = false
<=(a::Chebyshev,b::ChebyshevDirichlet) = false
>(a::Chebyshev,b::ChebyshevDirichlet) = true
>=(a::Chebyshev,b::ChebyshevDirichlet) = true

Base.isless(a::ChebyshevDirichlet,b::Chebyshev) = true
<(a::ChebyshevDirichlet,b::Chebyshev) = true
<=(a::ChebyshevDirichlet,b::Chebyshev) = true
>(a::ChebyshevDirichlet,b::Chebyshev) = false
>=(a::ChebyshevDirichlet,b::Chebyshev) = false

## coefficients

Expand Down
7 changes: 4 additions & 3 deletions src/specialfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ for (op,ODE,RHS,growth) in ((:(hankelh1),"f^2*f'*D^2+(f*f'^2-f^2*f'')*D+(f^2-ν^
opfxmin,opfxmax = $op(ν,f(xmin)),$op(ν,f(xmax))
opmax = maximum(abs,(opfxmin,opfxmax))
end
D=Derivative(space(f))
B=[Evaluation(space(f),xmin),Evaluation(space(f),xmax)]
u=\([B;eval($L)],[opfxmin;opfxmax;eval($R)];tolerance=eps(T)*opmax)
Sf = space(f)
D=Derivative(Sf)
B=[Evaluation(Sf,xmin), Evaluation(Sf,xmax)]
u=\([B;$L],[opfxmin;opfxmax;$R];tolerance=eps(T)*opmax)

setdomain(u,domain(fin))
end
Expand Down
3 changes: 2 additions & 1 deletion test/SpacesTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ using ApproxFunBaseTest: testspace, testbandedoperator, testraggedbelowoperator,

s=Fun(sin,-2..2)|>abs
c=Fun(cos,-2..2)|>abs
sc=Fun(x -> abs(sin(x))+abs(cos(x)), ContinuousSpace(PiecewiseSegment([-2,(-π/2),0,π/2,2])))
csp = @inferred ContinuousSpace(PiecewiseSegment([-2,(-π/2),0,π/2,2]))
sc=Fun(x -> abs(sin(x))+abs(cos(x)), csp)
@test norm(sc-(c+s))<100eps()

@test sc * sc == sc^2
Expand Down