Texas Instruments TI89 Developer Guide - Page 743
push_mrow, Example, Integer2Index
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 743 highlights
Appendix A: System Routines - Lists and Matrices 701 push_mrow (continued) Example: This example uses push_mrow, push_mrowadd, and push_rowadd. It uses an AMS global variable Integer2Index which is only available on AMS 2.05 and above so it undefines that global and redefines its own. In this way this code will run on all versions of AMS 2.00 and above. Notice how it stores its own test matrix (a matrix is just a list of lists). #undef Integer2Index const Quantum Integer2 [] = {2u, 1u, NONNEGATIVE_INTEGER_TAG}; #define Integer2Index ((EStackIndex) (Integer2+2)) const Quantum Integer5 [] = {5u, 1u, NONNEGATIVE_INTEGER_TAG}; #define Integer5Index ((EStackIndex) (Integer5+2)) const Quantum tArray[] = {END_TAG, END_TAG,4,1,NONNEGATIVE_INTEGER_TAG, 3,1,NONNEGATIVE_INTEGER_TAG,LIST_TAG, END_TAG,2,1,NONNEGATIVE_INTEGER_TAG, 1,1,NONNEGATIVE_INTEGER_TAG,LIST_TAG, LIST_TAG }; #define tArrayIndex ((EStackIndex) (tArray+sizeof(tArray)-1)) BYTE m5[] = {0,'m','5',0}; /* Start out with [1,2;3,4] (note that lists are stored backwards */ push_mrow( Integer5Index, tArrayIndex, Integer1Index ); /* Now have [5,10;3,4] */ push_mrowadd( Integer2Index, top_estack, Integer1Index, Integer2Index ); /* Now have [5,10;13,24] */ push_rowadd( top_estack, Integer2Index, Integer1Index ); /* Now have [18,34;13,24] */ VarStore( m5+3, STOF_ESI, 0, top_estack ); TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001