The hessenbergform command applies similarity transformations to put the matrix A into upper Hessenberg form, with zeroes under the first sub-diagonal.
A = [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20],[21,22,23,24,25]]; hessenbergform(A); [[1, 214/21, 16/3, 3, 4], [21, 1294/21, 136/3, 23, 24], [0, 800/147, 50/21, 10/7, 15/7], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]