<< maxplusmcm Max-Plus Algebra maxplusotimes >>

Max-Plus Algebra >> Max-Plus Algebra > maxplusoplus

maxplusoplus

Max-plus algebra addition

Calling Sequence

[X] = maxplusoplus(A,B)

Parameters

A
: an input matrix with appropriate size
B
: an input matrix with appropriate size
X
: output matrix

Description

This function returns Xi,j= ai,j⊕bi,j = max {ai,j, bi,j}.

Examples

A = sprand(5,5,0.3);
B = sprand(5,5,0.6);
k = find(A == 0);
l = find(B == 0);
A(k) = -%inf;
B(l) = -%inf;
A = round(10*A);
B = round(10*B);
A = full(A)
A  =

 -Inf  -Inf  -Inf  -Inf  -Inf
   9.  -Inf  -Inf  -Inf  -Inf
 -Inf  -Inf  -Inf  -Inf    7.
 -Inf  -Inf  -Inf  -Inf  -Inf
   1.    6.  -Inf  -Inf  -Inf

B = full(B)
B  =

   7.    2.    7.    2.  -Inf
 -Inf  -Inf  -Inf    3.    3.
   2.    2.    3.  -Inf  -Inf
   5.    9.  -Inf  -Inf    6.
   2.  -Inf    9.    4.    5.

X = maxplusoplus(A,B)
X  =

   7.    2.    7.    2.  -Inf
   9.  -Inf  -Inf    3.    3.
   2.    2.    3.  -Inf    7.
   5.    9.  -Inf  -Inf    6.
   2.    6.    9.    4.    5.

Author

"Max-Plus Algebra Toolbox", ver. 1.01, April, 2009.

See Also


<< maxplusmcm Max-Plus Algebra maxplusotimes >>