RTableCopy
copy an rtable in external code
Calling Sequence
Parameters
Description
Examples
RTableCopy(kv, rts, rt)
kv
-
kernel handle of type MKernelVector
rts
pointer to an RTableSettings structure
rt
type ALGEB rtable object
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.
#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");
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.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
scadd≔DefineExternal⁡MyScalarAdd,dll:
M≔LinearAlgebraIdentityMatrix⁡4
M≔1000010000100001
N1≔scadd⁡M,−1
N1≔0.−1.−1.−1.−1.0.−1.−1.−1.−1.0.−1.−1.−1.−1.0.
N2≔scadd⁡M,1
N2≔2.1.1.1.1.2.1.1.1.1.2.1.1.1.1.2.
See Also
CustomWrapper
define_external
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
rtable
Download Help Document