MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > Speed up the nested loops (slower than inverse a l... 

Subject: Speed up the nested loops (slower than inverse a large matrix) From: Ximing xu Date: 27 Nov, 2010 02:14:05 Message: 1 of 12 
I have a large matrix correlation R (n by n), a design matrix F (n by k) and I want to calculate 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Matt Fig Date: 27 Nov, 2010 02:32:03 Message: 2 of 12 
Post more code, specifically what is in the FOR loop. 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Roger Stafford Date: 27 Nov, 2010 03:16:04 Message: 3 of 12 
"Ximing xu" <siemenxu@gmail.com> wrote in message <icpphd$cb2$1@fred.mathworks.com>... 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Ximing xu Date: 27 Nov, 2010 04:38:03 Message: 4 of 12 
Thanks for your quick reply. 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Ximing xu Date: 27 Nov, 2010 04:39:04 Message: 5 of 12 
"Matt Fig" <spamanon@yahoo.com> wrote in message <icpqj3$hu3$1@fred.mathworks.com>... 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Bruno Luong Date: 27 Nov, 2010 08:25:06 Message: 6 of 12 
"Ximing xu" <siemenxu@gmail.com> wrote in message <icq218$3ib$1@fred.mathworks.com>... 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Roger Stafford Date: 27 Nov, 2010 09:05:14 Message: 7 of 12 
"Ximing xu" <siemenxu@gmail.com> wrote in message <icq1vb$t6d$1@fred.mathworks.com>... 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Bruno Luong Date: 27 Nov, 2010 09:27:10 Message: 8 of 12 
Ximing, yes, I agree with Roger than your calculation of sum over 2x2 matrices are very odd. May be there is some rough approximation that leads you to compute such sum. But it looks suspiciously unjustified IMO. 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Ximing xu Date: 27 Nov, 2010 17:25:04 Message: 9 of 12 
I try to compare two statistical methods: the old method and my new method. For the old method I need to calculate the inverse of R , but for the new method I only need to calculate the inverse of 2by2 matrix. The code I show you is just part of my method. The motivation for my method is that the sum shown in my code is only O(n^2), which is much faster than inversion of R which is O(n^3). 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Bruno Luong Date: 27 Nov, 2010 18:51:03 Message: 10 of 12 
"Ximing xu" <siemenxu@gmail.com> wrote in message <icretg$4gm$1@fred.mathworks.com>... 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Ximing xu Date: 28 Nov, 2010 21:21:03 Message: 11 of 12 
Thanks, Bruno. I agree with you; I think using forloop is not efficient to do the extraction or to do the sum. Is there any (possible) alternative to do the extraction in my case? 
Subject: Speed up the nested loops (slower than inverse a large matrix) From: Bruno Luong Date: 28 Nov, 2010 21:41:04 Message: 12 of 12 
"Ximing xu" <siemenxu@gmail.com> wrote in message <icuh3v$i51$1@fred.mathworks.com>... 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.