Page 10-10
Function RDM
Function RDM (Re-DiMensioning) is used to re-write vectors and matrices as
matrices and vectors. The input to the function consists of the original vector
or matrix followed by a list of a single number, if converting to a vector, or
two numbers, if converting to a matrix. In the former case the number
represents the vector’s dimension, in the latter the number of rows and
columns of the matrix. The following examples illustrate the use of function
RDM:
Re-dimensioning a vector into a matrix
The following example shows how to re-dimension a vector of 6 elements into
a matrix of 2 rows and 3 columns in ALG mode:
In RPN mode, we can use
[1,2,3,4,5,6]
`
{2,3}
`
RDM
to
produce the matrix shown above.
Re-dimensioning a matrix into another matrix
In ALG mode, we now use the matrix created above and re-dimension it into a
matrix of 3 rows and 2 columns:
In RPN mode, we simply use
{3,2}
`
RDM
.
Re-dimensioning a matrix into a vector
To re-dimension a matrix into a vector, we use as arguments the matrix
followed by a list containing the number of elements in the matrix. For
example, to convert the matrix from the previous example into a vector of
length 6, in ALG mode, use: