[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making bsxfun automatic
From: |
fork |
Subject: |
Re: Making bsxfun automatic |
Date: |
Fri, 5 Aug 2011 18:11:16 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
John W. Eaton <jwe <at> octave.org> writes:
> 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.
The operator could throw an error if the dimensions don't match in a reasonable
way (I think this what numpy does, but I think SPLUS/R recycles and forces a
match, dropping leftovers -- not good)
For example:
A = [1 2 3
4 5 6]
B = [10 20 30]
So A .* B would yield [10 20 90; 40 100 180] (multiplying "down", over the
singleton dimension), but A .* B' would throw an error.