RTableCreate - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : C Application Programming Interface : RTable Manipulation : OpenMaple/C/RTableCreate

RTableCreate

create an rtable in external code

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

RTableCreate(kv, rts, pdata, bounds)

Parameters

kv

-

kernel handle of type MKernelVector

rts

-

pointer to an RTableSettings structure

pdata

-

pointer to array data (optional)

bounds

-

array of lower and upper bounds

Description

• 

This function can be used in external code with OpenMaple or define_external.

• 

RTableCreate creates a new rtable with the settings specified in rts.

• 

If pdata is NULL, then a data block is allocated and initialized to rts->fill. When specifying a previously created block of data (that is, when pdata is not NULL), it is important that rts->foreign is set to TRUE. Size, storage, data_type, order, and indexing functions must all be considered when managing your data block. It is recommended that you let Maple create the data block, then use RTableDataBlock to create a pointer to it.

• 

The array, bounds is a list of the lower and upper bounds for each dimension of the rtable.  For example, a MxN Matrix has bounds[0] = 1; bounds[1] = M; bounds[2] = 1; bounds[3] = N.

  

Note: Matrix and Vector lower bounds must start at 1, not 0.

Examples

    #include "maplec.h"

    ALGEB M_DECL MyIdentity( MKernelVector kv, ALGEB *args )

    {

    M_INT argc, n, i;

    RTableSettings rts;

    M_INT bounds[4];

    ALGEB rt;

    INTEGER32 *data;

    argc = MapleNumArgs(kv,(ALGEB)args);

    if( argc != 1 ) {

        MapleRaiseError(kv,"one argument expected");

            return( NULL );

        }

    n = MapleToM_INT(kv,args[1]);

    RTableGetDefaults(kv,&rts);

    rts.num_dimensions = 2;

    rts.subtype = RTABLE_MATRIX;

    rts.data_type = RTABLE_INTEGER32;

    bounds[0] = 1;

    bounds[1] = n;

    bounds[2] = 1;

    bounds[3] = n;

    rt = RTableCreate(kv,&rts,NULL,bounds);

    data = (INTEGER32*)RTableDataBlock(kv,rt);

    for( i=1; i<=n; ++i ) {

        data[MATRIX_OFFSET_FORTRAN_RECT(i,i,n,n)] = 1;

    }

    return( rt );

    }

Execute the external function from Maple.

withExternalCalling&colon;

dllExternalLibraryNameHelpExamples&colon;

eyeDefineExternalMyIdentity&comma;dll&colon;

Meye3

M:=100010001

(1)

rtable_optionsM&comma;datatype

integer4

(2)

See Also

CustomWrapper

define_external

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples

rtable

 


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