From d85785ebd2e2d4fc9ba2e4b28761180028aa5d0a Mon Sep 17 00:00:00 2001 From: OlivierHnt <38465572+OlivierHnt@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:15:18 -0400 Subject: [PATCH] Remove Hermite --- .../special_operators/calculus.jl | 168 ------------------ 1 file changed, 168 deletions(-) diff --git a/src/sequence_spaces/special_operators/calculus.jl b/src/sequence_spaces/special_operators/calculus.jl index 687ab6d..367259c 100644 --- a/src/sequence_spaces/special_operators/calculus.jl +++ b/src/sequence_spaces/special_operators/calculus.jl @@ -1193,174 +1193,6 @@ function _nzval(โ„::Integral, ::Chebyshev, ::Chebyshev, ::Type{T}, i, j) where end end -# Hermite - -image(๐’Ÿ::Derivative, s::Hermite) = Hermite(order(s)+order(๐’Ÿ)) - -_coeftype(::Derivative, ::Hermite, ::Type{T}) where {T} = float(T) - -function _apply!(c::Sequence{Hermite}, ๐’Ÿ::Derivative, a) - n = order(๐’Ÿ) - if n == 0 - coefficients(c) .= coefficients(a) - elseif n == 1 - real_CoefType = real(eltype(c)) - order_a = order(a) - if order_a โ‰ฅ 1 - @inbounds c[0] = - sqrt(convert(real_CoefType, ExactReal(1)) / ExactReal(2)) * a[1] - end - @inbounds for i โˆˆ 1:order_a+1 - c[i] = sqrt(convert(real_CoefType, ExactReal(i)) / ExactReal(2)) * a[i-1] - if i+1 โ‰ค order_a - c[i] -= sqrt(convert(real_CoefType, ExactReal(i+1)) / ExactReal(2)) * a[i+1] - end - end - else # TODO: lift restriction - return throw(DomainError) - end - return c -end - -function _apply!(C::AbstractArray{T}, ๐’Ÿ::Derivative, space::Hermite, A) where {T} - n = order(๐’Ÿ) - if n == 0 - C .= A - elseif n == 1 - real_T = real(T) - ord = order(space) - if ord โ‰ฅ 1 - @inbounds selectdim(C, 1, 1) .= (-sqrt(convert(real_T, ExactReal(1)) / ExactReal(2))) .* selectdim(A, 1, i+1) - end - @inbounds for i โˆˆ 1:ord+1 - Cแตข = selectdim(C, 1, i+1) - Cแตข .= (sqrt(convert(real_T, ExactReal(i)) / ExactReal(2))) .* selectdim(A, 1, i) - if i+1 โ‰ค ord - Cแตข .-= (sqrt(convert(real_T, ExactReal(i+1)) / ExactReal(2))) .* selectdim(A, 1, i+2) - end - end - else # TODO: lift restriction - return throw(DomainError) - end - return C -end - -function _apply(๐’Ÿ::Derivative, space::Hermite, ::Val{D}, A::AbstractArray{T,N}) where {D,T,N} - n = order(๐’Ÿ) - CoefType = _coeftype(๐’Ÿ, space, T) - if n == 0 - return convert(Array{CoefType,N}, A) - elseif n == 1 - real_CoefType = real(CoefType) - ord = order(space) - C = zeros(CoefType, ntuple(i -> i == D ? ord : size(A, i), Val(N))) - if ord โ‰ฅ 1 - @inbounds selectdim(C, D, 1) .= (-sqrt(convert(real_CoefType, ExactReal(1)) / ExactReal(2))) .* selectdim(A, D, i+1) - end - @inbounds for i โˆˆ 1:ord+1 - Cแตข = selectdim(C, D, i+1) - Cแตข .= (sqrt(convert(real_CoefType, ExactReal(i)) / ExactReal(2))) .* selectdim(A, D, i) - if i+1 โ‰ค ord - Cแตข .-= (sqrt(convert(real_CoefType, ExactReal(i+1)) / ExactReal(2))) .* selectdim(A, D, i+2) - end - end - return C - else # TODO: lift restriction - return throw(DomainError) - end -end - -function _nzind_domain(๐’Ÿ::Derivative, domain::Hermite, codomain::Hermite) - if order(๐’Ÿ) == 0 - return collect(0:min(order(domain), order(codomain))) - elseif order(๐’Ÿ) == 1 - len = 0 - for j โˆˆ 0:order(domain) - if j == 0 - len += 1 โ‰ค order(codomain) - else - len += (0 + (j+1 โ‰ค order(codomain))) + (j-1 โ‰ค order(codomain)) - end - end - v = Vector{Int}(undef, len) - idx = 1 - for j โˆˆ 0:order(domain) - if j == 0 - if j+1 โ‰ค order(codomain) - v[1] = 0 - idx += 1 - end - else - idx2 = (idx-1 + (j+1 โ‰ค order(codomain))) + (j-1 โ‰ค order(codomain)) - view(v, idx:idx2) .= j - idx = idx2 + 1 - end - end - return v - else # TODO: lift restriction - return throw(DomainError) - end -end - -function _nzind_codomain(๐’Ÿ::Derivative, domain::Hermite, codomain::Hermite) - if order(๐’Ÿ) == 0 - return collect(0:min(order(domain), order(codomain))) - elseif order(๐’Ÿ) == 1 - len = 0 - for j โˆˆ 0:order(domain) - if j == 0 - len += 1 โ‰ค order(codomain) - else - len += (0 + (j+1 โ‰ค order(codomain))) + (j-1 โ‰ค order(codomain)) - end - end - v = Vector{Int}(undef, len) - idx = 1 - for j โˆˆ 0:order(domain) - if j == 0 - if 1 โ‰ค order(codomain) - v[idx] = 1 - idx += 1 - end - else - if j+1 โ‰ค order(codomain) - v[idx] = j-1 - v[idx+1] = j+1 - idx += 2 - elseif j-1 โ‰ค order(codomain) - v[idx] = j-1 - idx += 1 - end - end - end - return v - else # TODO: lift restriction - return throw(DomainError) - end -end - -function _nzval(๐’Ÿ::Derivative, ::Hermite, ::Hermite, ::Type{T}, i, j) where {T} - n = order(๐’Ÿ) - if n == 0 - return one(T) - elseif n == 1 - if i == 0 - if j == 1 - return convert(T, -sqrt(convert(real(T), ExactReal(1)) / ExactReal(2))) - else - return zero(T) - end - else - if i+1 == j - return convert(T, -sqrt(convert(real(T), ExactReal(i+1)) / ExactReal(2))) - else # i == j+1 - return convert(T, sqrt(convert(real(T), ExactReal(i)) / ExactReal(2))) - end - end - else # TODO: lift restriction - return throw(DomainError) - end -end - # Cartesian spaces for F โˆˆ (:Derivative, :Integral)