Return the upper/lower triangular part of a square matrix
function triangle extends Modelica.Icons.Function; input Real A[:, size(A, 1)] "Square matrix"; input Boolean upper = true "True for upper triangle to return"; output Real Tri[size(A, 1), size(A, 2)] "Triangular matrix"; end triangle;