This package implements tropical numbers and tropical algebras in Julia. Tropical algebra is also known as the semiring algebra, which is a set
-
$(R, \oplus)$ is a monoid with identity element called$\mathbb{0}$ ; -
$(R, \otimes)$ is a monoid with identity element called$\mathbb{1}$ ; - Addition is commutative;
- Multiplication by the additive identity
$\mathbb{0}$ annihilates ; - Multiplication left- and right-distributes over addition;
- Explicitly stated,
$(R, \oplus)$ is a commutative monoid.
To install this package, press ]
in Julia REPL to enter package mode, then type
pkg> add TropicalNumbers
A Topical algebra can be described as a tuple
-
TropicalAndOr
:$([T, F], \lor, \land, F, T)$ ; -
Tropical
(TropicalMaxPlus
):$(\mathbb{R}, \max, +, -\infty, 0)$ ; -
TropicalMinPlus
:$(\mathbb{R}, \min, +, \infty, 0)$ ; -
TropicalMaxMul
:$(\mathbb{R}^+, \max, \times, 0, 1)$ .
julia> using TropicalNumbers
julia> Tropical(3) * Tropical(4)
Tropical(7)
julia> TropicalMaxMul(3) * TropicalMaxMul(4)
TropicalMaxMul(12)
Warnings
TropicalMaxPlus
is an alias ofTropical
.TropicalMaxMul
should not contain negative numbers. However, this package does not check the data validity. Not only for performance reason, but also for future GPU support.
Related packages include
These packages include unnecessary fields in its tropical numbers, such as isinf
. However, Inf
and -Inf
can be used directly for floating point numbers, which is more memory efficient and computationally cheap. TropicalNumbers
is designed for high performance matrix multiplication on both CPU and GPU.
- TropicalGEMM.jl: The BLAS package for tropical numbers.
- CuTropicalGEMM.jl, The GPU version of TropicalGEMM.