RTableIndFn - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


RTableIndFn

retrieve an indexing function code in external code

RTableIndFnArgs

retrieve arguments for an indexing function code in external code

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

RTableIndFn(kv, rt, i)

RTableIndFnArgs(kv, rt, i)

Parameters

kv

-

kernel handle returned by StartMaple

rt

-

Maple rtable object

i

-

ith indexing function in an rtable

Description

• 

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.

Examples

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, _

       "Matrix(4,4,(i,j)->i,datatype=float[8],shape=diagonal);")

    ' 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 _

    Then

        ' 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