diff --git a/src/sequence_spaces/arithmetic/action.jl b/src/sequence_spaces/arithmetic/action.jl index 1aaccb9a..d4dffcab 100644 --- a/src/sequence_spaces/arithmetic/action.jl +++ b/src/sequence_spaces/arithmetic/action.jl @@ -1,8 +1,8 @@ # fallback methods -(A::LinearOperator)(b::Sequence) = *(A, b) +(A::LinearOperator)(b::AbstractSequence) = *(A, b) -function Base.:*(A::LinearOperator, b::Sequence) +function Base.:*(A::LinearOperator, b::AbstractSequence) domain_A, codomain_A = domain(A), codomain(A) space_b = space(b) _iscompatible(domain_A, space_b) || return throw(ArgumentError("spaces must be compatible: A has domain $domain_A, b has space $space_b")) @@ -12,13 +12,13 @@ function Base.:*(A::LinearOperator, b::Sequence) return c end -function mul!(c::Sequence, A::LinearOperator, b::Sequence, α::Number, β::Number) +function mul!(c::Sequence, A::LinearOperator, b::AbstractSequence, α::Number, β::Number) _iscompatible(space(c), codomain(A)) & _iscompatible(domain(A), space(b)) || return throw(ArgumentError("spaces must be compatible")) _mul!(c, A, b, α, β) return c end -function _mul!(c::Sequence, A::LinearOperator, b::Sequence, α::Number, β::Number) +function _mul!(c::Sequence, A::LinearOperator, b::AbstractSequence, α::Number, β::Number) domain_A, codomain_A = domain(A), codomain(A) space_b = space(b) space_c = space(c) @@ -51,7 +51,7 @@ function _mul!(c::Sequence, A::LinearOperator, b::Sequence, α::Number, β::Numb return c end -function Base.:\(A::LinearOperator, b::Sequence) +function Base.:\(A::LinearOperator, b::AbstractSequence) codomain_A = codomain(A) space_b = space(b) _iscompatible(codomain_A, space_b) || return throw(ArgumentError("spaces must be compatible: A has codomain $codomain_A, b has space $space_b")) diff --git a/src/sequence_spaces/arithmetic/fft.jl b/src/sequence_spaces/arithmetic/fft.jl index 6c75c836..a15749b4 100644 --- a/src/sequence_spaces/arithmetic/fft.jl +++ b/src/sequence_spaces/arithmetic/fft.jl @@ -10,9 +10,9 @@ fft_size(s₁::TensorSpace{<:NTuple{N,BaseSpace}}, s₂::TensorSpace{<:NTuple{N, fft_size(s₁::TensorSpace{<:NTuple{N,BaseSpace}}, s₂::TensorSpace{<:NTuple{N,BaseSpace}}, s₃::TensorSpace{<:NTuple{N,BaseSpace}}...) where {N} = ntuple(i -> nextpow(2, _dfs_dimension(s₁, i) + _dfs_dimension(s₂, i) + mapreduce(s₃_ -> _dfs_dimension(s₃_, i), +, s₃)), Val(N)) -fft_size(s::BaseSpace, n::Int) = (_fft_length(s, n),) +fft_size(s::BaseSpace, n::Integer) = (_fft_length(s, n),) -fft_size(s::TensorSpace, n::Int) = map(sᵢ -> _fft_length(sᵢ, n), spaces(s)) +fft_size(s::TensorSpace, n::Integer) = map(sᵢ -> _fft_length(sᵢ, n), spaces(s)) _fft_length(s₁::BaseSpace, s₂::BaseSpace) = nextpow(2, _dfs_dimension(s₁) + _dfs_dimension(s₂)) @@ -20,13 +20,13 @@ _fft_length(s₁::BaseSpace, s₂::BaseSpace) = _fft_length(s₁::BaseSpace, s₂::BaseSpace, s₃::BaseSpace...) = nextpow(2, _dfs_dimension(s₁) + _dfs_dimension(s₂) + mapreduce(_dfs_dimension, +, s₃)) -_fft_length(s::BaseSpace, n::Int) = nextpow(2, n * _dfs_dimension(s)) +_fft_length(s::BaseSpace, n::Integer) = nextpow(2, n * _dfs_dimension(s)) # _dfs_dimensions(s::TensorSpace) = map(_dfs_dimension, spaces(s)) -_dfs_dimension(s::TensorSpace, i::Int) = _dfs_dimension(s[i]) +_dfs_dimension(s::TensorSpace, i::Integer) = _dfs_dimension(s[i]) # Taylor _dfs_dimension(s::Taylor) = dimension(s) @@ -37,9 +37,9 @@ _dfs_dimension(s::Chebyshev) = 2order(s)+1 # sequence to discrete Fourier series -fft(a::Sequence{<:BaseSpace}, n::Tuple{Int}) = @inbounds fft(a, n[1]) +fft(a::Sequence{<:BaseSpace}, n::Tuple{Integer}) = @inbounds fft(a, n[1]) -function fft(a::Sequence{<:BaseSpace}, n::Int) +function fft(a::Sequence{<:BaseSpace}, n::Integer) space_a = space(a) _is_fft_size_compatible(n, space_a) || return throw(DimensionMismatch) CoefType = complex(eltype(a)) @@ -62,7 +62,7 @@ function fft!(C::AbstractVector, a::Sequence{<:BaseSpace}) return _fft_pow2!(C) end -function fft(a::Sequence{TensorSpace{T}}, n::NTuple{N,Int}) where {N,T<:NTuple{N,BaseSpace}} +function fft(a::Sequence{TensorSpace{T}}, n::NTuple{N,Integer}) where {N,T<:NTuple{N,BaseSpace}} space_a = space(a) _is_fft_size_compatible(n, space_a) || return throw(DimensionMismatch) CoefType = complex(eltype(a)) diff --git a/src/sequence_spaces/arithmetic/linear_operator.jl b/src/sequence_spaces/arithmetic/linear_operator.jl index 64ff9128..57894ebd 100644 --- a/src/sequence_spaces/arithmetic/linear_operator.jl +++ b/src/sequence_spaces/arithmetic/linear_operator.jl @@ -80,7 +80,7 @@ function lmul!(A::LinearOperator, B::LinearOperator) return LinearOperator(domain(B), codomain(A), lmul!(coefficients(A), coefficients(B))) end -function Base.:^(A::LinearOperator, n::Int) +function Base.:^(A::LinearOperator, n::Integer) if n < 0 return ^(inv(A), -n) elseif n == 0 diff --git a/src/sequence_spaces/special_operators/calculus.jl b/src/sequence_spaces/special_operators/calculus.jl index 1273f3e5..f379f64f 100644 --- a/src/sequence_spaces/special_operators/calculus.jl +++ b/src/sequence_spaces/special_operators/calculus.jl @@ -89,24 +89,24 @@ Integral(order::Int...) = Integral(order) order(ℐ::Integral) = ℐ.order """ - *(𝒟::Derivative, a::Sequence) + *(𝒟::Derivative, a::AbstractSequence) Compute the `order(𝒟)`-th derivative of `a`; equivalent to `differentiate(a, order(𝒟))`. -See also: [`(::Derivative)(::Sequence)`](@ref), [`Derivative`](@ref), +See also: [`(::Derivative)(::AbstractSequence)`](@ref), [`Derivative`](@ref), [`differentiate`](@ref) and [`differentiate!`](@ref). """ -Base.:*(𝒟::Derivative, a::Sequence) = differentiate(a, order(𝒟)) +Base.:*(𝒟::Derivative, a::AbstractSequence) = differentiate(a, order(𝒟)) """ - (𝒟::Derivative)(a::Sequence) + (𝒟::Derivative)(a::AbstractSequence) Compute the `order(𝒟)`-th derivative of `a`; equivalent to `differentiate(a, order(𝒟))`. -See also: [`*(::Derivative, ::Sequence)`](@ref), [`Derivative`](@ref), +See also: [`*(::Derivative, ::AbstractSequence)`](@ref), [`Derivative`](@ref), [`differentiate`](@ref) and [`differentiate!`](@ref). """ -(𝒟::Derivative)(a::Sequence) = *(𝒟, a) +(𝒟::Derivative)(a::AbstractSequence) = *(𝒟, a) """ differentiate(a::Sequence, α=1) @@ -179,24 +179,24 @@ function project!(C::LinearOperator, 𝒟::Derivative) end """ - *(ℐ::Integral, a::Sequence) + *(ℐ::Integral, a::AbstractSequence) Compute the `order(ℐ)`-th integral of `a`; equivalent to `integrate(a, order(ℐ))`. -See also: [`(::Integral)(::Sequence)`](@ref), [`Integral`](@ref), +See also: [`(::Integral)(::AbstractSequence)`](@ref), [`Integral`](@ref), [`integrate`](@ref) and [`integrate!`](@ref). """ -Base.:*(ℐ::Integral, a::Sequence) = integrate(a, order(ℐ)) +Base.:*(ℐ::Integral, a::AbstractSequence) = integrate(a, order(ℐ)) """ - (ℐ::Integral)(a::Sequence) + (ℐ::Integral)(a::AbstractSequence) Compute the `order(ℐ)`-th integral of `a`; equivalent to `integrate(a, order(ℐ))`. -See also: [`*(::Integral, ::Sequence)`](@ref), [`Integral`](@ref), +See also: [`*(::Integral, ::AbstractSequence)`](@ref), [`Integral`](@ref), [`integrate`](@ref) and [`integrate!`](@ref). """ -(ℐ::Integral)(a::Sequence) = *(ℐ, a) +(ℐ::Integral)(a::AbstractSequence) = *(ℐ, a) """ integrate(a::Sequence, α=1) @@ -273,9 +273,9 @@ for (F, f) ∈ ((:Derivative, :differentiate), (:Integral, :integrate)) Base.:*(ℱ₁::$F{Int}, ℱ₂::$F{Int}) = $F(order(ℱ₁) + order(ℱ₂)) Base.:*(ℱ₁::$F{NTuple{N,Int}}, ℱ₂::$F{NTuple{N,Int}}) where {N} = $F(map(+, order(ℱ₁), order(ℱ₂))) - Base.:^(ℱ::$F{Int}, n::Int) = $F(order(ℱ) * n) - Base.:^(ℱ::$F{<:Tuple{Vararg{Int}}}, n::Int) = $F(map(αᵢ -> *(αᵢ, n), order(ℱ))) - Base.:^(ℱ::$F{NTuple{N,Int}}, n::NTuple{N,Int}) where {N} = $F(map(*, order(ℱ), n)) + Base.:^(ℱ::$F{Int}, n::Integer) = $F(order(ℱ) * n) + Base.:^(ℱ::$F{<:Tuple{Vararg{Int}}}, n::Integer) = $F(map(αᵢ -> *(αᵢ, n), order(ℱ))) + Base.:^(ℱ::$F{NTuple{N,Int}}, n::NTuple{N,Integer}) where {N} = $F(map(*, order(ℱ), n)) _findposition_nzind_domain(ℱ::$F, domain, codomain) = _findposition(_nzind_domain(ℱ, domain, codomain), domain) diff --git a/src/sequence_spaces/special_operators/evaluation.jl b/src/sequence_spaces/special_operators/evaluation.jl index b55c4069..139d8ddb 100644 --- a/src/sequence_spaces/special_operators/evaluation.jl +++ b/src/sequence_spaces/special_operators/evaluation.jl @@ -38,36 +38,36 @@ Evaluation(value::Union{Number,Nothing}...) = Evaluation(value) value(ℰ::Evaluation) = ℰ.value """ - *(ℰ::Evaluation, a::Sequence) + *(ℰ::Evaluation, a::AbstractSequence) Evaluate `a` at `value(ℰ)`; equivalent to `evaluate(a, value(ℰ))`. -See also: [`(::Evaluation)(::Sequence)`](@ref), [`Evaluation`](@ref), -[`(::Sequence)(::Any, ::Vararg)`](@ref), [`evaluate`](@ref) and [`evaluate!`](@ref). +See also: [`(::Evaluation)(::AbstractSequence)`](@ref), [`Evaluation`](@ref), +[`(::AbstractSequence)(::Any, ::Vararg)`](@ref), [`evaluate`](@ref) and [`evaluate!`](@ref). """ -Base.:*(ℰ::Evaluation, a::Sequence) = evaluate(a, value(ℰ)) +Base.:*(ℰ::Evaluation, a::AbstractSequence) = evaluate(a, value(ℰ)) """ - (ℰ::Evaluation)(a::Sequence) + (ℰ::Evaluation)(a::AbstractSequence) Evaluate `a` at `value(ℰ)`; equivalent to `evaluate(a, value(ℰ))`. -See also: [`*(::Evaluation, ::Sequence)`](@ref), [`Evaluation`](@ref), -[`(::Sequence)(::Any, ::Vararg)`](@ref), [`evaluate`](@ref) and [`evaluate!`](@ref). +See also: [`*(::Evaluation, ::AbstractSequence)`](@ref), [`Evaluation`](@ref), +[`(::AbstractSequence)(::Any, ::Vararg)`](@ref), [`evaluate`](@ref) and [`evaluate!`](@ref). """ -(ℰ::Evaluation)(a::Sequence) = *(ℰ, a) +(ℰ::Evaluation)(a::AbstractSequence) = *(ℰ, a) """ - (a::Sequence)(x, y...) + (a::AbstractSequence)(x, y...) Evaluate `a` at `(x, y...)`; equivalent to `evaluate(a, (x, y...))` or `evaluate(a, x)` if `y` is not provided. See also: [`evaluate`](@ref), [`evaluate!`](@ref), [`Evaluation`](@ref), -[`*(::Evaluation, ::Sequence)`](@ref) and [`(::Evaluation)(::Sequence)`](@ref). +[`*(::Evaluation, ::AbstractSequence)`](@ref) and [`(::Evaluation)(::AbstractSequence)`](@ref). """ -(a::Sequence)(x, y...) = evaluate(a, (x, y...)) -(a::Sequence)(x) = evaluate(a, x) +(a::AbstractSequence)(x, y...) = evaluate(a, (x, y...)) +(a::AbstractSequence)(x) = evaluate(a, x) """ evaluate(a::Sequence, x) diff --git a/src/sequence_spaces/special_operators/multiplication.jl b/src/sequence_spaces/special_operators/multiplication.jl index c882bdd8..405c11ab 100644 --- a/src/sequence_spaces/special_operators/multiplication.jl +++ b/src/sequence_spaces/special_operators/multiplication.jl @@ -50,7 +50,7 @@ and [`^(::Sequence{<:SequenceSpace}, ::Int)`](@ref). Base.:+(ℳ::Multiplication) = Multiplication(+(sequence(ℳ))) Base.:-(ℳ::Multiplication) = Multiplication(-(sequence(ℳ))) -Base.:^(ℳ::Multiplication, n::Int) = Multiplication(sequence(ℳ) ^ n) +Base.:^(ℳ::Multiplication, n::Integer) = Multiplication(sequence(ℳ) ^ n) for f ∈ (:+, :-, :*) @eval begin diff --git a/src/sequence_spaces/special_operators/shift.jl b/src/sequence_spaces/special_operators/shift.jl index 499c1c82..43295a1e 100644 --- a/src/sequence_spaces/special_operators/shift.jl +++ b/src/sequence_spaces/special_operators/shift.jl @@ -39,29 +39,29 @@ value(𝒮::Shift) = 𝒮.value Base.:*(𝒮₁::Shift{<:Number}, 𝒮₂::Shift{<:Number}) = Shift(value(𝒮₁) + value(𝒮₂)) Base.:*(𝒮₁::Shift{<:NTuple{N,Number}}, 𝒮₂::Shift{<:NTuple{N,Number}}) where {N} = Shift(map(+, value(𝒮₁), value(𝒮₂))) -Base.:^(𝒮::Shift{<:Number}, n::Int) = Shift(value(𝒮) * n) -Base.:^(𝒮::Shift{<:Tuple{Vararg{Number}}}, n::Int) = Shift(map(τᵢ -> *(τᵢ, n), value(𝒮))) -Base.:^(𝒮::Shift{<:NTuple{N,Number}}, n::NTuple{N,Int}) where {N} = Shift(map(*, value(𝒮), n)) +Base.:^(𝒮::Shift{<:Number}, n::Integer) = Shift(value(𝒮) * n) +Base.:^(𝒮::Shift{<:Tuple{Vararg{Number}}}, n::Integer) = Shift(map(τᵢ -> *(τᵢ, n), value(𝒮))) +Base.:^(𝒮::Shift{<:NTuple{N,Number}}, n::NTuple{N,Integer}) where {N} = Shift(map(*, value(𝒮), n)) """ - *(𝒮::Shift, a::Sequence) + *(𝒮::Shift, a::AbstractSequence) Shift `a` by `value(𝒮)`; equivalent to `shift(a, value(𝒮))`. -See also: [`(::Shift)(::Sequence)`](@ref), [`Shift`](@ref), [`shift`](@ref) and +See also: [`(::Shift)(::AbstractSequence)`](@ref), [`Shift`](@ref), [`shift`](@ref) and [`shift!`](@ref). """ -Base.:*(𝒮::Shift, a::Sequence) = shift(a, value(𝒮)) +Base.:*(𝒮::Shift, a::AbstractSequence) = shift(a, value(𝒮)) """ - (𝒮::Shift)(a::Sequence) + (𝒮::Shift)(a::AbstractSequence) Shift `a` by `value(𝒮)`; equivalent to `shift(a, value(𝒮))`. -See also: [`*(::Shift, ::Sequence)`](@ref), [`Shift`](@ref), [`shift`](@ref) and +See also: [`*(::Shift, ::AbstractSequence)`](@ref), [`Shift`](@ref), [`shift`](@ref) and [`shift!`](@ref). """ -(𝒮::Shift)(a::Sequence) = *(𝒮, a) +(𝒮::Shift)(a::AbstractSequence) = *(𝒮, a) """ shift(a::Sequence, τ)