Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 2.77 KB

README.md

File metadata and controls

55 lines (39 loc) · 2.77 KB

TropicalNumbers

This package implements tropical numbers and tropical algebras in Julia. Tropical algebra is also known as the semiring algebra, which is a set $R$ equipped with two binary operations $\oplus$ and $\otimes$, called addition and multiplication, such that:

  • $(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.

Build Status Codecov

Installation

To install this package, press ] in Julia REPL to enter package mode, then type

pkg> add TropicalNumbers

Using

A Topical algebra can be described as a tuple $(R, \oplus, \otimes, \mathbb{0}, \mathbb{1})$, where $R$ is the set, $\oplus$ and $\otimes$ are the opeartions and $\mathbb{0}$, $\mathbb{1}$ are their identity element, respectively. In this package, the following tropical algebras are implemented:

  • 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

  1. TropicalMaxPlus is an alias of Tropical.
  2. 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.

Why another tropical number?

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.

Ecosystem