MapleSelectIndexed - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : C Application Programming Interface : Assignment and Selection Functions : OpenMaple/C/MapleSelectIndexed

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

Calling Sequence

MapleSelectIndexed(kv, s, n, ind)

MapleSelectImaginaryPart(kv, s)

MapleSelectRealPart(kv, s)

Parameters

kv

-

kernel handle of type MKernelVector

s

-

type ALGEB indexable object

n

-

length of ind

ind

-

index array

Description

• 

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.

Examples

    #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.

withExternalCalling&colon;

dllExternalLibraryNameHelpExamples&colon;

reDefineExternalMyRe&comma;dll&colon;

re3&comma;1I&comma;22I&comma;33I

1&comma;2&comma;3

(1)

re3&comma;1I&comma;22I&comma;33I

1&comma;2&comma;3

(2)

re3&comma;1I&comma;22I&comma;33I

1&comma;2&comma;3

(3)

re3&comma;table1&equals;1I&comma;2&equals;22I&comma;3&equals;33I

1&comma;2&comma;3

(4)

See Also

CustomWrapper

define_external

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam