Semirings.jl

Author FAST-ASR
Popularity
10 Stars
Updated Last
1 Year Ago
Started In
April 2021

Semirings.jl

A julia package providing implementation of common semirings.

This package is largely inspired from JuliaComputing/SemiringAlgebra and mcognetta/Semirings.jl.

Test

Installation

The package can be installed with the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add Semirings

Example

Here is a brief example:

julia> using Semirings

julia> a = TropicalSemiring{Float64}(3)
3.0

julia> TropicalSemiring{Float64}(5)
5.0

julia> a + b
5.0

julia> a * b
8.0

julia> x = ones(LogSemiring{Float64}, 2, 2)
2×2 Matrix{LogSemiring{Float64}}:
 0.0  0.0
 0.0  0.0

julia> x * x
2×2 Matrix{LogSemiring{Float64}}:
 0.693147  0.693147
 0.693147  0.693147

julia> x + x
2×2 Matrix{LogSemiring{Float64}}:
 0.693147  0.693147
 0.693147  0.693147

Author

Lucas Ondel (website)

Required Packages

No packages found.

Used By Packages