tmatrixAdd: Tropical Sum of Matrices

Description Usage Arguments Details Value Examples

Description

This funciton sums two matrices(first matrix scaled by alpha, if user doesnt't pass alpha first matrix will not be scalled) and return the resultant matrix.This function works only if both matrices are numeric and of same size, and alpha is a numeric value.

Usage

1
tmatrixAdd(x,y,alpha=0)

Arguments

x

A numeric Matrix.

y

A numeric Matrix.

alpha

A numeric value.

Details

If either the size of both matrices is not same or if any one or both matrices are not numeric matrix or alpha is not a numeric value then it will generates an error.

Value

Returns the tropical sum of x(scalled by alpha) and y.

Examples

1
2
3
4
x<-matrix(c(2,3,5,7),ncol=2,nrow=2)
y<-matrix(c(6,3,1,9),ncol=2, nrow=2)
alpha<-5
tmatrixAdd(x,y,alpha)

Example output

     [,1] [,2]
[1,]    6    1
[2,]    3    9

tropAlgebra documentation built on May 2, 2019, 7:29 a.m.