tarithmetic: Tropical arithmetic

Description Usage Arguments Value Examples

Description

Tropical arithmetic

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x %+% y

x %.% y

x %..% y

x %^% y

set_plus_min(message = TRUE)

set_plus_max(message = TRUE)

get_plus_type()

Arguments

x, y

a numeric data structure (vector/matrix/array)

message

issue messages to user? (default: TRUE)

Value

.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## basic usage - trop. add.
##############################

get_plus_type()

1 %+% 5
1:3 %+% 3:1
(m1 <- matrix(1:4, 2))
(m2 <- matrix(4:1, 2))
m1 %+% m2

set_plus_max()
get_plus_type()

1 %+% 5
1:3 %+% 3:1
m1 %+% m2

set_plus_min()
get_plus_type()



## basic usage - trop. mult.
##############################

1 %.% 5
1:3 %.% 5:7
(m1 <- matrix(1:4, 2))
(m2 <- matrix(4:1, 2))
m1 %.% m2



## basic usage - trop. mat. mult.
##############################

1:3 %..% 5:7
(m1 <- matrix(1:4, 2))
(m2 <- matrix(4:1, 2))
m1 %..% m2

(m1 <- matrix(1:6, 2, 3))
(m2 <- matrix(6:1, 3, 2))
m1 %..% m2

set_plus_max()
m1 %..% m2


## basic usage - trop. exp.
##############################
5 %^% 3
(1:3) %^% (4:6)
# 5 %^% 0   # for unit test
# 5 %^% 2.5 # for unit test

dkahle/tropical documentation built on May 21, 2019, 7:57 a.m.