Skip to content

Commit 9430a07

Browse files
authored
Add diff (#136)
* Add diff * Update test_splines.jl * Update test_splines.jl * Update test_splines.jl
1 parent 9d02e92 commit 9430a07

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/operators.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ function diff(d::AbstractQuasiVector)
125125
Derivative(x)*d
126126
end
127127

128+
function diff(A::AbstractQuasiArray; dims::Integer)
129+
if dims == 1
130+
Derivative(axes(A,1)) * A
131+
else
132+
error("Not implemented")
133+
end
134+
end
135+
128136
^(D::Derivative, k::Integer) = ApplyQuasiArray(^, D, k)
129137

130138

test/test_splines.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ import ContinuumArrays: basis, AdjointBasisLayout, ExpansionLayout, BasisLayout,
158158
@test D*L isa MulQuasiMatrix
159159
@test length((D*L).args) == 2
160160
@test eltype(D*L) == Float64
161+
@test typeof(diff(L; dims=1)) == typeof(D*L)
162+
@test_throws ErrorException diff(L; dims=2)
161163

162164
M = applied(*, (D*L).args..., [1,2,4])
163165
@test eltype(materialize(M)) == Float64

0 commit comments

Comments
 (0)