MapleSelectIndexed
select from a table, list, or rtable in external code
MapleSelectImaginaryPart
select the imaginary part of a complex-valued expression in external code
MapleSelectRealPart
select the real part of a complex-valued expression in external code
Calling Sequence
Parameters
Description
Examples
MapleSelectIndexed(kv, s, n, ind)
MapleSelectImaginaryPart(kv, s)
MapleSelectRealPart(kv, s)
kv
-
kernel handle of type MKernelVector
s
type ALGEB indexable object
n
length of ind
ind
index array
These functions can be used in external code with OpenMaple or define_external.
MapleSelectIndexed retrieves the element s[ind], where s is a list, set, table, or rtable object. The index is an integer array. To reference s[1,2], set ind[0] = 1, and ind[1] = 2;.
MapleSelectImaginaryPart returns the imaginary part of s. MapleSelectRealPart returns the real part of s. These commands are equivalent to the Maple Im and Re commands.
#include "maplec.h"
ALGEB M_DECL MyRe( MKernelVector kv, ALGEB *args )
{
ALGEB list, val;
char *code;
M_INT i, n, index[1];
if( MapleNumArgs(kv,(ALGEB)args) != 2 ) {
MapleRaiseError(kv,"two arguments expected");
return( NULL );
}
n = MapleToM_INT(kv,args[1]);
list = MapleListAlloc(kv,n);
for( i=1; i<=n; ++i ) {
index[0] = i;
val = MapleSelectIndexed(kv,args[2],1,index);
MapleListAssign(kv,list,i,MapleSelectRealPart(kv,val));
return( list );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
re≔DefineExternal⁡MyRe,dll:
re⁡3,1−I,2−2⁢I,3−3⁢I
1,2,3
re⁡3,table⁡1=1−I,2=2−2⁢I,3=3−3⁢I
See Also
CustomWrapper
define_external
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document