Skip to content

Commit 49148b7

Browse files
committed
interface norm and moments
1 parent c7a4029 commit 49148b7

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/bases/dictionary/basisfunction.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ innerproduct(ϕ::AbstractBasisFunction, ψ::AbstractBasisFunction; options...) =
8686
innerproduct::AbstractBasisFunction, ψ::AbstractBasisFunction, measure; options...) =
8787
dict_innerproduct(dictionary(φ), index(φ), dictionary(ψ), index(ψ), measure; options...)
8888

89-
norm::AbstractBasisFunction, μ = measure(φ); options...) = sqrt(innerproduct(φ, φ, μ; options...))
90-
91-
norm::AbstractBasisFunction, p::Real) = dict_norm(dictionary(φ), index(φ), p)
89+
norm::AbstractBasisFunction; options...) = norm(φ, measure(φ); options...)
90+
norm::AbstractBasisFunction, p; options...) = dict_norm(dictionary(φ), index(φ), p; options...)
9291

9392
# The inner product of a basis function with another function: this is an analysis integral
9493
# We introduce a separate function name for this for easier dispatch.

src/bases/dictionary/dict_moments.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ with respect to the given measure.
3131
function dict_norm(dict, idx, μ::Measure)
3232
checkdictionary(dict)
3333
@boundscheck checkbounds(dict, idx)
34-
sqrt(innerproduct(dict, idx, dict, idx, μ))
34+
sqrt(dict_innerproduct(dict, idx, dict, idx, μ))
3535
end
3636
dict_norm(dict, idx) = dict_norm(dict, idx, measure(dict))

src/bases/dictionary/dictionary.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ ones(s::Dictionary) = ones(coefficienttype(s), s)
137137
# By default we assume that the native format corresponds to an array of the
138138
# same size as the set. This is not true, e.g., for multidicts.
139139
zeros(::Type{T}, s::Dictionary) where {T} = zeros(T, size(s))
140-
ones(::Type{T}, s::Dictionary) where {T} = ones(T, size(s))
140+
function ones(::Type{T}, s::Dictionary) where T
141+
z = zeros(T, s)
142+
z .= 1
143+
end
141144

142145
"What is the type of the coefficient vector of the dictionary?"
143146
containertype(d::Dictionary) = typeof(zeros(d))

src/bases/fourier/sinc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ hasderivative(b::PeriodicSincFunctions) = false #for now
2424
hasantiderivative(b::PeriodicSincFunctions) = false #for now
2525

2626
hasconstant(b::PeriodicSincFunctions) = true
27-
coefficients_of_one(b) = ones(numtype(b), size(b))
27+
coefficients_of_one(b::PeriodicSincFunctions) = ones(numtype(b), size(b))
2828

2929
"Indices of translated sinc functions start at 0."
3030
struct SincIndex <: AbstractShiftedIndex{1}

0 commit comments

Comments
 (0)