Skip to content

Commit 9fcbd0c

Browse files
authored
Merge pull request #291 from topolarity/ct/inline-partial-primal
stage1: Mark `partial` and `primal` helpers as `@inline`
2 parents d0b3e3e + b883867 commit 9fcbd0c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/stage1/forward.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
partial(x::TangentBundle, i) = partial(getfield(x, :tangent), i)
2-
partial(x::ExplicitTangent, i) = getfield(getfield(x, :partials), i)
3-
partial(x::TaylorTangent, i) = getfield(getfield(x, :coeffs), i)
4-
partial(x::UniformTangent, i) = getfield(x, :val)
5-
partial(x::AbstractZero, i) = x
1+
@inline partial(x::TangentBundle, i) = partial(getfield(x, :tangent), i)
2+
@inline partial(x::ExplicitTangent, i) = getfield(getfield(x, :partials), i)
3+
@inline partial(x::TaylorTangent, i) = getfield(getfield(x, :coeffs), i)
4+
@inline partial(x::UniformTangent, i) = getfield(x, :val)
5+
@inline partial(x::AbstractZero, i) = x
66

77

8-
primal(x::AbstractTangentBundle) = x.primal
9-
primal(z::ZeroTangent) = ZeroTangent()
8+
@inline primal(x::AbstractTangentBundle) = x.primal
9+
@inline primal(z::ZeroTangent) = ZeroTangent()
1010

11-
first_partial(x) = partial(x, 1)
11+
@inline first_partial(x) = partial(x, 1)
1212

1313
shuffle_down(b::UniformBundle{N, B, U}) where {N, B, U} =
1414
UniformBundle{N-1}(UniformBundle{1, B}(b.primal, b.tangent.val),

0 commit comments

Comments
 (0)