RTableCopy - Maple Help

Online Help

All Products    Maple    MapleSim


RTableCopy

copy an rtable in external code

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

RTableCopy(kv, rts, rt)

Parameters

kv

-

kernel handle of type MKernelVector

rts

-

pointer to an RTableSettings structure

rt

-

type ALGEB rtable object

Description

• 

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

• 

RTableCopy creates a new rtable with the data copied from the given rtable, rt, and the settings specified in rts.

• 

After calling RTableCopy, rts->num_dimensions is updated to the match the copied rtable.  It is not possible to change the number of dimensions setting for the target rtable.

Examples

    #include "maplec.h"

    ALGEB M_DECL MyScalarAdd( MKernelVector kv, ALGEB *args )

    {

    M_INT argc, i;

    RTableSettings rts;

    ALGEB rt;

    FLOAT64 *data, val;

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

    if( argc != 2 ) {

        MapleRaiseError(kv,"two arguments expected");

            return( NULL );

        }

    if( !IsMapleRTable(kv,args[1]) ) {

        MapleRaiseError(kv,"rtable expected");

            return( NULL );

        }

    val = MapleToFloat64(kv,args[2]);

    RTableGetDefaults(kv,&rts);

    rts.data_type = RTABLE_FLOAT64;

    rts.storage = RTABLE_RECT;

    rt = RTableCopy(kv,&rts,args[1]);

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

    for( i=0; i<RTableNumElements(kv,rt); ++i ) {

        data[i] += val;

    }

    return( rt );

    }

Execute the external function from Maple.

withExternalCalling&colon;

dllExternalLibraryNameHelpExamples&colon;

scaddDefineExternalMyScalarAdd&comma;dll&colon;

MLinearAlgebraIdentityMatrix4

M1000010000100001

(1)

N1scaddM&comma;1

N10.−1.−1.−1.−1.0.−1.−1.−1.−1.0.−1.−1.−1.−1.0.

(2)

N2scaddM&comma;1

N22.1.1.1.1.2.1.1.1.1.2.1.1.1.1.2.

(3)

See Also

CustomWrapper

define_external

OpenMaple

OpenMaple/C/API

OpenMaple/C/Examples

rtable