Hi,
Try:
set.seed(445)
A<- matrix(sample(1:20,124*5,replace=TRUE),ncol=5)
set.seed(42)
B<- matrix(sample(1:25,12*5,replace=TRUE),ncol=5)
res<- sapply(seq_len(nrow(A)),function(i) colSums(A[i,]*t(B)))
dim(res)
#[1] 12 124
A.K.
From: eliza botto
To: "smart
On 16.06.2013 04:35, G Vishwanath wrote:
Is there a R package or function that will multiple an arbitrary number of
matrices supplied to it, preferably optimizing the sequence
R_function(matA, matB, matC, matD,)
return matA %*% matB %*% matC %matD %
and optimizing wether it is
Is there a R package or function that will multiple an arbitrary number of
matrices supplied to it, preferably optimizing the sequence
R_function(matA, matB, matC, matD,)
return matA %*% matB %*% matC %matD %
and optimizing wether it is better to do A(BC) or (AB)C ?
Thanks,
Shi
3 matches
Mail list logo