Learn R Programming

tropAlgebra (version 0.1.1)

tmatrixAdd: Tropical Sum of Matrices

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

tmatrixAdd(x,y,alpha=0)

Arguments

x

A numeric Matrix.

y

A numeric Matrix.

alpha

A numeric value.

Value

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

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.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab