 |
init_matrix_indices |
Function (ROM Call 0x2BB) |
ESI *init_matrix_indices (ESI *indices, CESI expr); |
Computes and stores the indices of the elements of a matrix.
init_matrix_indices stores the index of the first element of the first row to indices, then
it repeatedly calls next_expression_index and
stores the result to indices until the END_TAG
for the whole matrix is reached.
expr is assumed to point to a double LIST_TAG.
init_matrix_indices returns indices.
Here is an example (called "Matrix elements") which displays the matrix elements as returned by
init_matrix_indices:
// Shows how the init_matrix_indices function works.
#define USE_TI89 // Compile for TI-89
#define USE_TI92PLUS // Compile for TI-92 Plus
#define USE_V200 // Compile for V200
#define MIN_AMS 101 // Compile for AMS 1.01 or higher
#define SAVE_SCREEN // Save/Restore LCD Contents
#include <tigcclib.h> // Include All Header Files
// The [1, 0; 0, 1] matrix.
static const ESQ matrix_identity_2[16] = {END_TAG, END_TAG, 0x01, 0x01, POSINT_TAG, 0x00, POSINT_TAG, LIST_TAG, END_TAG, 0x00, POSINT_TAG, 0x01, 0x01, POSINT_TAG, LIST_TAG, LIST_TAG};
// Main Function
void _main(void)
{
ESI elements[4];
HANDLE h;
TRY
ClrScr();
DrawStr (0, 0, "The elements of matrix", A_NORMAL);
DrawStr (0, 20, "are", A_NORMAL);
// Print whole expression.
h = Parse1DExpr (matrix_identity_2 + 15, FALSE, 0);
DrawStr(0, 10, HeapDeref(h), A_NORMAL);
HeapFree(h);
// Get the individual constituents of the expression and print them.
init_matrix_indices(elements, matrix_identity_2 + 15);
h = Parse1DExpr (elements[0], FALSE, 0);
DrawStr(0, 30, HeapDeref(h), A_NORMAL);
HeapFree(h);
h = Parse1DExpr (elements[1], FALSE, 0);
DrawStr(0, 40, HeapDeref(h), A_NORMAL);
HeapFree(h);
h = Parse1DExpr (elements[2], FALSE, 0);
DrawStr(0, 50, HeapDeref(h), A_NORMAL);
HeapFree(h);
h = Parse1DExpr (elements[3], FALSE, 0);
DrawStr(0, 60, HeapDeref(h), A_NORMAL);
HeapFree(h);
ONERR
DrawStr (0, 70, "Error!", A_NORMAL);
ENDTRY
GKeyIn (NULL, 0);
}
Uses: next_expression_index
Used by: get_matrix_indices, push_lu_fact, push_symbolic_qr_fact