On 12/09/2012 01:22 AM, Allin Cottrell wrote:
On Sat, 8 Dec 2012, Sven Schreiber wrote:
>
> sorry, I disagree. I can write more about this later, but IIUC now
"a'b"
> with for example "a" 1x1 and "b" 3x3 would not give an error and
> multiply b with the scalar version of a. If that's so, I think this
> would hide bugs in the hansl code which will be difficult to spot and
> correct.
It's a difficult issue: for sure, there's a trade-off whereby
greater convenience (and efficiency) are associated with a greater
chance of scripting errors going undetected. Where to strike the
balance?
I agree there's not an easy solution in general.
...
> 2) In multiplying matrices, including the case of
> transpose-multiply, it's always acceptable for one of the operands
> to be 1 x 1 and the other to be of arbitrary dimension: we treat
> this as multiplication of a matrix by a scalar.
The way you state the rule is certainly very straightforward, and in
principle I like this kind of flexibility. However, I maintain that the
implication here is crazy: Who in their right minds would write "a'b" if
they expect "a" to be scalar-like (1x1) and don't want matrix
multiplication, but multiplication-by-scalar? This has nothing to do
with intuitive behavior.
Note that AFAICS, if gretl did not do multiplication-by-scalar anymore
whenever a "'" is involved, this would only break the following kinds of
code:
- Code where "a" could turn out as a mxn or a 1x1 matrix, and "b" is
mxp
with m>1, and the author consciously wants a different type of
multiplication dependent on the case of "a". That would strike me as
horrible programming style and I wouldn't mind breaking that.
(Note that in case m=1, so "b" is 1xp, and "a" could be 1xn or 1x1,
nothing would be broken, and this is a perfectly possible and reasonable
case.)
- Code where the "'" is added (or used instead of "*") out of
ignorance
or misunderstanding or coincidence, without a real reason. That code
could be easily corrected.
Or am I missing something else? I must confess, I have lost sight of
what the original report by Stefano was pointing out in the first place...
thanks,
sven