Skip to content

Commit c7a4029

Browse files
committed
a few deprecations
1 parent e190eb3 commit c7a4029

22 files changed

+91
-105
lines changed

ext/BasisFunctionsRecipesBaseExt/BasisFunctionsRecipesBaseExt.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ end
121121
seriestype --> :heatmap
122122
aspect_ratio --> 1
123123
colorbar --> false
124-
# xrange = linspace(xlim[1],xlim[2],n)
125124
xrange = EquispacedGrid(n,xlim[1],xlim[2])
126-
# yrange = linspace(ylim[1],ylim[2],n)
127125
yrange = EquispacedGrid(n,ylim[1],ylim[2])
128126
# grid = [SVector(i,j) for i in xrange , j in yrange]
129127
grid = xrange×yrange

src/bases/dictionary/basisfunction.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
dictionary::BasisFunction) = φ.dictionary
5252
index::BasisFunction) = φ.index
5353

54-
support::BasisFunction) = support(dictionary(φ), index(φ))
54+
support::BasisFunction) = dict_support(dictionary(φ), index(φ))
5555
measure::BasisFunction) = measure(dictionary(φ))
5656

5757
show(io::IO, mime::MIME"text/plain", φ::BasisFunction) = composite_show(io, mime, φ)
@@ -104,15 +104,15 @@ innerproduct(f, ψ::AbstractBasisFunction, measure; options...) =
104104
# that leads to incomputable integrals.
105105
function analysis_integral(dict::Dictionary, idx, g, measure::Measure; options...)
106106
@boundscheck checkbounds(dict, idx)
107-
domain1 = support(dict, idx)
107+
domain1 = dict_support(dict, idx)
108108
domain2 = support(measure)
109109
qs = quadstrategy(promote_type(prectype(dict), prectype(measure)); options...)
110110
unsafe_analysis_integral1(dict, idx, g, measure, domain1, domain2, domain1 domain2, qs)
111111
end
112112

113113
function analysis_integral(dict::Dictionary, idx, g, measure::DiscreteWeight; options...)
114114
@boundscheck checkbounds(dict, idx)
115-
unsafe_analysis_integral2(dict, idx, g, measure, support(dict, idx))
115+
unsafe_analysis_integral2(dict, idx, g, measure, dict_support(dict, idx))
116116
end
117117

118118
# unsafe for indexing

src/bases/dictionary/dict_evaluation.jl

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,22 @@ checkbounds(::Type{Bool}, dict::Dictionary, idx::NTuple{N,Int}) where {N} =
3232
@inline checkbounds(::Type{Bool}, dict::Dictionary, I...) = checkbounds_indices(Bool, axes(dict), I)
3333

3434
"Return the support of the idx-th basis function. Default is support of the dictionary."
35-
function support(dict::Dictionary, idx)
35+
function dict_support(dict, idx)
36+
checkdictionary(dict)
3637
checkbounds(dict, idx)
3738
support(dict)
3839
end
39-
# Warning: the functions above and below may be wrong for certain concrete
40-
# dictionaries, for example for univariate functions with non-connected support.
41-
# Make sure to override, and make sure that the overridden version is called.
42-
4340
"Does the given point lie inside the support of the given function or dictionary?"
4441
in_support(dict::Dictionary, x) = dict_in_support(dict, x)
45-
in_support(dict::Dictionary, idx, x) = dict_in_support(dict, idx, x)
46-
47-
# in_support(dict::Dictionary, x) =
48-
# dict_in_support(dict, element_type_check(x, domaintype(dict)))
49-
# in_support(dict::Dictionary, idx, x) =
50-
# dict_in_support(dict, idx, element_type_check(x, domaintype(dict)))
51-
#
52-
# element_type_check(x, T) = _element_type_check(x, T, typeof(x))
53-
# _element_type_check(x, T, S) = _element_type_check(x, T, S, promote_type(S,T))
54-
# _element_type_check(x, T, S, V) = x
55-
# _element_type_check(x, T, S, V) = x
56-
# function _element_type_check(x, T, S, ::Type{Any})
57-
# @warn "Dictionary with domain type $(T) may not support evaluation with type $(S)."
58-
# x
59-
# end
60-
#
61-
# # Some special cases
62-
# _element_type_check(x, ::NTuple{N,T}, ::SVector{N,T}) where {T,N} = x
63-
# _element_type_check(x, ::SVector{N,T}, ::NTuple{N,T}) where {T,N} = x
64-
65-
66-
# The mechanism is as follows:
67-
# - in_support(dict::Dictionary, ...) calls dict_in_support
68-
# - any linear index is converted to a native index
69-
# - concrete dictionary should implement dict_in_support
70-
# The reasoning is that concrete dictionaries need not all worry about handling
71-
# linear indices. Yet, they are free to implement other types of indices.
72-
# If a more efficient algorithm is available for linear indices, then the concrete
73-
# dictionary can still intercept the call to in_support.
74-
# The delegation to a method with a different name (dict_in_support) makes it
75-
# substantially easier to deal with ambiguity errors.
76-
77-
# This is the standard conversion to a native_index for an index of type
78-
# Int. This calls a different function, hence it is fine if the native
79-
# index happens to be a linear index (Int).
80-
in_support(dict::Dictionary, idx::Int, x) =
81-
dict_in_support(dict, native_index(dict, idx), x)
82-
83-
# The default fallback is implemented below in terms of the support of the dictionary:
84-
dict_in_support(dict::Dictionary, idx, x) = default_in_support(dict, idx, x)
85-
dict_in_support(dict::Dictionary, x) = default_in_support(dict, x)
86-
87-
default_in_support(dict::Dictionary, idx, x) = approx_in(x, support(dict, idx), tolerance(dict))
88-
default_in_support(dict::Dictionary, x) = approx_in(x, support(dict), tolerance(dict))
42+
in_support(dict::Dictionary, idx, x) = dict_in_support(dict, native_index(dict, idx), x)
43+
44+
# Concrete types can override this if there is a more efficient implementation
45+
dict_in_support(dict, x) = default_in_support(dict, x)
46+
dict_in_support(dict, idx, x) = default_in_support(dict, idx, x)
47+
48+
# by default we invoke the support of the dictionary
49+
default_in_support(dict, x) = approx_in(x, support(dict), tolerance(dict))
50+
default_in_support(dict, idx, x) = approx_in(x, dict_support(dict, idx), tolerance(dict))
8951

9052

9153

src/bases/dictionary/dict_moments.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,29 @@
88
Compute the moment of the given basisfunction, i.e. the integral on its
99
support.
1010
"""
11-
function moment(dict::Dictionary1d, idx; options...)
11+
function dict_moment(dict, idx; options...)
12+
checkdictionary(dict)
1213
@boundscheck checkbounds(dict, idx)
13-
unsafe_moment(dict, native_index(dict, idx); options...)
14+
unsafe_dict_moment(dict, native_index(dict, idx); options...)
1415
end
1516

16-
# This routine is called after the boundscheck. Call another function,
17-
# default moment, so that unsafe_moment of the concrete dictionary can still
18-
# fall back to `default_moment` as well for some values of the index.
19-
unsafe_moment(dict::Dictionary, idx; options...) = default_moment(dict, idx; options...)
17+
# This routine is called after the boundscheck.
18+
unsafe_dict_moment(dict::Dictionary, idx; options...) = default_dict_moment(dict, idx; options...)
2019

2120
# Default to numerical integration
22-
default_moment(dict::Dictionary, idx; measure = lebesguemeasure(support(dict)), options...) =
21+
default_dict_moment(dict::Dictionary, idx; measure = lebesguemeasure(support(dict)), options...) =
2322
innerproduct(dict[idx], x->1, measure; options...)
2423

25-
dict_norm(dict, idx) = dict_norm(dict, idx, measure(dict))
2624

25+
"""
26+
dict_norm(dict, idx[, μ])
27+
28+
Compute the norm of the given basisfunction of the given dictionary,
29+
with respect to the given measure.
30+
"""
2731
function dict_norm(dict, idx, μ::Measure)
32+
checkdictionary(dict)
2833
@boundscheck checkbounds(dict, idx)
2934
sqrt(innerproduct(dict, idx, dict, idx, μ))
3035
end
36+
dict_norm(dict, idx) = dict_norm(dict, idx, measure(dict))

src/bases/dictionary/dictionary.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ of the features for a description of that interface and the syntax.
2929
abstract type Dictionary{S,T}
3030
end
3131

32+
"Does the given argument implement the dictionary interface?"
33+
isdictionary(d::Dictionary) = true
34+
isdictionary(d) = false
35+
36+
"Throws an error if the given argument does not implement the dictionary interface."
37+
checkdictionary(d) = isdictionary(d) || throw(ArgumentError("Not a dictionary: $(d)"))
38+
3239
# Useful abstraction for special cases
3340
const Dictionary1d{S <: Number,T} = Dictionary{S,T}
3441
# Warning: these are shaky definitions of multivariate functions

src/bases/dictionary/expansions.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Expansion4d{S <: Number,T,D,C} = Expansion{SVector{4,S},T,D,C}
4040
ncomponents,
4141
measure
4242

43-
@forward Expansion.coefficients length, eachindex, getindex, setindex!
43+
@forward Expansion.coefficients length, eachindex
4444
codomaintype(e::Expansion) = promote_type(codomaintype(dictionary(e)), eltype(coefficients(e)))
4545
isreal(e::Expansion) = isreal(e.dictionary) && isreal(eltype(coefficients(e)))
4646

@@ -207,12 +207,3 @@ expansion_of_one(dict::Dictionary) = Expansion(dict, coefficients_of_one(dict))
207207
expansion_of_x(dict::Dictionary) = Expansion(dict, coefficients_of_x(dict))
208208

209209
apply(op::DictionaryOperator, e::Expansion) = Expansion(dest(op), op * coefficients(e))
210-
211-
# TODO: we may not want to identify an Expansion with its array of coefficients
212-
iterate(e::Expansion) = iterate(coefficients(e))
213-
iterate(e::Expansion, state) = iterate(coefficients(e), state)
214-
215-
Base.collect(e::Expansion) = coefficients(e)
216-
217-
Base.BroadcastStyle(e::Expansion) = Base.Broadcast.DefaultArrayStyle{dimension(e)}()
218-

src/bases/dictionary/orthog.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ end
4747
function default_dict_innerproduct(Φ1::Dictionary, i, Φ2::Dictionary, j, measure::Measure; options...)
4848
@boundscheck checkbounds(Φ1, i)
4949
@boundscheck checkbounds(Φ2, j)
50-
domain1 = support(Φ1, i)
51-
domain2 = support(Φ2, j)
50+
domain1 = dict_support(Φ1, i)
51+
domain2 = dict_support(Φ2, j)
5252
domain3 = support(measure)
5353

5454
# This code is delicate: it is necessary when using basis functions with compact
@@ -74,8 +74,8 @@ safe_default_dict_innerproduct(Φ1::Dictionary, i, Φ2::Dictionary, j, measure::
7474
function default_dict_innerproduct(Φ1::Dictionary, i, Φ2::Dictionary, j, measure::DiscreteWeight; options...)
7575
@boundscheck checkbounds(Φ1, i)
7676
@boundscheck checkbounds(Φ2, j)
77-
domain1 = support(Φ1, i)
78-
domain2 = support(Φ2, j)
77+
domain1 = dict_support(Φ1, i)
78+
domain2 = dict_support(Φ2, j)
7979
unsafe_default_dict_innerproduct2(Φ1, i, Φ2, j, measure, domain1 domain2)
8080
end
8181

src/bases/modifiers/mapped_dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ end
127127

128128
support(dict::MappedDict) = DomainSets.map_domain(forward_map(dict), support(superdict(dict)))
129129

130-
support(dict::MappedDict, idx) = forward_map(dict).(support(superdict(dict), idx))
130+
dict_support(dict::MappedDict, idx) = forward_map(dict).(dict_support(superdict(dict), idx))
131131

132132
function dict_in_support(set::MappedDict, idx, y, threshold = default_threshold(y))
133133
x = leftinverse(forward_map(set), y)

src/bases/modifiers/operated_dict.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ for op in (:support, :length)
9494
@eval $op(s::OperatedDict) = $op(src(s))
9595
end
9696

97-
function support::OperatedDict, idx)
97+
function dict_support::OperatedDict, idx)
9898
if isdiag(operator(Φ))
99-
support(src(Φ), idx)
99+
dict_support(src(Φ), idx)
100100
else
101101
# We don't know in general what the support of a specific basis function is.
102102
# The safe option is to return the support of the set itself for each element.

src/bases/modifiers/piecewise_dict.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ end
1818

1919
# Make a PiecewiseDict by scaling one set to each of the elements of the partition
2020
function PiecewiseDict(set::Dictionary1d, partition::Partition, n = ones(Int,length(partition))*length(set))
21-
dicts = [rescale(resize(set, n[i]), support(partition, i)) for i in 1:length(partition)]
21+
dicts = [rescale(resize(set, n[i]), partition_support(partition, i)) for i in 1:length(partition)]
2222
PiecewiseDict(dicts, partition)
2323
end
2424

@@ -46,7 +46,7 @@ function PiecewiseDict(dicts::Array{S}) where {S <: Dictionary1d}
4646
end
4747

4848
function PiecewiseDict(set::Dictionary, partition::Partition)
49-
dicts = [rescale(set, support(partition, i)) for i in 1:length(partition)]
49+
dicts = [rescale(set, dict_support(partition, i)) for i in 1:length(partition)]
5050
PiecewiseDict(dicts, partition)
5151
end
5252

@@ -127,7 +127,7 @@ split_interval(set::PiecewiseDict, x) = split_interval(set, partition_index(part
127127

128128
function split_interval(set::PiecewiseDict, i::Int, x)
129129
part = partition(set)
130-
@assert infimum(support(part, i)) < x < supremum(support(part, i))
130+
@assert infimum(partition_support(part, i)) < x < supremum(partition_support(part, i))
131131

132132
part2 = split_interval(part, i, x)
133133
two_sets = split_interval(component(set, i), x)

0 commit comments

Comments
 (0)