On Thu, 1 Feb 2007, Riccardo (Jack) Lucchetti wrote:
Unfortunately, the recent fixes to the matrix handling code broke
the
Kronecker product: if you try the following on CVS
nulldata 2
a = mnormal(2,2)
b = mnormal(2,2)
c = a ** b
it gives an error. That is because the "**" is interpreted as B_POW
instead of KRON.
Thanks for spotting that. I have tried to work around the problem
in this way:
(a) if we know in advance that we're generating a matrix we
interpret "**" as KRON, and
(b) if in the evaluation phase we find that one or both of the
operands of B_POW is a matrix, and if the B_POW was an
interpretation of "**", we revise the interpretation to KRON.
As a consequence, I propose a syntax change (and this is the
reason why I'm cc-ing the devel-list): reserve "^" for power and
"**" for the Kronecker product. I'm aware that this introduces
another breakage in backward-compatibility, but looks to me as
the only clean way out.
I see your point, but I don't want to break the old use of "**" if
I can help it.
for example, what would the intended result of
C = A ** x
be, if A is a matrix and x is a scalar?
The way I have things right now, this instance of "**" would
produce an error: "Data types not conformable for operation".
That's because the presence of A on the left means "**" will be
interpreted as KRON, which requires two matrices as operands.
I _think_ that's fair enough, because although the main "genr"
documentation says "**" is a synonym for "^", the matrix chapter
of the guide says plainly to use "A^k" for raising a matrix to a
power (and says "**" = Kronecker).
No, this is not perfectly clean -- but is it acceptable?
Allin.