.Modelica.Math.Matrices.equalityLeastSquares

Information

Syntax

x = Matrices.equalityLeastSquares(A,a,B,b);

Description

This function returns the solution x of the linear equality-constrained least squares problem:

min|A*x - a|^2 over x, subject to B*x = b

It is required that the dimensions of A and B fulfill the following relationship:

size(B,1) ≤ size(A,2) ≤ size(A,1) + size(B,1)

Note, the solution is computed with the LAPACK function "dgglse" using the generalized RQ factorization under the assumptions that B has full row rank (= size(B,1)) and the matrix [A;B] has full column rank (= size(A,2)). In this case, the problem has a unique solution.

Interface

function equalityLeastSquares
  extends Modelica.Icons.Function;
  input Real A[:, :] "Minimize |A*x - a|^2";
  input Real a[size(A, 1)];
  input Real B[:, size(A, 2)] "Subject to B*x=b";
  input Real b[size(B, 1)];
  output Real x[size(A, 2)] "Solution vector";
end equalityLeastSquares;

Generated at 2024-12-26T19:25:54Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos