MultiCompanion-class: Class "MultiCompanion"

MultiCompanion-classR Documentation

Class "MultiCompanion"

Description

Objects and methods for multi-companion matrices

Objects from the Class

For ordinary usage objects from this class should behave as matrices and there should be no need to access the slots directly.

Objects can be created with the function mCompanion. Other functions in the mcompanion package also produce MultiCompanion objects.

It is possible also to call new() directly:

    new("MultiCompanion", xtop, mo, n, mo.col, ido, x, dimnames,
        detect, misc)
  

Arguments:

xtop

is the top of the matrix.

mo

is the multi-companion order of the matrix.

n

is the dimension.

mo.col

is the top order, meaniing that columns mo.col+1,...,n of the top of the matrix are zeros. mo.col may also be set to "detect", in which case it is determined by scanning xtop or x.

ido

the dimension of the identity sub-matrix.

x

the whole matrix.

dimnames

is not used currently.

detect

controls whether automatic detection of mo and mo.col should be attempted. The values tested are "mo", "mo.col", "all", and "nothing" with obvious meanings.

misc

todo: describe this argument!

Normally one of xtop and x is supplied but if both are, they are checked for consistency, including the elements of the matrix (equality is tested with ==). To facilitate calls with one unnamed argument, when xtop is a square matrix it is taken to be the entire matrix (provided that x is missing).

Aside from xtop (or x), most of the remaining arguments can be deduced automatically. The number of rows and columns of xtop give the multi-companion order and the dimension of the matrix, respectively. A vector xtop is taken to stand for a matrix with one row. x needs to be square or a vector of length equal to exact square. mo and mo.col may be determined from the contents of x and xtop. There is no harm in ignoring mo.col but it is useful for our applications. Note that by default it is to set to the number of columns and not determined by scanning the matrix.

The contents of the misc argument are stored in the pad of the new object.

Slots

xtop:

The top of the matrix, an object of class "matrix"

mo:

Multi-companion order, an object of class "numeric"

ido:

dimension of the identity submatrix, object of class "numeric"

mo.col:

number of non-zero columns in top rows, object of class "numeric"

pad:

storage for additional info, object of class "objectPad"

x:

inherited, object of class "numeric"

Dim:

inherited, object of class "integer"

Dimnames:

inherited, object of class "list"

factors:

inherited, object of class "list"

Extends

Class "ddenseMatrix", directly. Class "generalMatrix", directly. Class "dMatrix", by class "ddenseMatrix". Class "denseMatrix", by class "ddenseMatrix". Class "Matrix", by class "ddenseMatrix". Class "Matrix", by class "ddenseMatrix". Class "compMatrix", by class "generalMatrix". Class "Matrix", by class "generalMatrix".

Methods

%*%

signature(x = "ANY", y = "MultiCompanion"): ...

%*%

signature(x = "MultiCompanion", y = "MultiCompanion"): ...

%*%

signature(x = "MultiCompanion", y = "ANY"): ...

[

signature(x = "MultiCompanion", i = "index", j = "index", drop = "logical"): ...

[

signature(x = "MultiCompanion", i = "index", j = "missing", drop = "logical"): ...

[

signature(x = "MultiCompanion", i = "missing", j = "index", drop = "logical"): ...

coerce

signature(from = "dgeMatrix", to = "MultiCompanion"): ...

coerce

signature(from = "matrix", to = "MultiCompanion"): ...

coerce

signature(from = "MultiCompanion", to = "matrix"): ...

coerce

signature(from = "MultiCompanion", to = "dgeMatrix"): ...

initialize

signature(.Object = "MultiCompanion"): This method is called implicitly when the user calls new("MultiCompanion",...).

mcStable

signature(x = "MultiCompanion"): ...

t

signature(x = "MultiCompanion"): ...

%*%

signature(x = "matrix", y = "MultiCompanion"): ...

%*%

signature(x = "MultiCompanion", y = "matrix"): ...

[

signature(x = "MultiCompanion", i = "index", j = "index", drop = "missing"): ...

[

signature(x = "MultiCompanion", i = "index", j = "missing", drop = "missing"): ...

[

signature(x = "MultiCompanion", i = "missing", j = "index", drop = "missing"): ...

%*%

signature(x = "MultiCompanion", y = "vector"): ...

%*%

signature(x = "vector", y = "MultiCompanion"): ...

Note

The implementation is rather redundant, this class probably should inherit in a different way from classes in Matrix package or may be not inherit at all.

Methods to get the multi-order, mo.col, and others, would be useful but first the terminology needs to be made consistent.

Other matrix arithmetic operations?

Argument n is called dim in other functions.

Author(s)

Georgi N. Boshnakov

References

\insertRef

boshnakov2002mcmcompanion

\insertRef

boshnakov2009genmcompanion

See Also

mCompanion and the examples there; the following functions produce multi-companion matrices but do not return MultiCompanion objects:

sim_mc, make_mcmatrix

Examples

a1 <- matrix(1:12,nrow=2)
mc1 <- new("MultiCompanion",xtop=a1)
new("MultiCompanion",a1)   # same

a2 <- matrix(c(1:6,rep(0,4)),nrow=2)   # 1st 3 columns of a2 are non-zero
mc2 <- new("MultiCompanion",a2)
mc2
mc2@mo.col     # =5, because the default is to set mo.col to ncol

mc2a <- new("MultiCompanion",a2,detect="mo.col")
mc2a@mo.col   # =3, compare with above

b <- as(mc2,"matrix")  # b is ordinary R matrix
mcb <- new("MultiCompanion",x=b)
       new("MultiCompanion",b)   # same as mcb

mcb@mo        # 2 (mo detected)
mcb@mo.col    # 5 (no attempt to detect mo.col)

mcba <- new("MultiCompanion",b,detect="all")
mcba@mo        # 2 (mo detected)
mcba@mo.col    # 3 (mo.col detected)

mcompanion documentation built on Sept. 22, 2023, 5:12 p.m.