On 12/07/2012 11:08 PM, Allin Cottrell wrote:
On Fri, 7 Dec 2012, Sven Schreiber wrote:
> On 12/07/2012 08:31 PM, Alan G Isaac wrote:
>> On 12/7/2012 1:52 PM, Summers, Peter wrote:
>>> But your example holds true whether or not we write x'y or x'*y
>>
>>
>> Absolutely. I was addressing only the issue of
>> how to handle a 1 x 1 matrix, not the core question.
>>
>> I agree that many matrix programming languages special case
>> the 1x1 matrix. I guess it is convenient enough to introduce
>> the risk I illustrated, at least in the opinion of some.
>> Not in mine.
>>
>> I also have an opinion the topic question (explicit is better than implicit),
>> but not a strong one. One thing is for sure, x'*y needs to be legal.
>> The question is whether x'y is a legal "shorthand".
>
> To me it would seem that if somebody writes <m'>, the script author is
> treating m as a matrix. Because why would you use a transpose if the
> object is always expected to be a scalar? Therefore it would seem
> appropriate to always treat <m'y> as a matrix multiplication even in the
> special case when m is 1x1.
FWIW, I think that's the explanation of gretl's current
inconsistency. If you write "X'Y" it seems clear that you really
intend a matrix operation, with two matrix operands, in which case a
1x1 matrix would not be given special treatment with regard to
conformability. But if you write "X'*Y", with X 1x1, gretl first
evaluates X', producing an anonymous 1x1 matrix, then finds plain
multiplication, and applies the idea that 1x1 matrices can count as
scalars if need be.
Yeah, although my argument applies to "X'*Y" as well, right? When does
it make sense to treat this as scalar multiplication when X is 1x1? So
I tend to think gretl should allow this only if Y is a row vector.
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.
thanks,
sven