octave-maintainers
[Top][All Lists]
Advanced

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

Making bsxfun automatic


From: John W. Eaton
Subject: Making bsxfun automatic
Date: Wed, 3 Aug 2011 23:21:02 -0400

On  3-Aug-2011, Jordi Gutiérrez Hermoso wrote:

| For some stuff at work, I've been working with numpy, and I see that
| they implemented something I asked about way back when:
| 
|      
http://octave.1599824.n4.nabble.com/Applying-each-element-of-a-vector-to-each-row-of-a-matrix-tp3094532p3094532.html
| 
| While bsxfun works, it's obscure, people don't know about it, and
| frankly, it's just damn ugly, and I shouldn't feel proud about myself
| for using it to solve something. People should just attempt the
| multiplication they want with .* and be happy it works. Numpy's
| approach is just that: bsxfun is just simply "automatic" and it seems
| much nicer. We could implement this without breaking any Matlab code,
| making it a nice Octave extension.
| 
| Any objections?

I have a few reservations about making this change.

Does it apply only to .*, or also to other operators?  Which ones?

Currently, if you screw up the dimensions with .*, you get an error.
With your proposed change, you could end up with incorrect results and
no warning about it at all.

jwe


reply via email to

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