File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 191191# understands, including a mix of Zeros & reals. Other cases, we just let through:
192192(project:: ProjectTo{<:Number} )(dx:: Tangent{<:Complex} ) = project (Complex (dx. re, dx. im))
193193(:: ProjectTo{<:Number} )(dx:: Tangent{<:Number} ) = dx
194+ (:: ProjectTo{T} )(:: ZeroTangent ) where T <: Real = zero (T)
194195
195196# Arrays
196197# 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
3737 @test ProjectTo (1.0 )(2 ) === 2.0
3838
3939 # 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
4444 end
4545
4646 @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