On Fri, 7 Dec 2012, Allin Cottrell wrote:

> In fact, although we could go either way in terms of resolving the
> inconsistency of treatment of X'Y and X'*Y, for X or Y 1x1 and not
> strictly conformable with the other operand, it would be easier (I
> think) to make the latter operation reduce to the former, hence
> (absent any other changes) enforcing the stricter interpretation. If
> that's what we want.

Premise: matrix-oriented languages have a short history, compared to the 
tradition in mathematically-formal matrix notation. A few conventions have 
been emerging in Gauss, Matlab and Ox, with hansl and mata as the 
newcomers in the field. It's perfectly natural that some good ideas become 
de facto standards (or almost such, such as the A'B syntax, matlab being 
the exception), while at the same time there may be inconsistencies and 
oddities. Moreover, hansl has not been "designed": many of its features 
have been added incrementally as needed, so quirks may arise just as they 
do in natural languages, such as English. Sometimes (like in the case of 
left- and right- matrix divisions) changing to conform to what others do 
is a good idea, sometimes it isn't. I'd say it depends. IMO, the objective 
must be to conform to intuition (and established mathematical conventions) 
as closely as possible without infringing consistency and predictability 
of behaviour.

This said, I think both expressions should be legal: in the expressions 
"a'b" and "a' * b" the 'prime' character actually performs a different 
role (as Allin already said): in the first case, it's shorthand for 
"transpose and then multiply"; in the second case, it means "transpose and 
see what happens next".

In the interest of common sense, I imagine that everybody agrees that 
transposition on a 1x1 matrix should be a no-op which takes precedence on 
anything else, so "a' * b" is exactly equivalent to "a*b". For similar 
reasons, "a'b" should be interpreted as "since this is shorthand for 
"(a')*b, just do the same".

>> What's trickier is plain "X*Y" when X is 1x1 and Y is not a row vector
>> (so written without any transposition), but that apparently is not the
>> topic right now.
>
> No, but rescinding the "1x1 matrix is treated as a scalar" policy
> more generally would be seriously backward-incompatible.

Not only that, it would be wrong IMO. A scalar is not, strictly speaking, 
a 1x1 matrix. In fact, the common mathematical convention on how to 
interpret $k \cdot A$, $k \in \Re$ and $A \in \Re^{m \times n}$ (pardon my 
TeX) is there exactly to avoid the boring and cumbersome details on how to 
do "the right way" something quite trivial.

> Allin Cottrell
>
> P.S. Although I haven't shifted it myself, shouldn't this be on
> gretl-devel?
>

It's now on both. Is this a bad idea?

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti(a)univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

Reply via email to