RTableNumElements
query the number of elements in an rtable in external code
Calling Sequence
Parameters
Description
Examples
RTableNumElements(kv, rt)
kv
-
kernel handle returned by StartMaple
rt
Maple rtable object
This function is part of the OpenMaple interface to Microsoft Visual Basic.
The RTableNumElements function returns the number of elements in the rtable rt. This command is equivalent to calling rtable_num_elems with the Stored option.
For dense rtables, this command returns the number of elements of storage allocated. For example, a 2x2 rectangular rtable has 4 elements.
For NAG-sparse format rtables (all hardware datatype sparse storage rtables), this command returns the number of elements in the data vector specified, which is the same as the length of each index vector. Note that the number returned in this case is the number of data elements filled, not the number of elements allocated. For information and restrictions on this format, see ?sparse.
For Maple-sparse rtables, this command returns zero.
Public Sub TestRTableNumElements(ByVal kv As Long)
Dim rt As Long
Dim index(0 To 1) As Long
rt = EvalMapleStatement(kv, _
"Matrix(500,storage=sparse,datatype=float[8]);")
' writes 0 (no stored elements -- sparse format)
Write #1, RTableNumElements(kv, rt)
' assign a value in the sparse Matrix
index(0) = 39
index(1) = 271
RTableAssignFloat64 kv, rt, index(0), 1.1
' writes 1
End Sub
See Also
OpenMaple
OpenMaple/VB/API
OpenMaple/VB/Examples
rtable
Download Help Document