Skip to content

Commit f0733c4

Browse files
committed
typemin function, fix tagbot
1 parent 98ab399 commit f0733c4

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

.github/workflows/TagBot.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: TagBot
22
on:
3-
schedule:
4-
- cron: 0 * * * *
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
57
jobs:
68
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
710
runs-on: ubuntu-latest
811
steps:
912
- uses: JuliaRegistries/TagBot@v1
1013
with:
1114
token: ${{ secrets.GITHUB_TOKEN }}
15+
ssh: ${{ secrets.DOCUMENTER_KEY }}

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TropicalNumbers"
22
uuid = "b3a74e9c-7526-4576-a4eb-79c0d4c32334"
33
authors = ["GiggleLiu"]
4-
version = "0.5.3"
4+
version = "0.5.4"
55

66
[compat]
77
julia = "1"

src/counting_tropical.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ end
4949
# inverse and division
5050
Base.inv(x::CountingTropical) = CountingTropical(-x.n, x.c)
5151

52+
Base.typemin(::Type{CountingTropical{T,CT}}) where {T<:AbstractFloat,CT} = CountingTropical(typemin(T), zero(CT))
5253
Base.zero(::Type{CountingTropical{T}}) where T = zero(CountingTropical{T,T})
5354
Base.zero(::Type{CountingTropical{T,CT}}) where {T<:Integer,CT} = CountingTropical(T(-999999), zero(CT))
54-
Base.zero(::Type{CountingTropical{T,CT}}) where {T<:AbstractFloat,CT} = CountingTropical(typemin(T), zero(CT))
55+
Base.zero(::Type{CountingTropical{T,CT}}) where {T<:AbstractFloat,CT} = typemin(CountingTropical{T, CT})
5556
Base.zero(::T) where T<:CountingTropical = zero(T)
5657
Base.one(::Type{CountingTropical{T}}) where T = one(CountingTropical{T,T})
5758
Base.one(::Type{CountingTropical{T,CT}}) where {T<:Integer,CT} = CountingTropical(zero(T), one(CT))

src/tropical.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ neginf(::Type{Int8}) = Int8(-64)
1212
1313
[Tropical number](https://en.wikipedia.org/wiki/Tropical_geometry) is a semiring algebra that maps
1414
15-
* `+` in regular algebra to `max`,
16-
* `*` in regular algebra to `+`,
17-
* `1` in regular algebra to `0`,
18-
* `0` in regular algebra to `-Inf` (for integer content types, this is chosen as a mall integer).
15+
* `+` to `max` in regular algebra,
16+
* `*` to `+` in regular algebra,
17+
* `1` to `0` in regular algebra,
18+
* `0` to `-Inf` in regular algebra (for integer content types, this is chosen as a mall integer).
1919
2020
We implemented fast tropical matrix multiplication in [`TropicalGEMM`](https://github.com/TensorBFS/TropicalGEMM.jl/).
2121
@@ -64,7 +64,8 @@ function Base.:*(a::Tropical{<:Rational}, b::Tropical{<:Rational})
6464
end
6565
end
6666
Base.:+(a::Tropical, b::Tropical) = Tropical(max(a.n, b.n))
67-
Base.zero(::Type{Tropical{T}}) where T = Tropical(neginf(T))
67+
Base.typemin(::Type{Tropical{T}}) where T = Tropical(typemin(T))
68+
Base.zero(::Type{Tropical{T}}) where T = typemin(Tropical{T})
6869
Base.zero(::Tropical{T}) where T = zero(Tropical{T})
6970

7071
Base.one(::Type{Tropical{T}}) where T = Tropical(zero(T))

0 commit comments

Comments
 (0)