Skip to content

Commit 0ca89ec

Browse files
authored
Move some complexroots methods to AFB (#67)
1 parent b80c8b6 commit 0ca89ec

File tree

3 files changed

+2
-40
lines changed

3 files changed

+2
-40
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1717

1818
[compat]
1919
AbstractFFTs = "0.5, 1"
20-
ApproxFunBase = "0.7.43"
20+
ApproxFunBase = "0.7.54"
2121
ApproxFunBaseTest = "0.1"
2222
Aqua = "0.5"
2323
BandedMatrices = "0.16, 0.17"

src/ApproxFunFourier.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import ApproxFunBase: Fun, SumSpace, SubSpace, NoSpace, IntervalOrSegment,
3535
reverseeven!, negateeven!, cfstype, alternatesign!, extremal_args,
3636
hesseneigvals, chebyshev_clenshaw, roots, EmptyDomain,
3737
chebmult_getindex, components, affine_setdiff, complexroots,
38-
assert_integer
38+
assert_integer, companion_matrix
3939

4040
import BandedMatrices: bandwidths
4141

src/roots.jl

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,3 @@
1-
2-
function companion_matrix(c::Vector{T}) where T
3-
n=length(c)-1
4-
5-
if n==0
6-
zeros(T,0,0)
7-
else
8-
A=zeros(T,n,n)
9-
for k=1:n
10-
A[k,end]=-c[k]/c[end]
11-
end
12-
for k=2:n
13-
A[k,k-1]=one(T)
14-
end
15-
A
16-
end
17-
end
18-
19-
20-
# if isdir(Pkg.dir("AMVW"))
21-
# using AMVW
22-
# function complexroots(cfs::Vector)
23-
# c=chop(cfs,10eps())
24-
#
25-
# # Only use special routine for large roots
26-
# if length(c)≥70
27-
# Main.AMVW.rootsAMVW(c)
28-
# else
29-
# hesseneigvals(companion_matrix(c))
30-
# end
31-
# end
32-
# else
33-
complexroots(cfs::Vector{T}) where {T<:Union{Float64,ComplexF64}} =
34-
hesseneigvals(companion_matrix(chop(cfs,10eps())))
35-
# end
36-
371
function complexroots(cfs::Vector{T}) where T<:Union{BigFloat,Complex{BigFloat}}
382
a = Fun(Taylor(Circle(BigFloat)),cfs)
393
ap = a'
@@ -45,8 +9,6 @@ function complexroots(cfs::Vector{T}) where T<:Union{BigFloat,Complex{BigFloat}}
459
rts
4610
end
4711

48-
complexroots(neg::Vector, pos::Vector) =
49-
complexroots([reverse(chop(neg,10eps()), dims=1);pos])
5012
complexroots(f::Fun{Laurent{DD,RR}}) where {DD,RR} =
5113
mappoint.(Ref(Circle()), Ref(domain(f)),
5214
complexroots(f.coefficients[2:2:end],f.coefficients[1:2:end]))

0 commit comments

Comments
 (0)