octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unexpected copying


From: John W. Eaton
Subject: unexpected copying
Date: Mon, 12 Jun 2006 18:11:06 -0400

On 12-Jun-2006, John W. Eaton wrote:

| I think it is assignment to "ans" that is causing trouble (though
| "ans" is not even showing up with a value in the symbol table).  Hmm.
| Looks like a bug, but I don't see where yet.
| 
| Note that with your example, adding "ans = []" after reshape prevents
| the copy.  With this code
| 
|   S=T=[100:100:3000]; 
|   for i=1:length(S), 
|     k=S(i); A=rand(k); 
|     tic; A=reshape(A,k*10,k/10); ans = []; A(1,1)=2; T(i) = toc; 
|   end
| 
|   [P,R] = polyfit(S,T,2);
|   plot(S,T,S,polyval(P,S))
| 
| I see constant time.

Hmm, well I don't think it is ans as I also see constant time if I
replace "ans" with "x" in the above code.  OK, now I'm confused.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]