octave-maintainers
[Top][All Lists]
Advanced

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

unexpected copying


From: Paul Kienzle
Subject: unexpected copying
Date: Mon, 12 Jun 2006 11:38:36 -0400
User-agent: Mutt/1.2.5.1i

Hi,

I'm getting unexpected quadratic behaviour from an assignment
to an array after reshape in 2.9.5 (Debian):

  S=T=[100:100:800]; 
  for i=1:length(S), 
    k=S(i); A=rand(k); 
    tic; A=reshape(A,k*10,k/10); A(1,1)=2; T(i) = toc; 
  end

  [P,R] = polyfit(S,T,2);
  plot(S,T,S,polyval(P,S))

Presumably the array is being copied.  Without the
assigment A(1,1)=2 the time is constant, so the copy isn't
happening in reshape.  Similarly, without the reshape the
time is constant, so the copy isn't happening in the assignment.
I wasn't able to demonstrate a memory leak either, so it is
not a simple reference counting issue.

Any guesses?

- Paul



reply via email to

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