Opened 9 years ago
Last modified 3 years ago
#3592 assigned defect
Eigen values fails with error
Reported by: | Adeel Asghar | Owned by: | Karim Adbdelhak |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Code Generation | Version: | v1.14.0-dev-nightly |
Keywords: | Cc: | dma@…, davide.bazzi@… |
Description
Using Matrices.eigenValues
results in following error,
[CodegenCFunctions.tpl: 4698:15-4698:15]: Template error: This should have been handled in indexed assign and should not have gotten here. eigenvalues[:,2]
Use the attached file. If a parameter prefix is added to Real A
then it works fine.
Attachments (1)
Change History (21)
by , 9 years ago
Attachment: | EigenTest.mo added |
---|
comment:1 by , 9 years ago
Milestone: | 1.9.4 → 1.9.5 |
---|
comment:4 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:5 by , 8 years ago
The bug is still actual(ver. 1.12.0 on Ubuntu 16.04). Thanks to adeas31 for "a parameter prefix" solution.
comment:6 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
comment:7 by , 6 years ago
Milestone: | Future → 1.14.0 |
---|
This is actually also relevant for work we are carrying out at Politecnico.
I did some analysis. If A
is defined as a parameter, the old frontend evaluates the eigenValues()
function during flattening, so that the code generation is trivial (BTW, the new frontend doesn't do that, therefore the model also fails with parameter A).
Apparently, something goes wrong with the code generation when the eigenValues
function is involved.
follow-up: 11 comment:8 by , 6 years ago
This model shows that the problem is with code generation for the external function dgeev()
model M Real A[3,3] = {{1, 0, 0}, {0,1,0}, {0,0,1}}; Real eigval[3,2]; Integer info; Real eigvec[3,3]; equation (eigval[:,1], eigval[:,2], eigvec, info) = Modelica.Math.Matrices.LAPACK.dgeev(A); end M;
The error output is:
[CodegenCFunctions.tpl: 4978:15-4978:15]: Template error: daeExpCrefLhsSimContext: This should have been handled in indexed assign and should not have gotten here eigval[:,2].
comment:9 by , 6 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Version: | → v1.14.0-dev-nightly |
@Karim.Abdelhak, I tentatively assign this to you, feel free to reassign it to somebody else if you deem it appropriate.
comment:10 by , 6 years ago
From what I understand, it is a problem with external functions returning more than one output
follow-up: 12 comment:11 by , 6 years ago
Replying to casella:
The error output is:
[CodegenCFunctions.tpl: 4978:15-4978:15]: Template error: daeExpCrefLhsSimContext: This should have been handled in indexed assign and should not have gotten here eigval[:,2].
Just to a question to clarify it for me:
Is it expected to be flattened out to eigval[1,2],eigval[2,2],...
or is the code generation expected to generate arrays in the target code?
As it seems we flattened it out before, but generally we want to avoid flattening as much as possible in the future. I will try to recover the old behaviour, but i guess we have to think about it in general.
comment:12 by , 6 years ago
Replying to Karim.Abdelhak:
Just to a question to clarify it for me:
Is it expected to be flattened out toeigval[1,2],eigval[2,2],...
or is the code generation expected to generate arrays in the target code?
I guess for the time being our strategy is to get omc to deal with as many models as possible using the old strategy (-> full flattening to scalars).
As a medium-long term goal we should implement a vector-preserving backend, but that's another story, we need to get all valid Modelica models to work ASAP, even if the efficiency is not optimal.
As it seems we flattened it out before, but generally we want to avoid flattening as much as possible in the future. I will try to recover the old behaviour, but i guess we have to think about it in general.
Agreed. BTW, which old behaviour do you refer to? This ticket has been open for three years, so I guess this function never worked at all so far in OMC.
comment:13 by , 6 years ago
@karim, your PR #2979 apparently didn't solve the problem, I'm still getting
[CodegenCFunctions.tpl: 5030:15-5030:15]: Template error: This should have been handled in indexed assign and should not have gotten here. eigenvalues[:,2].
if I run the test attached to this ticket
comment:15 by , 6 years ago
Replying to casella:
@karim, can you have a look at this issue?
I have quite some work to do at the moment, but when i start to work on tickets again i will look deeper into this issue.
comment:17 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:19 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
Milestone pushed to 1.9.5