retrieve an indexing function code 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/RTableIndFn

RTableIndFn - retrieve an indexing function code in external code

RTableIndFnArgs - retrieve arguments for an indexing function code in external code

Calling Sequence

RTableIndFn(kv, rt, i)

RTableIndFnArgs(kv, rt, i)




kernel handle returned by StartMaple



Maple rtable object



ith indexing function in an rtable



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


The RTableIndFn function returns the RTABLE_INDEX_* code denoting the kind of indexing function used by the rtable rt.  Since rtables can have more than one indexing function, the parameter i specifies which index function to examine.  Use MapleNumArgs on the RTableSettings indexing_functions field to determine the number of indexing functions an rtable has.  Typically an rtable has no indexing functions.


Some indexing functions have extra data associated with them.  For example band is usually denoted band[p1,p2] where p1 and p2 are the number of diagonals above and below the main diagonal.  These extra arguments can be retrieved using RTableIndFnArgs.


Public Sub MyScalarMultiply(ByVal kv As Long)

    Dim rts As RTableSettings

    Dim rt As Long

    Dim scalar As Double

    Dim i, j, m, n As Long

    Dim index(0 To 1) As Long

    ' original rtable

    rt = EvalMapleStatement(kv, _


    ' scalar to element-wise multiply

    scalar = 2

    RTableGetSettings kv, rts, rt

    m = RTableUpperBound(kv, rt, 1)

    n = RTableUpperBound(kv, rt, 2)

    If rts.data_type = RTABLE_FLOAT64 _

       And MapleNumArgs(kv, rts.index_functions) = 1 _

       And RTableIndFn(kv, rt, 1) = RTABLE_INDEX_DIAGONAL _


        ' handle diagonal shape more efficiently

        If m < n Then

            n = m

        End If

        For i = 1 To n

            index(0) = i

            index(1) = i

            RTableAssignFloat64 kv, rt, index(0), _

                RTableSelectFloat64(kv, rt, index(0)) * scalar

        Next i

    ElseIf rts.data_type = RTABLE_FLOAT64 Then

        For i = 1 To m

            index(0) = i

            For j = 1 To n

                index(1) = j

                RTableAssignFloat64 kv, rt, index(0), _

                    RTableSelectFloat64(kv, rt, index(0)) * scalar

            Next j

        Next i

    End If

    MapleALGEB_Printf1 kv, "rtable = %a", rt

End Sub

See Also

OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, rtable, rtable_indexingfunctions, rtable_indfns, trademarks

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