help-octave
[Top][All Lists]
Advanced

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

Re: Octave and cargo cult programmingHello


From: Francesco Potortì
Subject: Re: Octave and cargo cult programmingHello
Date: Wed, 19 Sep 2012 22:13:41 +0200

>In my code, using bsxfun allowed me achieve massive performance gains in my
>workload at the price of readability. But now with broadcasting I get the
>performance gains without losing readability--in fact it's even more
>readable than the loop form! Further, this decision wasn't made lightly and
>it was discussed to death. Ultimately, even with broadcasting enabled,
>Octave is fully capable of running valid Matlab code. We've been waiting
>for someone to show *actual* harm from the change.

My experience is that, while I like broadcasting a lot, it is more
difficult thatn I would like.  I rely on Octave spitting out an error
when my matrices do not have the right size or dimension, but
broadcasting defies this.  True, it emits a warning, but that's an
annoyance: you want an error when you don't want broadcasting, and you
don't want a warning when you want it.

In practice, I end up doing this:

  ow = warning("query","Octave:broadcast"); # query state of broadcast warnings
  warning("off",ow.identifier);             # disable broadcast warnings
    code using broadcasting
  warning(ow.state,ow.identifier);      # restore broadcast warnings

which in some ways defies the purpose of broadcasting, that is making
code simpler and more readable, but it is the only way I found to be
warned during development and not to be annoyed once the code is stable.

I'd like a better solution, but I am not a language expert and I am sure
others can suggest something that is more reasonable that I can.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

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