companion_matrix


companion_matrix, a C++ code which computes the companion matrix for a polynomial. The polynomial may be represented in the standard monomial basis, or as a sum of Chebyshev, Gegenbauer, Hermite, Laguerre, or Lagrange basis polynomials. All the roots of the polynomial can be determined as the eigenvalues of the corresponding companion matrix.

The C++ test code must compute eigenvalues and polynomial roots. To do so, it relies on help from the eigs() function, which in turn calls the lapack() library, and the roots() function, which calls the gsl() library.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

companion_matrix is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

companion_matrix_test

chebyshev_polynomial, a C++ code which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.

eigs, a C++ code which computes the eigenvalues and eigenvectors of a matrix.

gegenbauer_polynomial, a C++ code which evaluates the Gegenbauer polynomial and associated functions.

hermite_polynomial, a C++ code which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.

laguerre_polynomial, a C++ code which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

lapack_test, a C++ code which calls lapack(), which is a standard linear algebra package for solving linear systems, computing matrix factorizations, and solving eigenvalue problems.

legendre_polynomial, a C++ code which evaluates the Legendre polynomial and associated functions.

polynomial_conversion, a C++ code which converts representations of a polynomial between monomial, Bernstein, Chebyshev, Hermite, Laguerre and Legendre forms.

test_matrix, a C++ code which defines test matrices for which the condition number, determinant, eigenvalues, eigenvectors, inverse, null vectors, P*L*U factorization or linear system solution are known. Examples include the Fibonacci, Hilbert, Redheffer, Vandermonde, Wathen and Wilkinson matrices.

Reference:

Source Code:


Last revised on 10 June 2024.