[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: POC for automatic bsxfun
From: |
Judd Storrs |
Subject: |
Re: POC for automatic bsxfun |
Date: |
Wed, 17 Aug 2011 16:05:02 -0400 |
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));
Maybe another way to approach this is to add expand the operators to
include new symbols and functions (perhaps a prime +' , -' , ./' , .*'
&&' ||' etc) so that they can be overloaded by classes if necessary
and the regular operators would stay unchanged? I'd be perfectly content if
x = x - mean(x,4)
causes an error if I can go ahead and
x = x -' mean(x,4)
or something similar. But I don't know enough about the tokenizer to
know what new operator symbols might be implementation friendly.
--judd