provide real view of a complex Matrix, Vector, or Array
rectangular storage Matrix, Vector, or Array of data type complex or complex(sfloat)
The ComplexAsFloat(A) command provides a double-size real view of an existing Matrix, Vector, or Array of complex or complex(sfloat) data type. The input Matrix, Vector, or Array must have rectangular (dense) storage.
ComplexAsFloat does not change the underlying data of the input rtable object. Instead, ComplexAsFloat casts it to an rtable object with the same specifications, the corresponding float datatype, and double the size in one of the dimensions of the input rtable. As such, changes to the contents of the view also affect the contents of the original input rtable, and vice-versa.
If the original Matrix, Vector, or Array has been unassigned, it will still exist in the attributes of the real view, but changing the data will only affect the current view.
Important: Use this function with caution. If you remove the table reference from the attributes and unassign the original input object, accessing or changing the data in the view will crash Maple. If a persistent and permanent copy of the data is desired, then this command can be used in combination with copy or ArrayTools:-Copy.
The layout of the output view from ComplexAsFloat is different for C_order and Fortran_order input, as indicated in the following description.
If the input rtable is C_order, then the last dimension of the input is doubled on output, and the real and imaginary parts of the input are interleaved (alternating) with respect to the last dimension. For example, calling ComplexAsFloat with a C_order 3 x 4 Matrix results in a 3 x 8 Matrix where the odd columns contain the real parts of the input Matrix, and the even columns contain the imaginary parts (see the Examples section).
If the input rtable is Fortran_order, then the first dimension of the input is doubled on output, and the real and imaginary parts of the input are interleaved (alternating) with respect to the first dimension. For example, calling ComplexAsFloat with a Fortran_order 3 x 4 Matrix results in a 6 x 4 Matrix where the odd rows contain the real parts of the input Matrix, and the even rows contain the imaginary parts (see the Examples section).
This command can be used in combination with ArrayTools:-Fill to clear or set the real or imaginary parts of a complex Matrix, or can be used in combination with ArrayTools:-Copy to efficiently extract the real or imaginary parts of a complex Matrix.
This function is part of the ArrayTools package, so it can be used in the short form ComplexAsFloat(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[ComplexAsFloat](..).
C_order 3 x 4 Matrix
Use the Fill command to clear imaginary part only. Note this affects A and Ar.
Use the Copy command to extract the real part to an existing Matrix.
Fortran_order 3 x 4 Matrix
Download Help Document
What kind of issue would you like to report? (Optional)