RTableCopy - copy an rtable in external code
|
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
|
|
•
|
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.
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
|
|
Download Help Document
Was this information helpful?