View source: R/complex2Matrix.R
complex2mat | R Documentation |
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.
complex2mat(x)
complex2vec(x)
mat2complex(x)
vec2complex(x)
x |
vector or matrix of complex variables. |
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.
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.
Ivan Svetunkov, ivan@svetunkov.com
Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.
clm
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.