Skip to content

Commit 7d8782a

Browse files
authored
Derivative in normalized polynomial spaces (#198)
* derivative in normalized polynomial spaces * Tests for inference
1 parent b6f73f1 commit 7d8782a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Spaces/PolynomialSpace.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,3 +571,11 @@ function Multiplication(f::Fun{<:NormalizedPolynomialSpace}, sp::NormalizedPolyn
571571
fc = ConcreteConversion(space(f), canonicalspace(f))*f
572572
Multiplication(fc, sp)
573573
end
574+
575+
function Derivative(sp::NormalizedPolynomialSpace, k::Number)
576+
assert_integer(k)
577+
csp=canonicalspace(sp)
578+
D = Derivative(csp,k)
579+
C = ConcreteConversion(sp,csp)
580+
DerivativeWrapper(TimesOperator(D, C), sp, k)
581+
end

test/JacobiTest.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,12 @@ using Static
226226
# only one band should be populated
227227
@test bandwidths(D, 1) == -bandwidths(D, 2)
228228

229-
@test !isdiag(Derivative(Legendre()))
230-
@test !isdiag(Derivative(NormalizedLegendre()))
229+
@test !isdiag(@inferred Derivative(Legendre()))
230+
T1 = typeof(Derivative(Legendre()))
231+
T2 = typeof(Derivative(Legendre(), 2))
232+
@test !isdiag(@inferred Union{T1,T2} Derivative(Legendre()))
233+
@test !isdiag(@inferred Derivative(NormalizedLegendre()))
234+
@test !isdiag(@inferred Derivative(NormalizedLegendre(), 2))
231235

232236
@testset for d in [-1..1, 0..1]
233237
f = Fun(x->x^2, Chebyshev(d))

0 commit comments

Comments
 (0)