octave-maintainers
[Top][All Lists]
Advanced

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

Re: Ideas for auto BSX


From: Jordi Gutiérrez Hermoso
Subject: Re: Ideas for auto BSX
Date: Fri, 30 Sep 2011 14:19:37 -0500

Btw, I'm calling this feature "auto BSX" -- automatic binary singleton
expansion.

2011/9/30 Jordi Gutiérrez Hermoso <address@hidden>:
> Am 30.09.2011 um 20:55 schrieb Jordi Gutiérrez Hermoso:
>
>> It's not a bug. It's a feature I implemented recently. It's equivalent to
>>
>> bsxfun(@minus, [1 2 3], [1 2 3]')

> So, while I think this is quite useful, it should by no means be
> called "-" in my opinion. Perhaps ".-" would do?

This is an interesting compromise. It would be more work to implement,
but I could do it. The only difficulty I see is that this compromise
wouldn't help for other dot operators (e.g. .*, ./) in case you also
were expecting these to error out instead of computing a matrix.

I guess I could enable a global option to disable auto BSX if you
prefer to error out if you get the orientation of vectors wrong. It
shouldn't impact performance greatly.

> I've never seen anyone use this.

This is precisely why I enabled it. The bsxfun function is a very,
very useful tool. It should be a basic vectorisation tool. I noticed
that evey time I used it, people were confused about what it did. It
doesn't help that bsxfun(@minus, v, v') is quite horrible syntax and
thus obscure, so people never use it, and resort to looping instead.
So turning it on by default, I'm hoping to encourage more people to
take advantage of BSX.

Also, I keep going back to the numpy example. It works for them. I
thought it could also work for us.

- Jordi G. H.


reply via email to

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