File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 191
191
# understands, including a mix of Zeros & reals. Other cases, we just let through:
192
192
(project:: ProjectTo{<:Number} )(dx:: Tangent{<:Complex} ) = project (Complex (dx. re, dx. im))
193
193
(:: ProjectTo{<:Number} )(dx:: Tangent{<:Number} ) = dx
194
+ (:: ProjectTo{T} )(:: ZeroTangent ) where T <: Real = zero (T)
194
195
195
196
# Arrays
196
197
# If we don't have a more specialized `ProjectTo` rule, we just assume that there is
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ struct NoSuperType end
37
37
@test ProjectTo (1.0 )(2 ) === 2.0
38
38
39
39
# Tangents
40
- ProjectTo ( 1.0f0 + 2im )( Tangent {ComplexF64} (; re= 1 , im= NoTangent ())) ===
41
- 1.0f0 + 0.0f0im
42
-
43
- @test 1.0 === ProjectTo (1.0 )(Tangent {ComplexF64} (; re = 1 , im = NoTangent ()))
40
+ complex_tangent = Tangent {ComplexF64} (; re= 1 , im= NoTangent ())
41
+ @test ProjectTo ( 1.0f0 + 2im )(complex_tangent) === 1.0f0 + 0.0f0im
42
+ @test ProjectTo ( 1.0 )(complex_tangent) === 1.0
43
+ @test ProjectTo (1.0 )(ZeroTangent ()) === 0.0
44
44
end
45
45
46
46
@testset " Dual" begin # some weird Real subtype that we should basically leave alone
You can’t perform that action at this time.
0 commit comments