octave-maintainers
[Top][All Lists]
Advanced

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

Re: Making bsxfun automatic


From: Jordi Gutiérrez Hermoso
Subject: Re: Making bsxfun automatic
Date: Wed, 3 Aug 2011 22:42:53 -0500

2011/8/3 John W. Eaton <address@hidden>:
> 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.

I am thinking to make it work for .* ./ and .^

These seem like the most common cases, and at least would over about
90% of my usage of bsxfun. I don't think this is likely to introduce
an error. It works fine for numpy. I'm mostly bothered by the ugly and
obscure syntax necessary for bsxfun.

- Jordi G. H.


reply via email to

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