Re: ROW- behaves differently in the HP49G Message #3 Posted by Valentin Albillo on 1 Dec 2004, 10:12 a.m., in response to message #2 by James M. Prange
Hi, James:
James M. Prange posted: "Somehow, the idea of an array with 0 rows or 0 columns seems rather strange to me."
It has its uses, and the idea of such arrays goes back to the times of the HP-85, if not further. As you may know, there was a Matrix ROM for the HP-85, from which the best algorithms were incorporated into the HP-71B Math ROM, from which the best code was adapted for such machines as the HP-42S and the 48/49 models.
See what the HP-85 Matrix ROM manual has to say about these "empty" arrays (HP-85 Matrix ROM Owner's Handbook, page 46): "Arrays with zero rows or zero columns can be considered
to be "empty", since they contain no elements [...]
Empty arrays can be specified in subsequent statements
and functions with meaningful results [...]
The following situations are of particular interest: [...]
For example, if the operand array has been redimensioned
to be 0x3, the statement MAT A=B would redimension the
result array to be 0x3, while the statement MAT A=TRN(B)
would redimension the result array to be 3x0
The matrix multiplication statement, if both operand
arrays are empty, can yield a result array that is *not*
empty [...]
For example, if matrix B has been redimensioned to be
3x0, and matrix C has been redimensioned to be 0x1,
the statement MAT A=B*C redimensions matrix A to be
(3x0)x(0x1) = 3x1. The result array is not empty, since
neither the number of rows nor the number of columns is
zero"
So you see, it seems you can matrix multiply a, say, 5x0 empty matrix and a 0x5 empty matrix and get a 5x5 non-empty matrix ! :-)
The Matrix ROM Owner's Handbook discusses the topic further and gives an example where this behavior is advantageous. I don't know (but mostly doubt) if the 48/49 models do allow for such operations on empty arrays, so perhaps this useful and advanced feature was lost in the way.
Best regards from V.
|