Learn R Programming

pbdDMAT (version 0.5-1)

companion: Generate Companion Matrices

Description

Methods for constructing companion matrices of an n-degree polynomial.

Usage

companion(coef, type = "matrix", ..., bldim = .pbd_env$BLDIM,
  ICTXT = .pbd_env$ICTXT)

Arguments

coef

Vector of polynomial coefficients, listed in increasing order (by index; see details below).

type

"matrix" or "ddmatrix".

...

Additional arguments.

bldim

blocking dimension.

ICTXT

BLACS context number.

Value

Returns a matrix or a distributed matrix.

Details

For a degree n polynomial,

\(x^n + a_{n-1}x^{n-1} + \dots + a_1x + a_0\)

its associated companion matrix is a matrix of the form

\(\left[\begin{array}{cccccc} 0 & 0 & 0 & \dots & 0 & -a_0\\ 1 & 0 & 0 & \dots & 0 & -a_1\\ 0 & 1 & 0 & \dots & 0 & -a_2\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ 0 & 0 & 0 & \dots & 1 & -a_{n-1} \end{array}\right]\)

In the function call, we assume that the argument 'coef' is ordered from \(a_0\) to \(a_{n-1}\).

NOTE that we assume that the leading coefficient is 1.