This function is used to efficiently calculate the matrix X from equation
T X = A*B*A + C,
with B and C being symmetric matrices. They hold
B = Bu + Bl and C = Cu + Cl,
where Bu and Cu with
T T Bu = Bl and Cu = Cl
are upper triangular matrices. Furthermore, the matrices are defined such that i.e.,
| bij/2 for i = j bu,ij = | | bij else
and cu,ij respectively.
Finally, X is given by the sum of a upper triangular matrix and its transposes
T T T T T T T X = A*(Bu+Bl)*A + (Cu+Cl) = A*Bu*A + A*Bl*A + (Cu+Cl) = A*Bu*A + Cu + (A*Bu*A + Cu) = E + E
Since, X also has to be symmetric, only the upper triangle of X is computed by calculatiing the upper triangle of matrix E and adding the upper triangle of E'.
The calculation employs the BLAS functions dtrmm and
dgemm.
Note, that only the upper triangle is calculated. The complete solution could
be achieved by the command
X := symmetric(X)
function symMatMul extends Modelica.Icons.Function; 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;
Date | Author | Comment |
---|---|---|
2010-05-31 | Marcus Baur, DLR-RM | Realization |