Skip to content

Commit 69d9e20

Browse files
committed
Add default zero behaviour for Fourier spaces
1 parent 0bf7a77 commit 69d9e20

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/sequence_spaces/sequence.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Base.zero(a::Sequence) = zeros(eltype(a), space(a))
110110
Base.zero(::Type{Sequence{T,S}}) where {T<:VectorSpace,S<:AbstractVector} = zeros(eltype(S), _zero_space(T))
111111
_zero_space(::Type{TensorSpace{T}}) where {T<:Tuple} = TensorSpace(map(_zero_space, fieldtypes(T)))
112112
_zero_space(::Type{Taylor}) = Taylor(0)
113+
_zero_space(::Type{Fourier{T}}) where {T<:Real} = Fourier(0, one(T))
113114
_zero_space(::Type{Chebyshev}) = Chebyshev(0)
114115

115116
Base.one(a::Sequence{ParameterSpace}) = Sequence(space(a), [one(eltype(a))])

src/sequence_spaces/symmetry.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ IntervalArithmetic.interval(s::CosFourier) = CosFourier(interval(desymmetrize(s)
113113

114114
_prettystring(s::CosFourier) = "CosFourier(" * string(order(s)) * ", " * string(frequency(s)) * ", " * string(multiple(s)) * ")"
115115

116+
_zero_space(::Type{CosFourier{T}}) where {T<:Real} = CosFourier(0, one(T))
117+
116118

117119

118120
struct SinFourier{T<:Real} <: SymBaseSpace
@@ -155,6 +157,8 @@ IntervalArithmetic.interval(s::SinFourier) = SinFourier(interval(desymmetrize(s)
155157

156158
_prettystring(s::SinFourier) = "SinFourier(" * string(order(s)) * ", " * string(frequency(s)) * ", " * string(multiple(s)) * ")"
157159

160+
_zero_space(::Type{SinFourier{T}}) where {T<:Real} = SinFourier(1, one(T))
161+
158162

159163

160164

0 commit comments

Comments
 (0)