- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Tuple Assignment
Tuple Assignment
Tuple Assignment
What is this tuple assignment error?
function SVDRLS
annotation(Diagram(coordinateSystem(extent={{-148.5,-105.0},{148.5,105.0}}, preserveAspectRatio=true, initialScale=0.1, grid={5,5})));
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]}}))
Re: Tuple Assignment
This looks like a bug to me, the first output of singularValues has two dimensions but the compiler thinks it has one. The second error can be ignored, it's caused by the first one. Please open a ticket in our bug tracker about this. I get a similar but different error when I run the function through the latest version of the compiler, so please include information about what version of OM you're using and how you got this error.
- perost
- 114 Posts
Re: Tuple Assignment
Salman wrote:
the link to bug tracker is not working
Sorry, wrong syntax. The link has been fixed now.
- perost
- 114 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Tuple Assignment