Description Usage Arguments Details Value Examples
tropicalsparse.mm
function performs the matrix-matrix operation on the equation: y = alpha * op(A) * op(B) + beta * op(C).
1 2 |
alpha |
is a single real value. |
A |
is a matrix. |
opA |
is transpose of |
B |
is a matrix. |
opB |
is transpose of |
beta |
is a single real value. |
C |
is a matrix. |
opC |
is transpose of |
store |
is storage technique. |
algebraType |
is string input that can be |
The input of this function is three matrices, two constants, operation on these matrices, storage
technique and type of Tropical Algebra. Matrices and algebraType
inputs are compulsory while all other
inputs are optional. A
, B
and C
must be the matrix of same dimensions and these matrices
must be sparse otherwise error occured. alpha
and beta
must be the single real value. opA
,
opB
and opC
can be set to TRUE to take transpose of A
, B
and C
matrices
repectively. 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 B
and if alpha
is given then the product of A
and
B
will be multipied with alpha
otherwise it remais the same. After this, beta
is
multiplied with C
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 15 16 | a <- matrix(data = c(2, Inf, Inf, 0, Inf, Inf, Inf, 10, Inf),
nrow = 3, ncol = 3, byrow = TRUE)
b <- matrix(data = c(Inf, Inf, 4, Inf, -0.3, Inf, Inf, 2, Inf),
nrow = 3, ncol = 3, byrow = TRUE)
c <- matrix(data = c(1, Inf, Inf, Inf, 0, 6, Inf, Inf, Inf),
nrow = 3, ncol = 3, byrow = TRUE)
tropicalsparse.mm(A = a, alpha = 5, opB = TRUE, B = b, C = c,
store = 'csr', algebraType = 'minplus')
# [,1] [,2] [,3]
# [1,] 1 Inf Inf
# [2,] Inf 0.0 6
# [3,] Inf 14.7 17
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.