@@ -232,16 +232,33 @@ end
232232continuous derivative at the second-to-last cell boundary; this means
233233`y_1'''(2) = y_2'''(2)`, yielding
234234
235- 1 cm -3 c + 3 cp -1 cpp = 0
236- """
237- function prefiltering_system (:: Type{T} , :: Type{TC} , n:: Int ,
238- degree:: Cubic{<:Free} ) where {T,TC}
239- dl, d, du = inner_system_diags (T,n,degree)
240235
241- specs = WoodburyMatrices. sparse_factors (T, n,
242- (1 , n, du[1 ]),
243- (n, 1 , dl[end ])
244- )
236+ -1 cm + 4 c - 6 cp + 4 cpp - 1 cppp = 0
245237
246- Woodbury (lut! (dl, d, du), specs... ), zeros (TC, n)
238+ This enforces continuity of the third derivative, which is appropriate for cubic splines
239+ (in contrast to the quadratic case which enforces continuity of the second derivative).
240+
241+ """
242+ function prefiltering_system (
243+ :: Type{T} ,
244+ :: Type{TC} ,
245+ n:: Int ,
246+ degree:: Cubic{<:Free} ,
247+ ) where {T,TC}
248+ dl, d, du = inner_system_diags (T, n, degree)
249+ d[1 ] = d[end ] = - 1
250+ du[1 ] = dl[end ] = 4
251+
252+ specs = WoodburyMatrices. sparse_factors (
253+ T,
254+ n,
255+ (1 , 3 , - 6 ),
256+ (1 , 4 , 4 ),
257+ (1 , 5 , - 1 ),
258+ (n, n - 2 , - 6 ),
259+ (n, n - 3 , 4 ),
260+ (n, n - 4 , - 1 ),
261+ )
262+
263+ return Woodbury (lut! (dl, d, du), specs... ), zeros (TC, n)
247264end
0 commit comments