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.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | A | Real | [:, size(A, 1)] | Square matrix |
| output | symmetricA | Real | [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;