create an rtable in external code
RTableCreateDefault(kv, rts, zero, bounds)
RTableCreateDAG(kv, rts, pdata, bounds)
RTableCreateInteger8(kv, rts, pdata, bounds)
RTableCreateInteger16(kv, rts, pdata, bounds)
RTableCreateInteger32(kv, rts, pdata, bounds)
RTableCreateFloat32(kv, rts, pdata, bounds)
RTableCreateFloat64(kv, rts, pdata, bounds)
RTableCreateComplexDAG(kv, rts, pdata, bounds)
RTableCreateComplex64(kv, rts, pdata, bounds)
kernel handle returned by StartMaple
pointer to an RTableSettings structure
pointer to array data
array of lower and upper bounds
These functions are part of the OpenMaple interface to Microsoft Visual Basic.
The RTableCreate function creates a new rtable with the settings specified in rts.
When using RTableCreateDefault the pdata must be set to 0. In this case a data block is allocated and initialized to rts.fill. When using the other RTableCreate functions, you must specify a previously created block of data. 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.
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 = 1; bounds = M; bounds = 1; bounds = N.
The 2-D format of VB Arrays do not match the Maple rtable data-block memory layout, so pdata must be a pointer to a 1-D Array. 2-D can be achieved using a 1-D Array by simple arithmetic on the index.
Note: Matrix and Vector lower bounds must start at 1, not 0.
Public Sub TestRTableCreate(ByVal kv As Long)
Dim rts As RTableSettings
Dim rt As Long
Dim bounds(4) As Long
Dim data(16) As Long
Dim n, i, j As Long
' fill in the settings
RTableGetDefaults kv, rts
rts.num_dimensions = 2
rts.subtype = RTABLE_MATRIX
rts.data_type = RTABLE_INTEGER32
rts.foreign = True
rts.order = RTABLE_FORTRAN
n = 4
bounds(0) = 1
bounds(1) = n
bounds(2) = 1
bounds(3) = n
' create the rtable
rt = RTableCreateInteger32(kv, rts, data(0), bounds(0))
' fill the diagonal with ones
For i = 0 To n - 1
data(n * i + i) = 1
MapleALGEB_Printf1 kv, "rtable = %a", rt
Download Help Document
What kind of issue would you like to report? (Optional)