It is assumed that the input vector u is a Housholder vector of the shape
u = (u1, u2, ..., ur,0, ..., 0)
where r is an integer input. From
S = I - 2*u*u'/u'*u = [P, 0; 0, I]
with
dim(P) = r x r, dim(I) = n-r x n-r
results
S*A*S = [P*A11*P, P*A12; A21*P, A22]
function householderSimilarityTransformation2 extends Modelica.Icons.Function; import Modelica.Math.Vectors.length; input Real A[:, size(A, 1)]; input Real u[size(A, 1)] "householder vector"; input Integer r; output Real SAS[size(A, 1), size(A, 1)]; end householderSimilarityTransformation2;