# Characteristic polynomials¶

Module name: thewalrus.charpoly

This module implements La Budde’s algorithm to calculate the characteristic polynomials of matrices.

## Summary¶

 get_reflection_vector(matrix, k) Compute reflection vector for householder transformation on general complex matrices. apply_householder(A, v, k) Apply householder transformation on a matrix A. Reduce the matrix to upper hessenberg form without Lapack. Calculates the characteristic polynomial of the matrix H. powertrace(H, n) Calculates the powertraces of the matrix H up to power n-1.

## Code details¶

apply_householder(A, v, k)[source]

Apply householder transformation on a matrix A. See Matrix Computations by Golub and Van Loan (4th Edition) Sections 5.1.4 and 7.4.2.

Parameters
• A (array) – A matrix to apply householder on

• v (array) – reflection vector

• size_A (int) – size of matrix A

• k (int) – offset for submatrix

charpoly(H)[source]

Calculates the characteristic polynomial of the matrix H.

Parameters

H (array) – square matrix

Returns

(array): list of power traces from 0 to n-1

get_reflection_vector(matrix, k)[source]

Compute reflection vector for householder transformation on general complex matrices. See Introduction to Numerical Analysis-Springer New York (2002) (3rd Edition) by J. Stoer and R. Bulirsch Section 6.5.1.

Parameters
• matrix (array) – the matrix in the householder transformation

• k (int) – offset for submatrix

Returns

reflection vector

Return type

array

powertrace(H, n)[source]

Calculates the powertraces of the matrix H up to power n-1.

Parameters
• H (array) – square matrix

• n (int) – required order

Returns

list of power traces from 0 to n-1

Return type

(array)

reduce_matrix_to_hessenberg(matrix)[source]

Reduce the matrix to upper hessenberg form without Lapack. This function only accepts Row-Order matrices.

Parameters

matrix (array) – the matrix to be reduced

Returns

matrix in hessenberg form

Return type

array