modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

Two redundant arguments C and A in dormqr #4388

Closed tobolar closed 2 months ago

tobolar commented 2 months ago

In Math.Matrices.LAPACK.dormqr, there are used two arguments Cand A being real matrices. Unfortunately, without description. Following the LAPACK'S DORMQR documentation and the routine's call, IMO there shall be just one argument (probably C) enabled.

HansOlsson commented 2 months ago

Hm... https://netlib.org/lapack/explore-html/d7/d50/group__unmqr_ga768bd221f959be1b3d15bd177bb5c1b3.html seems to indicate that there are two arguments C and A.

Note that due to Modelica's stricter input/output semantics there are in two C-matrices in the Modelica function, C and Cout - but ideally that can be simplified in tools.

tobolar commented 2 months ago

Hm... https://netlib.org/lapack/explore-html/d7/d50/group__unmqr_ga768bd221f959be1b3d15bd177bb5c1b3.html seems to indicate that there are two arguments C and A.

Yes, actually a=A and c=Cout. C is only used to initialize Cout and some dimensions (m, n, ...) If input/output semantics shall be the point, I would expect something like

  input Real C[:, :];
  ...
protected
  Real A[size(C, 1), size(C, 2)] = C;
  ...

to overcome this.

beutlich commented 2 months ago

A (together with tau as returned by dgeqrf) is an orthogonal matrix to be multiplied with C. Seems all correct to me.

tobolar commented 2 months ago

@beutlich True! I missed this by my mistake. Sorry for this.