View source: R/ddmatrix_special.r
| companion | R Documentation | 
Methods for constructing companion matrices of an n-degree polynomial.
companion(
  coef,
  type = "matrix",
  ...,
  bldim = .pbd_env$BLDIM,
  ICTXT = .pbd_env$ICTXT
)
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.  | 
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.
Returns a matrix or a distributed matrix.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.