                        Ŀ
                         Matrix <-> List converter 
                        

Description
-----------

MList is a Matrix <-> List converter. Given two lists of real numbers, it
convert them into a matrix - the lists are interpreted as columns. If Mlist is
executed over a matrix, it will return two lists.

Note:

MList only accepts real matrices or lists of real numbers. Also, it's intended
to work only with matrices size n * 2. Columns beyond #2 will be discarded. As
to lists, they must have the exact same size.

Disclaimer
----------

THERE ARE NO GUARANTIES AS TO THE PERFORMANCE OF THIS PACKAGE.

THE AUTHOR IS NOT RESPONSIBLE FOR *ANY* KIND OF DAMAGE CAUSED BY THE
DOCUMENTATION OR SOFTWARE PROVIDED.

THE AUTHOR RECOMMENDS THE USER TO BACKUP THE MACHINE'S MEMORY BEFORE USING
THE SOFTWARE.

PERMISSION TO COPY THE WHOLE UNMODIFIED PACKAGE IS GRANTED, PROVIDED THAT
THE COPIES ARE NOT MADE FOR RESALE ( EXCEPTING NOMINAL COPYING FEES ).

THIS PRODUCT MAY NOT BE USED FOR COMERCIAL PURPOSES, WITHOUT WRITTEN
PERMISSION FROM THE AUTHOR.


Source Code
-----------

The program is written in System RPL, the internal language of the HP48 family
of calculators in which their OS is based. Source code is here shown just in a
educational perspective.

The program's stack diagrams are :

                        ( list list -> matrix )
                        ( matrix -> list list )

Mlist  113 bytes Checksum # D71Ah ( 'MList' RCL BYTES )

::                      
 CK1NoBlame             * Check one object, no commands in error messages
 DTYPEARRY?             * DUP , TRUE if object is array 
 ITE                    * IfThenElse
*************************
* Routine Matrix -> List
*************************
 ::                     
  ROMPTR C3 14          * Internal ->COL
  COERCE
  #2-
  NDROP                 * Eliminate columns # > 2
  DTYPEARRY?            
  NcaseTYPEERR          * Error if object isn't of array type
  PTR 1D0AB             * Internal ARRY-> ( unsupported entry )
  INCOMPDROP            * Decompose list, drop size 
  COERCE                * Convert real to system binary
  {}N                   * Internal ->LIST
  $ "Y"
  >TAG                  * Build tagged object Y: { ... }
  SWAP                  
  DTYPEARRY?
  NcaseTYPEERR
  PTR 1D0AB             
  INCOMPDROP
  COERCE
  {}N                   
  $ "X"
  >TAG                  * Build tagged object X: { ... }
  SWAP
 ;
*************************
* Routine List -> Matrix
*************************
 ::                     
  CK2NOLASTWD           * Check for two objects
  CK&DISPATCH1          
  2LIST                 * Require two lists
  ::                    
   x\->V2               * User command ->V2
   INNERCOMP            * Decompose list of arrays
   UNCOERCE             * Convert system bin to real 
   ROMPTR AB 42         * Build matrix ( internal ROW-> )
  ;
 ;
;

Jorge Costa
l38861@alfa.ist.utl.pt
http://alfa.ist.utl.pt/~l38861/