Skip to content

Commit cab4975

Browse files
author
Tomas Lycken
committed
Squash a few bugs
1 parent c3e4475 commit cab4975

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

src/b-splines/cubic.jl

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ condition gives:
205205
"""
206206
function prefiltering_system{T,TC}(::Type{T}, ::Type{TC}, n::Int,
207207
::Type{Cubic{Line}}, ::Type{OnCell})
208-
dl,d,du = inner_system_diags(T,n,Cubic{Flat})
208+
dl,d,du = inner_system_diags(T,n,Cubic{Line})
209209
d[1] = d[end] = 3
210210
du[1] = dl[end] = -7
211211

@@ -231,18 +231,29 @@ condition gives:
231231
This is the same system as `Quadratic{Line}`, `OnGrid` so we reuse the
232232
implementation
233233
"""
234-
function prefiltering_system{T,TC,GT<:GridType}(::Type{T}, ::Type{TC}, n::Int,
235-
::Type{Cubic{Line}}, ::Type{GT})
236-
prefiltering_system(T, TC, n, Quadratic{Line}, OnGrid)
234+
function prefiltering_system{T,TC}(::Type{T}, ::Type{TC}, n::Int,
235+
::Type{Cubic{Line}}, ::Type{OnGrid})
236+
dl,d,du = inner_system_diags(T,n,Cubic{Line})
237+
d[1] = d[end] = 1
238+
du[1] = dl[end] = -2
239+
240+
# now need Woodbury correction to set :
241+
# - [1, 3] and [n, n-2] ==> 1
242+
specs = _build_woodbury_specs(T, n,
243+
(1, 3, one(T)),
244+
(n, n-2, one(T)),
245+
)
246+
247+
Woodbury(lufact!(Tridiagonal(dl, d, du), Val{false}), specs...), zeros(TC, n)
237248
end
238249

239250
function prefiltering_system{T,TC,GT<:GridType}(::Type{T}, ::Type{TC}, n::Int,
240251
::Type{Cubic{Periodic}}, ::Type{GT})
241252
dl, d, du = inner_system_diags(T,n,Cubic{Periodic})
242253

243254
specs = _build_woodbury_specs(T, n,
244-
(1, n, SimpleRatio(1, 6)),
245-
(n, 1, SimpleRatio(1, 6))
255+
(1, n, du[1]),
256+
(n, 1, dl[end])
246257
)
247258

248259
Woodbury(lufact!(Tridiagonal(dl, d, du), Val{false}), specs...), zeros(TC, n)
@@ -260,5 +271,12 @@ This is the same system as `Quadratic{Free}` so we reuse the implementation
260271
"""
261272
function prefiltering_system{T,TC,GT<:GridType}(::Type{T}, ::Type{TC}, n::Int,
262273
::Type{Cubic{Free}}, ::Type{GT})
263-
prefiltering_system(T, TC, n, Quadratic{Free}, GT)
274+
dl, d, du = inner_system_diags(T,n,Cubic{Periodic})
275+
276+
specs = _build_woodbury_specs(T, n,
277+
(1, n, du[1]),
278+
(n, 1, dl[end])
279+
)
280+
281+
Woodbury(lufact!(Tridiagonal(dl, d, du), Val{false}), rowspec, valspec, colspec), zeros(TC, n)
264282
end

0 commit comments

Comments
 (0)