Description Usage Arguments Details Value Examples
tropicalsparse.mv function performs the matrix-vector operation on the equation: y = alpha * op(A) * x + beta * y.
1 2 |
alpha |
is a single real value. |
A |
is a matrix. |
opA |
is transpose of |
x |
is a vector. |
beta |
is a single real value. |
y |
is a vector. |
store |
is storage technique. |
algebraType |
is string input that can be |
The input of this function is one matrix, transpose of that matrix, two vectors, two constants,
storage technique and type of Tropical Algebra. The inputs of the matrix, vectors and algebraType are
compulsory while all other inputs are optional. The matrix must be sparse otherwise error occured. alpha
and beta must be a single real value. opA can be set to TRUE to take transpose of A.
store input can be coo, csc and csr for applying following storage techniques
respectively: Coordinate-Wise, Compressed Sparse Row, Compressed Sparse Column. If store is not
specified then functionality is performed without using any storage technique. algebraType is used to
specify type of Tropical Algebra. This can be minplus or maxplus. For more details about
algebraType, see detail section of check.infinityM or check.infinityV.
First of all A is multiplied with x and if alpha is given then the product of A
and x will be multipied with alpha otherwise it remais the same. After this, beta is
multiplied with y only if beta is given. Finally, both result are added to each other and the
resultant matrix is obtained. Same functionailty is applied if any of the store technique is specified.
Returns the resultant matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | a <- matrix(data = c(2, Inf, Inf, 0, Inf, Inf, Inf, 10, Inf),
nrow = 3, ncol = 3, byrow = TRUE)
b <- c(2, Inf, 5)
c <- c(Inf, 9, Inf)
tropicalsparse.mv(A = a, alpha = 5, opA = TRUE, x = b, y = c,
store = 'csr', algebraType = 'minplus')
# [,1] [,2] [,3]
# [1,] 9 Inf Inf
# [2,] 9 9 9
# [3,] Inf 20 Inf
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.