Opened 11 years ago

Closed 11 years ago

#2639 closed defect (invalid)

Tuple Assignment Error while compiling SVD from LAPACK

Reported by: salmanfar@… Owned by: probably noone
Priority: high Milestone: 1.9.1
Component: Backend Version: trunk
Keywords: Cc:

Description (last modified by Martin Sjölund)

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 Martin Sjölund, 11 years ago

Description: modified (diff)

comment:2 by Per Östlund, 11 years ago

Resolution: invalid
Status: newclosed

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:

output Real[min(size(A, 1), size(A, 2))] sigma;

I missed the call to min when I first looked at it, and thought sigma had two dimensions due to the separating comma. So the correct declaration of sigmasvd in your function would be sigmasvd[2] or sigmasvd[min(size(A, 1), size(A, 2))].

Note: See TracTickets for help on using tickets.