From: Andy on 10 Aug 2010 11:25 "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i3rq4u$q9j$1(a)fred.mathworks.com>... > Dear Andy, > > > if ~isequal(xn,Xn(:,1:n)) > > While "xn" is a vector, "Xn(:, 1:n)" is a matrix. So you have to include a loop in addition. > If the matrix gets really large, apply the STRFIND method in one or more further levels. > > Kind regards, Jan Sorry, I missed that. There is probably a way to inline the check using repmat or arrayfun, but then you incur the overhead penalties that we were trying to avoid anyway. (Although perhaps builtin functions will be faster. It may be worth a try.)
From: Dragan on 10 Aug 2010 12:18 "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i3rq4u$q9j$1(a)fred.mathworks.com>... > Dear Andy, > > > if ~isequal(xn,Xn(:,1:n)) > > While "xn" is a vector, "Xn(:, 1:n)" is a matrix. So you have to include a loop in addition. > If the matrix gets really large, apply the STRFIND method in one or more further levels. > > Kind regards, Jan That was my conclusion when I tried this; since I had to add an additional loop this did not improve the speed compared to your suggestion. As for now I'll stick to your code and see if I (maybe) can improve the other bottlenecks in the rest of the code. I'm not sure if its worth trying to port the QR factorization (or solving the normal equations) to C++/MEX or not; I mean, the built-in code (QR or mldivide) is quite fast IMO, but it's definitely the part of the code that takes the longest time. And now that I'm writing here, maybe I could ask for some more tips. I would assume the code could be simplified even further if I could get it on the form as shown in http://folk.ntnu.no/mitrevsk/temp/kron_prod.PNG (just a snip from an article that is referring to a book by V. John Mathews). Would it be correct to use X5 = zeros(Nx,min(size(X1))*min(size(X3))); for n = 1:Nx X5(n,:) = kron(X1(n,:),X3(n,:)); end and so on for the higher order terms, to compose the different input vectors? And if so, any way to exchange the loop with some fancy function?
First
|
Prev
|
Pages: 1 2 Prev: remove a specific frequency from emg signal Next: What uses the Java heap? |