Opened 11 years ago
Closed 11 years ago
#2639 closed defect (invalid)
Tuple Assignment Error while compiling SVD from LAPACK
Reported by: | Owned by: | probably noone | |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
I want to use SVD from LAPACK but get this error about tuples assignment. I compiled on OM version 1.8.1
function SVDRLS import Modelica.Math.Matrices; input Real A[3,2]; output Real sigmasvd[3,2]; output Real Usvd[3,3]; output Real VTsvd[2,2]; algorithm (sigmasvd,Usvd,VTsvd):=Matrices.singularValues(A); end SVDRLS;
[<interactive>:10:1-10:50:writable] Error: Type mismatch in assignment in (sigmasvd,Usvd,VTsvd) := Modelica.Math.Matrices.singularValues({{A[1,1],A[1,2]},{A[2,1],A[2,2]},{A[3,1],A[3,2]}}) of (Real[3, 2], Real[3, 3], Real[2, 2]) := (Real[:], Real[:, :], Real[:, :]) [<interactive>:10:1-10:50:writable] Error: Tuple assignment only allowed when rhs is function call (in Modelica.Math.Matrices.singularValues({{A[1,1],A[1,2]},{A[2,1],A[2,2]},{A[3,1],A[3,2]}}))
Change History (2)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
My apologies, it seems like my first assessment on the forum was wrong, the type mismatch error message is actually correct. When I had a closer look I noticed that the first output of singularValues is:
I missed the call to
min
when I first looked at it, and thoughtsigma
had two dimensions due to the separating comma. So the correct declaration ofsigmasvd
in your function would besigmasvd[2]
orsigmasvd[min(size(A, 1), size(A, 2))]
.