Skip to content

Commit 339d1f8

Browse files
authored
move fallback roots from AFOP (#333)
1 parent 9b1d5bb commit 339d1f8

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.7.54"
3+
version = "0.7.55"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/specialfunctions.jl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,58 @@ end
627627

628628
roots(f::Fun{<:PointSpace}) = space(f).points[values(f) .== 0]
629629

630+
## Root finding for Chebyshev expansions
631+
#
632+
# Contains code that is based in part on Chebfun v5's chebfun/@chebteck/roots.m,
633+
# which is distributed with the following license:
630634

635+
# Copyright (c) 2015, The Chancellor, Masters and Scholars of the University
636+
# of Oxford, and the Chebfun Developers. All rights reserved.
637+
#
638+
# Redistribution and use in source and binary forms, with or without
639+
# modification, are permitted provided that the following conditions are met:
640+
# * Redistributions of source code must retain the above copyright
641+
# notice, this list of conditions and the following disclaimer.
642+
# * Redistributions in binary form must reproduce the above copyright
643+
# notice, this list of conditions and the following disclaimer in the
644+
# documentation and/or other materials provided with the distribution.
645+
# * Neither the name of the University of Oxford nor the names of its
646+
# contributors may be used to endorse or promote products derived from
647+
# this software without specific prior written permission.
648+
#
649+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
650+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
651+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
652+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
653+
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
654+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
655+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
656+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
657+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
658+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
659+
660+
661+
#function roots(f::Fun)
662+
# irts=map(real,filter!(x->abs(x)<=1.+10eps(),filter!#(isreal,complexroots(f.coefficients))))
663+
#
664+
# map!(x->x>1. ? 1. : x,irts)
665+
# map!(x->x<-1. ? -1. : x,irts)
666+
#
667+
# if length(irts)==0
668+
# Float64[]
669+
# else
670+
# fromcanonical(f,irts)
671+
# end
672+
#end
673+
674+
function roots(f::Fun)
675+
f2=Fun(f,domain(f)) # default is to convert to Chebyshev/Fourier
676+
if space(f2)==space(f)
677+
error("roots not implemented for ", typeof(f))
678+
else
679+
roots(f2)
680+
end
681+
end
631682

632683
#
633684
# These formulæ, appearing in Eq. (2.5) of:

0 commit comments

Comments
 (0)