Skip to content

Commit 3be059c

Browse files
authored
tests for derivative in normalized spaces (#174)
* tests for derivative in normalized spaces * remove unnecessary type assertions
1 parent 416b8cf commit 3be059c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/Operators/general/algebra.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ for TYP in (:Matrix, :BandedMatrix, :RaggedMatrix)
399399
# for large k its upper triangular
400400
RT = $TYP{T}
401401
RT2 = _rettype(RT)
402-
BA::RT2 = strictconvert(RT, P.ops[end][krl[end,1]:krl[end,2],jr])::RT
402+
BA::RT2 = strictconvert(RT, P.ops[end][krl[end,1]:krl[end,2],jr])
403403
for m = (length(P.ops)-1):-1:1
404-
BA = strictconvert(RT, P.ops[m][krl[m,1]:krl[m,2],krl[m+1,1]:krl[m+1,2]])::RT * BA
404+
BA = strictconvert(RT, P.ops[m][krl[m,1]:krl[m,2],krl[m+1,1]:krl[m+1,2]]) * BA
405405
end
406406

407407
RT(BA)::RT2

test/SpacesTest.jl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,16 @@ using BandedMatrices: rowrange, colrange
343343
for d in Any[(), (0..1,)]
344344
for ST in Any[Chebyshev, Legendre,
345345
(x...) -> Jacobi(2,2,x...), (x...) -> Jacobi(1.5,2.5,x...)]
346-
S = ST(d...)
347-
@test Derivative(S) == Derivative(S,1)
348-
@test Derivative(S)^2 == Derivative(S,2)
349-
f = Fun(x->x^3, S)
350-
@test Derivative(S) * f Fun(x->3x^2, S)
351-
@test Derivative(S,2) * f Fun(x->6x, S)
352-
@test Derivative(S,3) * f Fun(x->6, S)
353-
@test Derivative(S,4) * f zeros(S)
346+
S1 = ST(d...)
347+
for S in [S1, NormalizedPolynomialSpace(S1)]
348+
@test Derivative(S) == Derivative(S,1)
349+
@test Derivative(S)^2 == Derivative(S,2)
350+
f = Fun(x->x^3, S)
351+
@test Derivative(S) * f Fun(x->3x^2, S)
352+
@test Derivative(S,2) * f Fun(x->6x, S)
353+
@test Derivative(S,3) * f Fun(x->6, S)
354+
@test Derivative(S,4) * f zeros(S)
355+
end
354356
end
355357
end
356358
@test Derivative(Chebyshev()) != Derivative(Chebyshev(), 2)

0 commit comments

Comments
 (0)