Skip to content

Commit 774559e

Browse files
author
Miha Zgubic
committed
implement -Tangent
1 parent 991ca66 commit 774559e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/tangent_arithmetic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ end
144144
Base.:+(a::Dict, d::Tangent{P}) where {P} = merge(+, a, backing(d))
145145
Base.:+(a::Tangent{P}, b::P) where {P} = b + a
146146

147+
Base.:-(tangent::Tangent{P}) where {P} = map(x -> -x, tangent)
148+
147149
# We intentionally do not define, `Base.*(::Tangent, ::Tangent)` as that is not meaningful
148150
# In general one doesn't have to represent multiplications of 2 differentials
149151
# Only of a differential and a scaling factor (generally `Real`)

0 commit comments

Comments
 (0)