Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
RTableCreate - create an rtable in external code
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.
See Also
CustomWrapper, define_external, OpenMaple, OpenMaple/C/API, OpenMaple/C/Examples, rtable
Download Help Document