Learn R Programming

tropAlgebra (version 0.1.0)

dotProduct: Dot Product of X and Y: Tropical Algebra Function

Description

Dot product is actually the multiplication of transpose of 1st matrix then multiplicatoin of that transposed matrix and 2nd matrix(Y). This function does this and returns the resultant matrix after calculation of thes steps, Colunms of 1st matrix must be eqaual to rows of 2nd one..

Usage

dotProduct(x,y)

Arguments

x

A numeric Matrix

y

A numeric Matrix

Value

Returns the dot product of x and y

Details

e.g. [1] [2] [1] 2 3 1st matrix that is X [2] 5 7 ......................................... [1] [2] [1] 6 3 2nd matrix that is Y [2] 1 9 ..........................................

Now, calling function... dotProduct(X,Y) Transpose of matrix 'X is obtained by interchanging rows into coulums OR columns into rows. [1] [2] [1] 2 5 Trransposed matrix [2] 3 7 .............................................. Then Tropical Dot Product of Matrices will be...

[1] [2] [1] 6 10 Resultant Matrix [2] 3 6

Examples

Run this code
# NOT RUN {
x<-matrix(c(2,5,3,7),ncol=2,nrow=2)
y<-matrix(c(6,10,3,6),ncol=2, nrow=2)
dotProduct(x,y)

# }

Run the code above in your browser using DataLab