octave-maintainers
[Top][All Lists]
Advanced

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

POC for automatic bsxfun


From: John W. Eaton
Subject: POC for automatic bsxfun
Date: Tue, 23 Aug 2011 22:58:39 -0400

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

| The attached patch makes bsxfun automatic for most binary operators.
| The power operator seems to be the only one that is treated
| differently, so it's not covered by this patch.
| 
| I'm not pushing this patch since it's potentially quite contentious,
| but I enjoy that e.g. it's now quite easy to get the matrix of all
| pairwise differences of a vector:
| 
|      x = rand(5,1);
|      d = x - x';
| 
| which I think is a definite improvement over
| 
|      d = bsxfun(@minus, x, x');
| 
| not to mention less obscure and more likely to be discovered with
| experimentation. If this idea sticks, I would like to write additions
| to the manual to explain this behaviour, how it differs from Matlab,
| when to use it, and when to avoid it.
| 
| What do you guys think?

I'm OK with adding this as an experimental feature as long as we agree
to remove it if there turn out to be unexpected problems or if it
somehow causes a lot of confusion.  I think the documentation should
be clear that the feature is experimental.

jwe


reply via email to

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