modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
479 stars 169 forks source link

Type errors in function realSchur #801

Closed modelica-trac-importer closed 7 years ago

modelica-trac-importer commented 7 years ago

Modified by dietmarw on 7 Sep 2012 07:41 UTC

[Modelica 3.2.1/Math/package.mo:2309:9-2309:18:writable] 
Error: Type mismatch in assignment in QZ := {{1}} of Real[size(A, 1), size(A, 2)] := Integer[1, 1]
Error: Error occurred while flattening model ModelicaTest.Math.MatricesInModel

Patch for the type error in function realSchur:

--- libraries/Modelica 3.2.1/Math/package.mo    2012-09-04 14:21:08.429161362 +0200
+++ build/lib/omlibrary/Modelica 3.2.1/Math/package.mo  2012-09-07 09:18:25.950630815 +0200
@@ -2305,15 +2305,9 @@
                      to its partially converged Schur form.\n");
     else
       S := A;
-      if size(A, 1) > 0 then
-        QZ := [1];
-        alphaReal := {1};
-        alphaImag := {0};
-      else
-        QZ := fill(1, 0, 0);
-        alphaReal := fill(1, 0);
-        alphaImag := fill(0, 0);
-      end if;
+      QZ := fill(1, size(QZ,1), size(QZ,2));
+      alphaReal := fill(1, size(alphaReal,1));
+      alphaImag := fill(0, size(alphaImag,1));
     end if;

     annotation (Documentation(info="<html>

Moreover, you get:

[Modelica 3.2.1/Math/package.mo:2298:7-2305:64:writable] 
Warning: info was used before it was defined (given a value). 
Additional such uses may exist for the variable, but some messages were suppressed.

So this should also be defined by the function (possibly the LAPACK call).


Reported by sjoelund.se on 7 Sep 2012 07:28 UTC

[Modelica 3.2.1/Math/package.mo:2309:9-2309:18:writable] Error: Type mismatch in assignment in QZ := {{1}} of Real[size(A, 1), size(A, 2)] := Integer[1, 1]
Error: Error occurred while flattening model ModelicaTest.Math.MatricesInModel

Patch for the type error in function realSchur:

--- libraries/Modelica 3.2.1/Math/package.mo    2012-09-04 14:21:08.429161362 +0200
+++ build/lib/omlibrary/Modelica 3.2.1/Math/package.mo  2012-09-07 09:18:25.950630815 +0200
@@ -2305,15 +2305,9 @@
                      to its partially converged Schur form.\n");
     else
       S := A;
-      if size(A, 1) > 0 then
-        QZ := [1];
-        alphaReal := {1};
-        alphaImag := {0};
-      else
-        QZ := fill(1, 0, 0);
-        alphaReal := fill(1, 0);
-        alphaImag := fill(0, 0);
-      end if;
+      QZ := fill(1, size(QZ,1), size(QZ,2));
+      alphaReal := fill(1, size(alphaReal,1));
+      alphaImag := fill(0, size(alphaImag,1));
     end if;

     annotation (Documentation(info="<html>

Moreover, you get:

[Modelica 3.2.1/Math/package.mo:2298:7-2305:64:writable] Warning: info was used before it was defined (given a value). Additional such uses may exist for the variable, but some messages were suppressed.

So this should also be defined by the function (possibly the LAPACK call).


Migrated-From: https://trac.modelica.org/Modelica/ticket/801

modelica-trac-importer commented 7 years ago

Modified by dietmarw on 7 Sep 2012 07:41 UTC

modelica-trac-importer commented 7 years ago

Comment by sjoelund.se on 6 Dec 2012 13:57 UTC Fixed in 6c5b2b774eef3a1ecdcef8d9178efdac098e61b6.