Re: [R] Matrix mulitplication

2013-09-11 Thread arun
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

Re: [R] Matrix Mulitplication: A*B*C*D...?

2013-06-16 Thread Uwe Ligges
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

[R] Matrix Mulitplication: A*B*C*D...?

2013-06-15 Thread G Vishwanath
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