Skip to content

Commit

Permalink
Dl/jacobiplan (#6)
Browse files Browse the repository at this point in the history
* Add type to JacobiTransformPlan

* Update Project.toml

* Prune exact zeros in roots

* update for ApproxFunBase v0.1.2
  • Loading branch information
dlfivefifty authored Jul 17, 2019
1 parent 77904ee commit d4922b3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"

[compat]
AbstractFFTs = "≥ 0.3.1"
ApproxFunBase = "0.1.1"
ApproxFunBase = "0.1.2"
BandedMatrices = "0.9.0"
BlockArrays = "0.9"
BlockBandedMatrices = "0.4.3"
Calculus = "≥ 0.1.15"
DSP = "≥ 0.5.1"
DomainSets = "0.0.2"
DomainSets = "0.0.2, 0.1"
DualNumbers = "≥ 0.4.0"
FFTW = "≥ 0.2.4"
FastGaussQuadrature = "≥ 0.3.2"
FastTransforms = "≥ 0.4.2"
FillArrays = "≥ 0.5.0"
InfiniteArrays = "0.1"
IntervalSets = "≥ 0.3.1"
LazyArrays = "0.8"
LazyArrays = "0.8, 0.9"
LowRankApprox = "≥ 0.2"
Reexport = "≥ 0.2.0"
SpecialFunctions = "≥ 0.7.0"
Expand Down
2 changes: 1 addition & 1 deletion src/ApproxFunOrthogonalPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import BandedMatrices: bandrange, bandshift,
bandwidths, _BandedMatrix, BandedMatrix

import Base: values, convert, getindex, setindex!, *, +, -, ==, <, <=, >, |, !, !=, eltype, iterate,
>=, /, ^, \, , transpose, size, reindex, tail, broadcast, broadcast!, copyto!, copy, to_index, (:),
>=, /, ^, \, , transpose, size, tail, broadcast, broadcast!, copyto!, copy, to_index, (:),
similar, map, vcat, hcat, hvcat, show, summary, stride, sum, cumsum, sign, imag, conj, inv,
complex, reverse, exp, sqrt, abs, abs2, sign, issubset, values, in, first, last, rand, intersect, setdiff,
isless, union, angle, join, isnan, isapprox, isempty, sort, merge, promote_rule,
Expand Down
17 changes: 12 additions & 5 deletions src/Spaces/Jacobi/jacobitransform.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@

points(S::Jacobi, n) = points(Chebyshev(domain(S)), n)

struct JacobiTransformPlan{CPLAN,CJT}
struct JacobiTransformPlan{T,CPLAN,CJT} <: AbstractTransformPlan{T}
chebplan::CPLAN
cjtplan::CJT
end

JacobiTransformPlan(chebplan::CPLAN, cjtplan::CJT) where {CPLAN,CJT} =
JacobiTransformPlan{eltype(chebplan),CPLAN,CJT}(chebplan, cjtplan)

plan_transform(S::Jacobi, v::AbstractVector) =
JacobiTransformPlan(plan_transform(Chebyshev(), v), plan_icjt(v, S.a, S.b))
*(P::JacobiTransformPlan, vals) = P.cjtplan*(P.chebplan*vals)
*(P::JacobiTransformPlan, vals::AbstractVector) = P.cjtplan*(P.chebplan*vals)


struct JacobiITransformPlan{CPLAN,CJT}
struct JacobiITransformPlan{T,CPLAN,CJT} <: AbstractTransformPlan{T}
ichebplan::CPLAN
icjtplan::CJT
end

JacobiITransformPlan(chebplan::CPLAN, cjtplan::CJT) where {CPLAN,CJT} =
JacobiITransformPlan{eltype(chebplan),CPLAN,CJT}(chebplan, cjtplan)



plan_itransform(S::Jacobi,v::AbstractVector) =
plan_itransform(S::Jacobi, v::AbstractVector) =
JacobiITransformPlan(plan_itransform(Chebyshev(), v), plan_cjt(v, S.a, S.b))
*(P::JacobiITransformPlan,cfs) = P.ichebplan*(P.icjtplan*cfs)
*(P::JacobiITransformPlan, cfs::AbstractVector) = P.ichebplan*(P.icjtplan*cfs)


function coefficients(f::AbstractVector,a::Jacobi,b::Chebyshev)
Expand Down
1 change: 1 addition & 0 deletions src/roots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ end
function colleague_matrix( c::Vector{T} ) where T<:Number
#TODO: This is command isn't typed correctly
# COMPUTE THE ROOTS OF A LOW DEGREE POLYNOMIAL BY USING THE COLLEAGUE MATRIX:
c = chop(c,0) # prune exact zeros
n = length(c) - 1
A=zeros(T,n,n)

Expand Down

0 comments on commit d4922b3

Please sign in to comment.