H = Matrices.hessenberg(A); (H, U) = Matrices.hessenberg(A);
Function hessenberg computes the Hessenberg matrix H of matrix A as well as the orthogonal transformation matrix U that holds H = U'*A*U. The Hessenberg form of a matrix is computed by repeated Householder similarity transformation. The elementary reflectors and the corresponding scalar factors are provided by function "Utilities.toUpperHessenberg()". The transformation matrix U is then computed by LAPACK.dorghr.
A = [1, 2, 3; 6, 5, 4; 1, 0, 0]; (H, U) = hessenberg(A); results in: H = [1.0, -2.466, 2.630; -6.083, 5.514, -3.081; 0.0, 0.919, -0.514] U = [1.0, 0.0, 0.0; 0.0, -0.9864, -0.1644; 0.0, -0.1644, 0.9864] and therefore, U*H*transpose(U) = [1.0, 2.0, 3.0; 6.0, 5.0, 4.0; 1.0, 0.0, 0.0]
Matrices.Utilities.toUpperHessenberg
function hessenberg extends Modelica.Icons.Function; import Modelica.Math.Matrices; input Real A[:, size(A, 1)] "Square matrix A"; output Real H[size(A, 1), size(A, 2)] "Hessenberg form of A"; output Real U[size(A, 1), size(A, 2)] "Transformation matrix"; end hessenberg;