! Illustrate Transpose of a matrix.(TransposeOfMatrix.lng)
Example: We wrote our model assuming
distance matrix is in From>To form,
but now we have a user who has his
matrix in To>From form.
@TRANSPOSE provides a simple way of transposing a matrix;
! Keywords: Transpose, Matrix transpose;
SETS:
PROD;
PXP( PROD, PROD): DIST, TOFDIST;
ENDSETS DATA:
PROD =
VANILLA BUTTERP, STRAWB, CHOCO;
! A changeover time matrix. Notice,
changing from Choco to anything else
takes a lot of cleaning.
From runs vertically, To runs horizontally;
DIST=
0 1 1 1 ! Vanilla;
2 0 1 1 ! ButterP;
3 2 0 1 ! StrawB;
5 4 2 0; ! Choco;
ENDDATA
CALC:
@SET( 'TERSEO',2); !Output level (0:verb, 1:terse, 2:only errors, 3:none);
@WRITE( ' Changing from a row to a column', @NEWLINE(1));
@WRITE( 'The original changeover time matrix', @NEWLINE(1));
@TABLE( DIST);
@WRITE( @NEWLINE(1),' The transpose( To>From form)',@NEWLINE(1));
TOFDIST = @TRANSPOSE( DIST); ! Compute the transpose of DIST matrix;
@TABLE( TOFDIST);
ENDCALC
