Skip to content

Commit 9447c21

Browse files
authored
static splat dispatch in default_Fun (#220)
* static splat dispatch in default_Fun * restore docstrings
1 parent 76d6c3f commit 9447c21

File tree

4 files changed

+13
-22
lines changed

4 files changed

+13
-22
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.14"
3+
version = "0.7.15"
44

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

src/Multivariate/LowRankFun.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
export LowRankFun
66

77
"""
8-
LowRankFun
8+
LowRankFun(f, space::TensorSpace)
99
1010
Return an approximation to a bivariate function in low rank form.
1111

src/Operators/general/PartialInverseOperator.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ of `O` and `PartialInverseOperator(O)`.
1515
```jldoctest
1616
julia> C = Conversion(Chebyshev(), Ultraspherical(1));
1717
18-
julia> bandwidths(C)
19-
(0, 2)
20-
21-
julia> P = PartialInverseOperator(C);
22-
23-
julia> bandwidths(P)
24-
(0, 2)
18+
julia> P = PartialInverseOperator(C); # default bandwidth = (0,2)
2519
2620
julia> P * C
2721
TimesOperator : Chebyshev() → Chebyshev()
@@ -37,10 +31,7 @@ TimesOperator : Chebyshev() → Chebyshev()
3731
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1.0 ⋱
3832
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋱
3933
40-
julia> P = PartialInverseOperator(C, (0, 4));
41-
42-
julia> bandwidths(P)
43-
(0, 4)
34+
julia> P = PartialInverseOperator(C, (0, 4)); # increase the upper bandwidth
4435
4536
julia> P * C
4637
TimesOperator : Chebyshev() → Chebyshev()

src/constructors.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ end
3838

3939
# default_Fun is the default constructor, based on evaluation and transforms
4040
# last argument is whether to splat or not
41-
default_Fun(T::Type,f,d::Space,pts::AbstractArray,::Type{Val{true}}) =
41+
default_Fun(T::Type,f,d::Space,pts::AbstractArray, shouldsplat::Val{true}) =
4242
Fun(d,transform(d,T[f(x...) for x in pts]))
4343

44-
default_Fun(T::Type,f,d::Space,pts::AbstractArray,::Type{Val{false}}) =
44+
default_Fun(T::Type,f,d::Space,pts::AbstractArray, shouldsplat::Val{false}) =
4545
Fun(d,transform(d,broadcast!(f, similar(pts, T), pts)))
4646

4747

48-
function default_Fun(f,d::Space,n::Integer,::Type{Val{false}})
48+
function default_Fun(f,d::Space,n::Integer, shouldsplat::Val{false})
4949
pts=points(d, n)
5050
f1=f(pts[1])
5151
if isa(f1,AbstractArray) && size(d) size(f1)
@@ -54,10 +54,10 @@ function default_Fun(f,d::Space,n::Integer,::Type{Val{false}})
5454

5555
# we need 3 eltype calls for the case Interval(Point([1.,1.]))
5656
Tprom=choosefuncfstype(typeof(f1),prectype(domain(d)))
57-
default_Fun(Tprom,f,d,pts,Val{false})
57+
default_Fun(Tprom,f,d,pts,Val(false))
5858
end
5959

60-
function default_Fun(f,d::Space,n::Integer,::Type{Val{true}})
60+
function default_Fun(f,d::Space,n::Integer, shouldsplat::Val{true})
6161
pts=points(d, n)
6262
f1=f(pts[1]...)
6363
if isa(f1,AbstractArray) && size(d) size(f1)
@@ -66,10 +66,10 @@ function default_Fun(f,d::Space,n::Integer,::Type{Val{true}})
6666

6767
# we need 3 eltype calls for the case Interval(Point([1.,1.]))
6868
Tprom=choosefuncfstype(typeof(f1),prectype(domain(d)))
69-
default_Fun(Tprom,f,d,pts,Val{true})
69+
default_Fun(Tprom,f,d,pts,Val(true))
7070
end
7171

72-
default_Fun(f,d::Space,n::Integer) = default_Fun(f,d,n,Val{!hasnumargs(f,1)})
72+
default_Fun(f,d::Space,n::Integer) = default_Fun(f,d,n,Val(!hasnumargs(f,1)))
7373

7474
Fun(f,d::Space,n::Integer) = default_Fun(dynamic(f),d,n)
7575

@@ -117,10 +117,10 @@ function _default_Fun(f, d::Space)
117117

118118
for logn = 4:20
119119
#cf = Fun(f, d, 2^logn + 1)
120-
cf = default_Fun(f, d, 2^logn)
120+
cf = default_Fun(f, d, 2^logn, Val(false))
121121
maxabsc = maximum(abs,cf.coefficients)
122122
if maxabsc == 0 && maxabsfr == 0
123-
return(zeros(d))
123+
return zeros(d)
124124
end
125125

126126
b = block(d,length(cf.coefficients))

0 commit comments

Comments
 (0)