ComplexToReal - Maple Help

SignalProcessing

 ComplexToReal
 split a complex rtable into rtables of the real and imaginary parts
 RealToComplex
 join two real rtables of real and imaginary parts into one complex rtable

 Calling Sequence ComplexToReal( Data ) ComplexToReal( Data, containers = [ ContainerReal, ContainerImaginary ] ) RealToComplex( DataReal, DataImaginary ) RealToComplex( DataReal, DataImaginary, container = Container )

Parameters

 Data - list or rtable with entries of type complexcons. ContainerReal - (optional) rtable of datatype float[8] to store the real part of Data. ContainerImaginary - (optional) rtable of datatype float[8] to store the imaginary part of Data. DataReal - list or rtable with entries of type realcons. DataImaginary - list or rtable with entries of type realcons. Container - (optional) rtable of datatype complex[8] to store the combined complex numbers represented by DataReal and DataImaginary.

Description

 • The ComplexToReal command takes a list or rtable of complex entries, and returns rtables with the real and imaginary parts.
 • The RealToComplex command takes two lists/rtables of real entries, representing the real and imaginary parts, and returns an rtable with the combined complex entries.
 • Any passed rtables must have the same order (C_order or Fortran_order), have no indexing function, and use rectangular storage.
 • Any passed rtables must have the same number of elements, but need not have the same dimensions. Internally, one-dimensional aliases of the rtables are used.
 • When no container is passed for storage, the output of ComplexToReal or RealToComplex is an rtable of the same subtype and dimenensions as the first input rtable.
 • The input container Data is converted to an rtable of datatype complex[8], and the input containers DataReal and DataImaginary are converted to rtables of datatype float[8]. For this reason, it is more efficient to pass containers already having the appropriate datatypes.
 • The ComplexToReal and RealToComplex commands are not thread safe.
 • As the underlying implementation of the SignalProcessing package is a module, it is also possible to use the forms SignalProcessing:-ComplexToReal and SignalProcessing:-RealToComplex to access the commands from the package. For more information, see Module Members.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$

Example 1

 > $A≔\mathrm{Vector}\left(\left[1+2I,3+4I\right],\mathrm{datatype}=\mathrm{complex}\left[8\right]\right)$
 ${A}{≔}\left[\begin{array}{c}{1.}{+}{2.}{}{I}\\ {3.}{+}{4.}{}{I}\end{array}\right]$ (1)
 > $\mathrm{ComplexToReal}\left(A\right)$
 $\left[\begin{array}{c}{1.}\\ {3.}\end{array}\right]{,}\left[\begin{array}{c}{2.}\\ {4.}\end{array}\right]$ (2)

Example 2

 • Containers can be passed to store the real and imaginary parts:
 > $A≔\mathrm{Matrix}\left(\left[\left[1+5I,2+6I\right],\left[3+7I,4+8I\right]\right],\mathrm{datatype}=\mathrm{complex}\left[8\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{1.}{+}{5.}{}{I}& {2.}{+}{6.}{}{I}\\ {3.}{+}{7.}{}{I}& {4.}{+}{8.}{}{I}\end{array}\right]$ (3)
 > $B≔\mathrm{Matrix}\left(2,2,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $C≔\mathrm{Matrix}\left(2,2,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{ComplexToReal}\left(A,\mathrm{containers}=\left[B,C\right]\right):$
 > $'B'=B$
 ${B}{=}\left[\begin{array}{cc}{1.}& {2.}\\ {3.}& {4.}\end{array}\right]$ (4)
 > $'C'=C$
 ${C}{=}\left[\begin{array}{cc}{5.}& {6.}\\ {7.}& {8.}\end{array}\right]$ (5)

Example 3

 • Different types of rtables can be passed, provided they are compatible:
 > $A≔\mathrm{Vector}\left[\mathrm{row}\right]\left(\left[-3,5\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{-3.}& {5.}\end{array}\right]$ (6)
 > $B≔\mathrm{Vector}\left[\mathrm{column}\right]\left(\left[4,-7\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${B}{≔}\left[\begin{array}{c}{4.}\\ {-7.}\end{array}\right]$ (7)
 > $C≔\mathrm{Array}\left(1..2,\mathrm{datatype}=\mathrm{complex}\left[8\right]\right):$
 > $\mathrm{RealToComplex}\left(A,B,\mathrm{container}=C\right):$
 > $'C'=C$
 ${C}{=}\left[\begin{array}{cc}{-3.}{+}{4.}{}{I}& {5.}{-}{7.}{}{I}\end{array}\right]$ (8)

Compatibility

 • The SignalProcessing[ComplexToReal] and SignalProcessing[RealToComplex] commands were introduced in Maple 2021.