CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

LinearAlgebra.symmetrize

Average a square matrix with its transpose

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputAReal[:, size(A, 1)]Square matrix
outputsymmetricAReal[size(A, 1), size(A, 2)]

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function symmetrize "Average a square matrix with its transpose"
  input Real A[:, size(A, 1)] "Square matrix";
  output Real symmetricA[size(A, 1), size(A, 2)];
algorithm
  symmetricA := 0.5 * (A + transpose(A));
end symmetrize;