very very very slow computing

John W. Eaton jwe at octave.org
Sat Feb 7 07:56:27 CST 2009


On  7-Feb-2009, Depo wrote:

| 
| > I guess your problem is missing semicolon in line
| >    new_sign_difference(k,i)=sign_difference(k,i)
| > which means that whole matrix is printed in every cycle . After I
| > removed output to screen by adding semicolon and removing both disp()
| > commands, the assignment takes about 2.5 secs on my computer (for
| > 10*3000 matrix).
| 
| That was the problem!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Even in my computer
| works

Dude, take it easy on the ! key.  Or does that key on your keyboard
sometimes get stuck?

Please tell us that you did also understand the advice about Octave
providing an array-based language, and that you should not be writing
loops to copy matrices.  All you need to do to copy a matrix is

  mx = rand (3);
  new_mx = mx;

Nice, simple, and fast.  A second copy is not even really made until
you modify some element of mx or new_mx.  Magic!!!!!!!!!!!!! (oops,
stuck key).

jwe


More information about the Help-octave mailing list