-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
for fn in union(ops_1_to_1_s, ops_1_to_1_f, ops_1_to_1_z) | ||
@eval Base.$fn(t::Tracer) = t | ||
@eval Base.$fn(t::ConnectivityTracer) = t | ||
end | ||
|
||
for fn in ops_1_to_1_const | ||
@eval Base.$fn(::Tracer) = EMPTY_TRACER | ||
@eval Base.$fn(::ConnectivityTracer) = EMPTY_CONNECTIVITY_TRACER | ||
end | ||
|
||
for fn in ops_1_to_2 | ||
@eval Base.$fn(t::Tracer) = (t, t) | ||
@eval Base.$fn(t::ConnectivityTracer) = (t, t) | ||
end | ||
|
||
for fn in ops_2_to_1 | ||
@eval Base.$fn(a::Tracer, b::Tracer) = uniontracer(a, b) | ||
@eval Base.$fn(t::Tracer, ::Number) = t | ||
@eval Base.$fn(::Number, t::Tracer) = t | ||
@eval Base.$fn(a::ConnectivityTracer, b::ConnectivityTracer) = uniontracer(a, b) | ||
@eval Base.$fn(t::ConnectivityTracer, ::Number) = t | ||
@eval Base.$fn(::Number, t::ConnectivityTracer) = t | ||
end | ||
|
||
# Extra types required for exponent | ||
Base.:^(a::Tracer, b::Tracer) = uniontracer(a, b) | ||
Base.:^(a::ConnectivityTracer, b::ConnectivityTracer) = uniontracer(a, b) | ||
for T in (:Real, :Integer, :Rational) | ||
@eval Base.:^(t::Tracer, ::$T) = t | ||
@eval Base.:^(::$T, t::Tracer) = t | ||
@eval Base.:^(t::ConnectivityTracer, ::$T) = t | ||
@eval Base.:^(::$T, t::ConnectivityTracer) = t | ||
end | ||
Base.:^(t::Tracer, ::Irrational{:ℯ}) = t | ||
Base.:^(::Irrational{:ℯ}, t::Tracer) = t | ||
Base.:^(t::ConnectivityTracer, ::Irrational{:ℯ}) = t | ||
Base.:^(::Irrational{:ℯ}, t::ConnectivityTracer) = t | ||
|
||
## Rounding | ||
Base.round(t::Tracer, ::RoundingMode; kwargs...) = t | ||
Base.round(t::ConnectivityTracer, ::RoundingMode; kwargs...) = t | ||
|
||
## Random numbers | ||
rand(::AbstractRNG, ::SamplerType{Tracer}) = EMPTY_TRACER | ||
rand(::AbstractRNG, ::SamplerType{ConnectivityTracer}) = EMPTY_CONNECTIVITY_TRACER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters