Calculate the upper triangle of A*B*A'+a*C with B and C symmetric
function symMatMul extends Modelica.Icons.Function; import Modelica; import Modelica_LinearSystems2; import Modelica_LinearSystems2.Math.Matrices.LAPACK; input Real A[:, :]; input Real B[size(A, 2), size(A, 2)]; input Real C[size(A, 1), size(A, 1)]; input Boolean add = true "Value is true if a==1, false if a==0"; output Real M[size(A, 1), size(A, 1)]; end symMatMul;