Skip to content

Commit 7152e23

Browse files
author
Pepijn de Vos
committed
add truncate for explicit tangent
1 parent 3b4e59f commit 7152e23

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tangent.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ function truncate(tb::TangentBundle, order::Val)
242242
_TangentBundle(order, tb.primal, truncate(tb.tangent, order))
243243
end
244244

245+
function truncate(tb::ExplicitTangent, order::Val{N}) where {N}
246+
ExplicitTangent(tb.partials[1:2^(N-1)])
247+
end
248+
249+
function truncate(et::ExplicitTangent, order::Val{1})
250+
TaylorTangent(et.partials[1:1])
251+
end
252+
245253
const UniformBundle{N, B, U} = TangentBundle{N, B, UniformTangent{U}}
246254
UniformBundle{N, B, U}(primal::B, partial::U) where {N,B,U} = _TangentBundle(Val{N}(), primal, UniformTangent{U}(partial))
247255
UniformBundle{N, B, U}(primal::B) where {N,B,U} = _TangentBundle(Val{N}(), primal, UniformTangent{U}(U.instance))

0 commit comments

Comments
 (0)