Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal value of 'lwork' in LAPACK.dtrsen #4036

Closed
henrikt-ma opened this issue Sep 21, 2022 · 0 comments · Fixed by #4039
Closed

Illegal value of 'lwork' in LAPACK.dtrsen #4036

henrikt-ma opened this issue Sep 21, 2022 · 0 comments · Fixed by #4039
Assignees
Labels
L: Math Issue addresses Modelica.Math
Milestone

Comments

@henrikt-ma
Copy link
Contributor

henrikt-ma commented Sep 21, 2022

The dtrsen documentation makes it clear that lwork must not be zero:

    LWORK   (input) INTEGER
            The dimension of the array WORK.
            If JOB = 'N', LWORK >= max(1,N);
            if JOB = 'E', LWORK >= max(1,M*(N-M));
            if JOB = 'V' or 'B', LWORK >= max(1,2*M*(N-M)).

            If LWORK = -1, then a workspace query is assumed; the routine
            only calculates the optimal size of the WORK array, returns
            this value as the first entry of the WORK array, and no error
            message related to LWORK is issued by XERBLA.

Yet, this is what one gets for an empty matrix T unless job is "N":

  Integer lwork = if job == "N" then max(1, n) else if job == "E" then n * n else 2 * n * n;

This is triggered by the following call in ModelicaTest.Math.Matrices2:

  Real N[:, :] = fill(0, 0, 0);
  …
  Xn := Matrices.discreteRiccati(N, N, N, N);

In this case, the call to dtrsen comes via Modelica.Math.Matrices.Utilities.reorderRSF, where job is "E":

  (To, Qo, wr, wi) := LAPACK.dtrsen("E", "V", select, T, Q);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: Math Issue addresses Modelica.Math
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants