complex2mat {complex} | R Documentation |
Functions to manipulate complex variables and matrices
Description
complex2mat()
constructs a matrix from the provided complex variable,
while complex2vec()
returns a vector (in mathematical sense), both of them
split the real and imaginary parts. mat2complex()
and vec2complex()
do
the reverse of the respective functions. See details for explanation.
Usage
complex2mat(x)
complex2vec(x)
mat2complex(x)
vec2complex(x)
Arguments
x |
vector or matrix of complex variables. |
Details
Complex variable x + iy can be represented as a vector (x y)' or as a matrix: (x -y) (y x)
complex2mat()
returns the latter, while complex2vec()
returns the
former. If a user provides a vector of complex variables, the values are stacked above
each other. If a matrix is provided, a higher dimensional matrix is returned.
mat2complex()
and vec2complex()
return complex variables based on provided
matrix.
The function is needed to calculate some statistics for complex variables in vector form.
Value
A matrix with real and imaginary parts of x split into columns (and rows in case
of complex2mat()
).
#' @references
Svetunkov, S. & Svetunkov I (2022) Complex Autoregressions. In Press.
Author(s)
Ivan Svetunkov, ivan@svetunkov.ru
References
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
See Also
Examples
# Generate random complex variables
x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10))
# Get a matrix and a vector for one value
complex2mat(x[1])
complex2vec(x[1])
# Get matrices for all values
complex2mat(x)
complex2vec(x)