Skip to contents

Generate a multi-companion matrix or its Jordan decomposition from spectral parameters.

Usage

make_mcmatrix(type = "real", what.res = "matrix", ..., eigval0)

make_mcchains(eigval, co, dim, len.block, eigval0 = FALSE,
              mo.col = NULL, what.co = "bottom", ...)

Arguments

eigval

the eigenvalues, a numeric vector

co

the seeding parameters for the eigenvectors, a matrix

dim

the dimension of the matrix, a positive integer

len.block

lengths of Jordan chains, len.block[i] is for eigval[i]

type

mode of the matrix, real or complex

what.res

format of the result, see details

eigval0

If TRUE completes the matrix to a square matrix, see details. eigval0 is ignored by make_mcmatrix (it always sets it to TRUE).

...

for make_mcmatrix, these are additional arguments to be passed to make_mcchains. For make_mcchains, arguments in "..." are passed on to mc_0chains.

mo.col

the last non-zero column in the top of the mc-matrix. The default is dim.

what.co

a character string equal to "bottom" (default) or "top", specifying whether the 'co' parameters give the last or the first few elements of the (generalised) eigenvectors.

Details

make_mcmatrix creates a multi-companion matrix specified by spectral parameters. make_mcchains creates a matrix of eigenvectors and generalised eigenvectors from the given spectral parameters.

make_mcmatrix passes the spectral parameters to make_mcchains to generate the (generalised) eigenvectors. It then calls Jordan_matrix to create the corresponding Jordan matrix. The results are combined to produce the multicompanion matrix. By default, the real part is returned, which is appropriate if all complex spectral parameters come in complex conjugate pairs. This may be changed by argument type. A list containing the matrix and the Jordan factors is returned if what.res = "list".

The closely related function sim_mc is like make_mcmatrix but it does not need complete specification of the matrix - it completes any missing information (eigenvalues, co) with randomly generated entries. The result of both functions is a list or ordinary matrix, use mCompanion to obtain a MultiCompanion object directly.

make_mcchains constructs the eigensystem, make_mcmatrix calls make_mcchains (passing the ... arguments to it) and forms the matrix. make_mcchains passes the ... arguments to mc_0chains.

make_mcchains creates the full eigenvectors from the co parameters. If the number of vectors is smaller then dim and eigval0 is TRUE it then completes the system with chains for the zero eigenvalue. More specifically, it assumes that the number of the given chains is mo.col, takes chains corresponding to the zero eigenvalue, if any, and adds additional eigenvectors and/or generalised eigenvectors to construct the complete system.

The mc-order is determined from the dimension of the 'co' parameters. If that is equal to dim, the mc-matrix is actually a general matrix.

TODO: cover the case mo < mo.col?

Value

make_mcmatrix normally returns the multi-companion matrix (as an ordinary matrix) having the given spectral properties but if

what.res = "list", it returns a list containing the matrix and the spectral information:

eigval

eigenvalues, a vector

len.block

lengths of Jordan chains, a vector

mo

multi-companion order, positive integer

eigvec

generalied eigenvectors, a matrix

co

seeding parameters

mo.col

top order

mat

the multi-companion matrix, a matrix

make_mcchains returns a similar list without the component

mat.

References

Boshnakov GN (2002). “Multi-companion matrices.” Linear Algebra Appl., 354, 53--83. ISSN 0024-3795, doi:10.1016/S0024-3795(01)00475-X .

Boshnakov GN, Iqelan BM (2009). “Generation of time series models with given spectral properties.” J. Time Series Anal., 30(3), 349--368. ISSN 0143-9782, doi:10.1111/j.1467-9892.2009.00617.x .

Author

Georgi N. Boshnakov

Note

The result is an ordinary matrix. Also, some entries that should be 0 may be non-zero due to numerical error.

To get a MultiCompanion object use mCompanion.

Examples

make_mcmatrix(eigval = c(1, 0.5), co = cbind(c(1,1), c(1, -1)), dim = 4,
              mo.col = 2,
              len.block = c(1, 1))
#>      [,1] [,2] [,3] [,4]
#> [1,] 0.75 0.25    0    0
#> [2,] 0.25 0.75    0    0
#> [3,] 1.00 0.00    0    0
#> [4,] 0.00 1.00    0    0

## one unit root, one root = 0.5
make_mcmatrix(eigval = c(1, 0.5), co = cbind(c(1,1), c(1, -1)), dim = 6,
              mo.col = 2,
              len.block = c(1, 1))
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.75 0.25    0    0    0    0
#> [2,] 0.25 0.75    0    0    0    0
#> [3,] 1.00 0.00    0    0    0    0
#> [4,] 0.00 1.00    0    0    0    0
#> [5,] 0.00 0.00    1    0    0    0
#> [6,] 0.00 0.00    0    1    0    0

## two simple unit roots, one root = 0.5
make_mcmatrix(eigval = c(1, 1, 0.5), co = cbind(c(1,1), c(1, -1), c(1, 1)), dim = 6,
              mo.col = 3,
              len.block = c(1, 1, 1))
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]  1.5    0 -0.5    0    0    0
#> [2,]  0.5    1 -0.5    0    0    0
#> [3,]  1.0    0  0.0    0    0    0
#> [4,]  0.0    1  0.0    0    0    0
#> [5,]  0.0    0  1.0    0    0    0
#> [6,]  0.0    0  0.0    1    0    0

## two unit roots with a single Jordan chain, one root = 0.5
make_mcmatrix(eigval = c(1, 0.5), co = cbind(c(1,1), c(0, 1), c(1, 1)), dim = 6,
              len.block = c(2, 1))
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1  0.5 -0.5    0    0    0
#> [2,]    0  1.5 -0.5    0    0    0
#> [3,]    1  0.0  0.0    0    0    0
#> [4,]    0  1.0  0.0    0    0    0
#> [5,]    0  0.0  1.0    0    0    0
#> [6,]    0  0.0  0.0    1    0    0


## make_mcchains
make_mcchains(c(1, 0.5), co = cbind(c(1,1), c(1, 1)), dim = 4,
              len.block = c(1, 1), eigval0 = TRUE)
#> $eigval
#> [1] 1.0 0.5 0.0 0.0
#> 
#> $len.block
#> [1] 1 1 1 1
#> 
#> $mo
#> [1] 2
#> 
#> $eigvec
#>      [,1] [,2] [,3] [,4]
#> [1,]    1  0.5    0    0
#> [2,]    1  0.5    0    0
#> [3,]    1  1.0    1    0
#> [4,]    1  1.0    0    1
#> 
#> $co
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    1
#> 
#> $mo.col
#> [1] 2
#> 

## one unit root, one root = 0.5
make_mcchains(c(1, 0.5), co = cbind(c(1,1), c(1, 1)), dim = 6,
              len.block = c(1, 1), eigval0 = TRUE)
#> $eigval
#> [1] 1.0 0.5 0.0 0.0
#> 
#> $len.block
#> [1] 1 1 2 2
#> 
#> $mo
#> [1] 2
#> 
#> $eigvec
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1 0.25    0    0    0    0
#> [2,]    1 0.25    0    0    0    0
#> [3,]    1 0.50    0    1    0    0
#> [4,]    1 0.50    0    0    0    1
#> [5,]    1 1.00    1    0    0    0
#> [6,]    1 1.00    0    0    1    0
#> 
#> $co
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    1
#> 
#> $mo.col
#> [1] 2
#> 

## two simple unit roots, one root = 0.5
make_mcchains(c(1, 1, 0.5), co = cbind(c(1,1), c(1, -1), c(1, 1)), dim = 6,
              len.block = c(1, 1, 1), eigval0 = TRUE)
#> $eigval
#> [1] 1.0 1.0 0.5 0.0 0.0
#> 
#> $len.block
#> [1] 1 1 1 2 1
#> 
#> $mo
#> [1] 2
#> 
#> $eigvec
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1    1 0.25    0    0    0
#> [2,]    1   -1 0.25    0    0    0
#> [3,]    1    1 0.50    0    0    0
#> [4,]    1   -1 0.50    0    1    0
#> [5,]    1    1 1.00    0    0    1
#> [6,]    1   -1 1.00    1    0    0
#> 
#> $co
#>      [,1] [,2] [,3]
#> [1,]    1    1    1
#> [2,]    1   -1    1
#> 
#> $mo.col
#> [1] 3
#> 

## two unit roots with a single Jordan chain, one root = 0.5
make_mcchains(c(1, 0.5), co = cbind(c(1,1), c(1, -1), c(1, 1)), dim = 6,
              len.block = c(2, 1), eigval0 = TRUE)
#> $eigval
#> [1] 1.0 0.5 0.0 0.0
#> 
#> $len.block
#> [1] 2 1 2 1
#> 
#> $mo
#> [1] 2
#> 
#> $eigvec
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    1    3 0.25    0    0    0
#> [2,]    1    1 0.25    0    0    0
#> [3,]    1    2 0.50    0    0    0
#> [4,]    1    0 0.50    0    1    0
#> [5,]    1    1 1.00    0    0    1
#> [6,]    1   -1 1.00    1    0    0
#> 
#> $co
#>      [,1] [,2] [,3]
#> [1,]    1    1    1
#> [2,]    1   -1    1
#> 
#> $mo.col
#> [1] 3
#> 



## examples with mc-order = dim
make_mcchains(c(1), co = cbind(c(1,1,1,1), c(1,2,1,1)), dim = 4,
              len.block = c(2), eigval0 = TRUE)
#> $eigval
#> [1] 1 0 0
#> 
#> $len.block
#> [1] 2 1 1
#> 
#> $mo
#> [1] 4
#> 
#> $eigvec
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    1    0    0
#> [2,]    1    2    0    0
#> [3,]    1    1    1    0
#> [4,]    1    1    0    1
#> 
#> $co
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    2
#> [3,]    1    1
#> [4,]    1    1
#> 
#> $mo.col
#> [1] 2
#> 
## do not complete with chians for the 0 eigval:
make_mcchains(c(1), co = cbind(c(1,1,1,1), c(1,2,1,1)), dim = 4,
              len.block = c(2), eigval0 = FALSE)
#> $eigval
#> [1] 1
#> 
#> $len.block
#> [1] 2
#> 
#> $mo
#> [1] 4
#> 
#> $eigvec
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    2
#> [3,]    1    1
#> [4,]    1    1
#> 
#> $co
#>      [,1] [,2]
#> [1,]    1    1
#> [2,]    1    2
#> [3,]    1    1
#> [4,]    1    1
#> 
#> $mo.col
#> [1] 2
#> 

make_mcmatrix(eigval = c(1), co = cbind(c(1,1,1,1), c(1,2,1,1)), dim = 4,
              len.block = c(2))
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    1    0    0
#> [2,]   -1    2    0    0
#> [3,]    0    1    0    0
#> [4,]    0    1    0    0
make_mcmatrix(eigval = c(1), co = cbind(c(1,1,1,1), c(1,2,3,4)), dim = 4,
              len.block = c(2))
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    1    0    0
#> [2,]   -1    2    0    0
#> [3,]   -2    3    0    0
#> [4,]   -3    4    0    0