|
From: | Przemek Klosowski |
Subject: | Re: senseless warning in octave-3.6.2 |
Date: | Fri, 6 Jul 2012 12:19:50 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 07/06/2012 11:32 AM, Sergei Steshenko wrote:
There are three possible behaviors: - inner product: vector OP vector -> scalar - element-by-element vector OP vector -> vector - outer product vector OP vector' -> matrix
I have _explicitly_ requested element by element operation by using '.*' and _not_ plain '*'. As a result I'm getting a _matrix_ and not a vector. _Exactly_ because I _explicitly_ requested element by element operation on two vectors and instead of a vector I got a matrix it is a _bug_.
OK, so we have three possible behaviors and four ways to specify the expression:
[1 2] * [3 4] error: operator *: nonconformant arguments [1 2] * [3 4]' 11 (scalar or inner product) [1 2] .* [3 4] 3 8 (element-by-element) [1 2] .* [3 4]' warning: product: automatic broadcasting operationyou seem to argue that .* should return an element-by-element vector in both cases, but then we run out of simple ways of specifying broadcasting. Just accept that they moved the cheese and get on with it.
[Prev in Thread] | Current Thread | [Next in Thread] |