octave-maintainers
[Top][All Lists]
Advanced

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

Re: POC for automatic bsxfun


From: Jordi Gutiérrez Hermoso
Subject: Re: POC for automatic bsxfun
Date: Wed, 17 Aug 2011 15:16:51 -0500

On 17 August 2011 15:05, Judd Storrs <address@hidden> wrote:
> On Wed, Aug 17, 2011 at 12:08 PM, Levente Torok <address@hidden> wrote:
>> I can agree to have configurable warning or show stopper error but it
>> could be dangerous for people living with the custom of
>> relying on this size mismatch check.
>
> If the dimensions weren't compatible in the bsxfun sense it would
> still produce an error. When I've made a mistake like that, they're
> usually off-by one in size along a dimension and this wouldn't break
> that. Much more often I run into the opposite case: "the damnit that's
> right, I have to use bsxfun".
>
> Nevertheless, really the objection is lack of a better alternative to
> bsxfun. I really much rather prefer writing/reading something like
> this:
>
> x = x - mean(x,4) ;
>
> vs
>
> x = bsxfun(@minus,x,mean(x,4));

Or multiply all rows/columns of a matrix by a vector of scalars
without silly tricks like having to create diagonal matrices, which is
my original motivation:

     
http://octave.1599824.n4.nabble.com/Applying-each-element-of-a-vector-to-each-row-of-a-matrix-td3094532.html#a3095010

- Jordi G. H.


reply via email to

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