11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.2 Using Compiled Code in Maple • 325The Fortran equivalent function is convert_to_rtable. It creates anrtable from an existing Fortran array. The data is not copied into thetable. Instead, the rtable maintains a pointer to the external data.RtableNumElements returns the number of elements in a givenrtable. This may be different in sparse versus dense rtables.1. For dense rtables, return the number of elements of storage allocatedfor this rtable.2. If rt is in NAG-sparse format, then this returns the number of elementsin the data vector specified for the rtable, (which is the sameas the length of each index vector). Note that the number returnedhere represents the number of data elements that are actually filledin, not the number of elements allocated. Some of the elements mayhave the value zero.3. For Maple-sparse rtables, this always returns zero.RtableNumDimensions returns the number of dimensions in a givenrtable.RtableUpperBound and RtableLowerBound give the upper and lowerbound of the dimth dimension of the RTABLE, rt. For a 2 x 3 matrix,RtableLowerBound(rt,1) returns 1 since the first dimension bounds are1..2, and the lower bound is 1.RtableIsReal checks the elements of the RTABLE rt to see if theyare all real. If there are imaginary numbers present this returns FALSE.If there are only real numbers, this returns TRUE. Note that this routinereturns immediately when given a non-complex hardware type.In addition to the above functions, there is an extensive C API forworking rtable data types.void RTableAppendAttribute( MKernelVector kv, RTableSettings*s, char *name );void RTableAppendIndFn( MKernelVector kv, RTableSettings*s, ALGEB indfn );void RTableGetDefaults( MKernelVector kv, RTableSettings*s );void RTableGetSettings( MKernelVector kv, RTableSettings*s, ALGEB rt );M_INT RTableIndFn( MKernelVector kv, ALGEB rt, M_INT num );ALGEB RTableIndFnArgs( MKernelVector kv, ALGEB rt, M_INT num );void RTableSetAttribute( MKernelVector kv, RTableSettings*s, char *name );

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

Saved successfully!

Ooh no, something went wrong!