Description Usage Arguments Value Author(s) See Also Examples
Computes a generalized matrix multiplication, where sum and product functions (elemetwise and summary functions) can be replaced by arbitrary functions.
1 | genMatrixMult(A,B,FUNelement="*", FUNsummary=sum)
|
A |
The first matrix |
B |
The second matrix |
FUNelement |
Elementwise operator. |
FUNsummary |
Summary function. |
A character vector or matrix.
Aleš Žiberna
1 2 3 4 5 6 7 8 9 10 11 | #operations can be anything
x<-matrix(letters[1:8],ncol=2)
y<-matrix(1:10,nrow=2)
genMatrixMult(x,y,FUNelement=paste,FUNsummary=function(x)paste(x,collapse="|"))
#biary logic
set.seed(1)
x<-matrix(rbinom(8,size=1,prob=0.5)==1,ncol=2)
y<-matrix(rbinom(10,size=1,prob=0.5)==1,nrow=2)
genMatrixMult(x,y,FUNelement="*",FUNsummary=any)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.