test if an rtable contains only real data 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/RTableIsReal

RTableIsReal - test if an rtable contains only real data in external code

RTableCopyImPart - create a copy of only the imaginary part of a complex rtable in external code

RTableCopyRealPart - create a copy of only the real part of a complex rtable in external code

RTableZipReIm - combine two rtables into a single complex rtable in external code

Calling Sequence

RTableIsReal(kv, rt)

RTableCopyImPart(kv, rts, rt)

RTableCopyRealPart(kv, rts, rt)

RTableZipReIm(kv, rts, rt_re, rt_im)

Parameters

kv

-

kernel handle returned by StartMaple

rt, rt_re, rt_im

-

Maple rtable objects

rts

-

RTableSettings structure

Description

• 

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

• 

The RTableIsReal function tests if a rtable contains only real-valued numeric data. Data is scanned only for rtables with data_type = RTABLE_DAG.  When the data_type is RTABLE_COMPLEX or RTABLE_CXDAG, FALSE is immediately returned.  For all other data_types, TRUE is immediately returned.

• 

The RTableCopyRealPart function creates a new rtable containing only the real part of complex numeric data in the rtable rt.  The new rtable has the settings in the supplied OpenMaple/VB/RTableSettings structure.

• 

The RTableCopyImPart function creates a new rtable containing only the imaginary part of complex numeric data in the rtable rt.  The result is an ordinary rtable of numeric data.  If the specified data_type of rt is RTABLE_CXDAG or RTABLE_COMPLEX, the new rtable has 0s in the imaginary part, and the copied data in the real part. The new rtable has the settings in the supplied OpenMaple/VB/RTableSettings structure.

• 

The RTableZipReIm function combines two real numeric rtables rt_re and rt_im into a complex rtable of the form rt_re + I*rt_im. Both rtables must be the same size.  The new rtable has the settings in the supplied OpenMaple/VB/RTableSettings structure, provided such settings allow for storage of complex data.

Examples

Public Sub TestRTableMisc(ByVal kv As Long)

    Dim rt, re, im, rt2 As Long

    Dim index(0 To 1) As Long

    Dim rts As RTableSettings

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

    If Not RTableIsReal(kv, rt) Then

        RTableGetDefaults kv, rts

        rts.data_type = RTABLE_FLOAT64

        rts.storage = RTABLE_RECT

        ' split the real and imaginary parts

        re = RTableCopyRealPart(kv, rts, rt)

        im = RTableCopyImPart(kv, rts, rt)

        ' zip them back together

        rts.data_type = RTABLE_COMPLEX64

        rt2 = RTableZipReIm(kv, rts, re, im)

        MapleALGEB_Printf3 kv, "rtables = %a, %a, %a", re, im, rt2

    End If

End Sub

See Also

LinearAlgebra[Zip], OpenMaple, OpenMaple/VB/API, OpenMaple/VB/Examples, rtable, 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