retrieve an element of an rtable in external code - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : VB Application Programming Interface : RTable Manipulation : OpenMaple/VB/RTableSelect

RTableSelect* - retrieve an element of an rtable in external code

RTableAssign* - assign into an rtable in external code

Calling Sequence

RTableSelectDAG(kv, rt, index)

RTableSelectComplexDAG(kv, rt, index)

RTableSelectInteger8(kv, rt, index)

RTableSelectInteger16(kv, rt, index)

RTableSelectInteger32(kv, rt, index)

RTableSelectFloat32(kv, rt, index)

RTableSelectFloat64(kv, rt, index)

RTableSelectComplexFloat64(kv, rt, index)

RTableAssignDAG(kv, rt, index, val)

RTableAssignComplexDAG(kv, rt, index, val)

RTableAssignInteger8(kv, rt, index, val)

RTableAssignInteger16(kv, rt, index, val)

RTableAssignInteger32(kv, rt, index, val)

RTableAssignFloat32(kv, rt, index, val)

RTableAssignFloat64(kv, rt, index, val)

RTableAssignComplexFloat64(kv, rt, index, val)

Parameters

kv

-

kernel handle returned by StartMaple

rt

-

Maple rtable object

index

-

integer array denoting the element index

val

-

value of type corresponding to the command name

Description

• 

These functions are part of the OpenMaple interface to Microsoft Visual Basic.

• 

The RTableSelect family of functions extract the element at index from the rtable rt.  The RTableAssign family of functions sets the element at index in the rtable rt to val.

• 

These functions are especially useful for extracting elements from rtables with indexing functions or unusual storage.  For example, the data-block of a symmetric Matrix may be missing half the elements, so direct indexing can be complicated. This is automatically handled when using RTableSelect and RTableAssign.

• 

The value val set by RTableAssign, and returned by RTableSelect must exactly correspond to the rtable data_type. The following table describes how the types and functions are related.

 

 

 

VB TYPE

NAME

RTABLE DATA-TYPE

 

 

 

Byte

RTableSelectInteger8

RTABLE_INTEGER8

Integer

RTableSelectInteger16

RTABLE_INTEGER16

Long

RTableSelectInteger32

RTABLE_INTEGER32

Single

RTableSelectFloat32

RTABLE_FLOAT32

Double

RTableSelectFloat64

RTABLE_FLOAT64

Complex64

RTableSelectComplexFloat64

RTABLE_COMPLEX

ComplexDAG

RTableSelectComplexDAG

RTABLE_CXDAG

Long

RTableSelectDAG

RTABLE_DAG

 

 

 

Examples

Public Sub MySwapRow(ByVal kv As Long)

    Dim rt, valA, valB As Long

    Dim indexA(0 To 1) As Long

    Dim indexB(0 To 1) As Long

    Dim rts As RTableSettings

    Dim rowA, rowB As Long

    ' input (rtable and rows to swap)

    rt = EvalMapleStatement(kv, "Matrix(5,5,(i,j)->i);")

    rowA = 2

    rowB = 4

    RTableGetSettings kv, rts, rt

    If rts.num_dimensions = 2 _

        And rts.data_type = RTABLE_DAG _

        And Not rts.read_only _

    Then

        ' swap rows A and B

        indexA(0) = rowA

        indexB(0) = rowB

        For i = RTableLowerBound(kv, rt, 2) To RTableUpperBound(kv, rt, 2)

            indexA(1) = i

            indexB(1) = i

            valA = RTableSelectDAG(kv, rt, indexA(0))

            valB = RTableSelectDAG(kv, rt, indexB(0))

            RTableAssignDAG kv, rt, indexA(0), valB

            RTableAssignDAG kv, rt, indexB(0), valA

        Next i

    End If

    MapleALGEB_Printf1 kv, "rtable after swap = %a", rt

End Sub

See Also

OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, rtable


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam