s-news
[Top] [All Lists]

Matrix multiplication

To: s-news@lists.biostat.wustl.edu
Subject: Matrix multiplication
From: Riyanto Wibowo <riyantowibowo@yahoo.com.sg>
Date: Thu, 23 Jun 2005 12:15:54 +0800 (CST)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.sg; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=XiUttplJCEAr9MlcJkKQofIhJPYr1xL8GsHQUBoL0AGSnzgu4Ru45tASqnH1SM4KQhJDD/jldsr1SPRwSfSTjYV1+HggOO+DMlyFrUwlQdrNEx8nCbjke0/ztKNv6tbtu46FgNcCe8YXF+VkabJmgrn/xMHPatChCiweUWEk12g= ;
Dear All,
I want to perform matrix multiplication for large size of matrix. I could perform it with this function, unfortunately it takes almost 25 seconds.
 
function()
{

 a <- matrix(runif(100000), 50000, 2)
 P <- numeric(50000)
 b <- matrix(0, 2, 1)
 b[1, 1] <- 10
 b[2, 1] <- 20
 for(i in 1:50000) {
  P[i] <- a[i, 1:2] %*% b
 }
}
 
Could anyone help me how to perform matrix multiplication with the most efficient/fastest way? Is it possible ?
 
Thank you very much.
 
Regards,
 
Ryan

Send instant messages to your online friends http://asia.messenger.yahoo.com

<Prev in Thread] Current Thread [Next in Thread>