11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

330 • Chapter 7: <strong>Advanced</strong> ConnectivityMapleTableAlloc creates a TABLE dag. The table is initially empty.MapleTableAssign sets the ind element of the given table to thevalue val. That is, table[ind] := val, where ind can be a NAME or anexpression sequence of numbers, or any other valid index into a Mapletable.MapleTableSelect returns the ind element of the given table.MapleTableDelete removes the ind element from the table.MapleTableHasEntry queries the table to determine whether it containsan element at index ind. If it does, TRUE is returned; otherwise,FALSE is returned.Data Selection The following functions are available when using theC API only and deal with selecting from various kinds of Maple datastructures.ALGEB MapleSelectImaginaryPart( MKernelVector kv, ALGEB s );ALGEB MapleSelectRealPart( MKernelVector kv, ALGEB s );ALGEB MapleSelectIndexed( MKernelVector kv, ALGEB s, M_INTdim, M_INT *ind );MapleSelectImaginaryPart and MapleSelectRealPart return theimaginary and real parts of a complex number dag, respectively.MapleSelectIndexed returns a value from any indexable object inMaple, such as list, array, or set. The index is specified by filling theind array with the desired index. The second parameter dim is the numberof dimensions in the array s (also the number of elements in ind).For example, to lookup a[1,2,3], the following code could be used(assuming arg1 points to the array a).ALGEB val;M_INT ind[3];ind[0] = 1;ind[1] = 2;ind[2] = 3;val = k->selectIndexed(arg1, 3, ind);Unique DataThe following function is available only in the C API.ALGEB MapleUnique( MKernelVector kv, ALGEB s );This function processes the given Maple expression s, and returnsthe unique copy of that expression from the Maple simpl table. For

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!