H = Matrices.Utilities.toUpperHessenberg(A); (H, V, tau, info) = Matrices.Utilities.toUpperHessenberg(A,ilo, ihi);
Function toUpperHessenberg computes a upper Hessenberg form H of a matrix A by orthogonal similarity transformation: Q' * A * Q = H. With the optional inputs ilo and ihi, also partial transformation is possible. The function calls LAPACK function DGEHRD. See Matrices.LAPACK.dgehrd for more information about the additional outputs V, tau, info and inputs ilo, ihi.
A = [1, 2, 3; 6, 5, 4; 1, 0, 0]; H = toUpperHessenberg(A); results in: H = [1.0, -2.466, 2.630; -6.083, 5.514, -3.081; 0.0, 0.919, -0.514]
function toUpperHessenberg extends Modelica.Icons.Function; import Modelica.Math.Matrices; import Modelica.Math.Matrices.LAPACK; input Real A[:, size(A, 1)] "Square matrix A"; input Integer ilo = 1 "Lowest index where the original matrix had been Hessenbergform"; input Integer ihi = size(A, 1) "Highest index where the original matrix had been Hessenbergform"; output Real H[size(A, 1), size(A, 2)] "Upper Hessenberg form"; output Real V[size(A, 1), size(A, 2)] "V=[v1,v2,..vn-1,0] with vi are vectors which define the elementary reflectors"; output Real tau[max(0, size(A, 1) - 1)] "Scalar factors of the elementary reflectors"; output Integer info "Information of successful function call"; end toUpperHessenberg;