#1447 closed defect (fixed)
Vectorization does not work in front end
| Reported by: | dhedberg | Owned by: | dhedberg |
|---|---|---|---|
| Priority: | high | Milestone: | 1.14.0 |
| Component: | Frontend | Version: | |
| Keywords: | Cc: | dhedberg, Henrik Tidefelt |
Description
I tested the following model in the latest nightly build of OpenModelica and it does not work.
function Foo
input Integer x[:];
output Integer y[size(x,1)];
algorithm
y := abs(x);
end Foo;
model MyTest
Integer a[2] = {1, -1};
Integer b[2];
algorithm
b := Foo(a);
end MyTest;
I get the following error:
$ omc MyTest.mo Error processing file: MyTest.mo [MyTest.mo:5:3-5:14:writable] Error: No matching function found for abs in component <NO COMPONENT> candidates are function(x:Integer) => Integer -function(x:Real) => Real # Error encountered! Exiting... # Please check the error message and the flags. Execution failed!
Change History (12)
comment:1 by , 15 years ago
comment:4 by , 14 years ago
Have you finished work on this in the branch? Or should we add the proper rewrite rule to the trunk?
abs(x) => array(abs(x[i]) for i in 1:size(x))
comment:5 by , 14 years ago
In order to solve this properly, the environment needs to return size(x,1) as the dimension. Not unknown (it is partially known, and we need this knowledge... but OMC does not store this as of yet)
comment:6 by , 14 years ago
This is now working for calls with only one foreach argument (general case requires aforementioned larger changes in the compiler)
comment:7 by , 11 years ago
| Cc: | dhedberg, → dhedberg |
|---|---|
| Component: | → Backend |
Just to make it explicit, here's a minor modification of the original model, which still exhibits the problem:
function Foo
input Integer x[:, :];
output Integer y[size(x, 1), size(x, 2)];
algorithm
y := abs(x);
end Foo;
model MyTest
Integer a[2, 2] = {{1, -1}, {2, -2}};
Integer b[2, 2];
algorithm
b := Foo(a);
end MyTest;
comment:8 by , 11 years ago
| Component: | Backend → Frontend |
|---|
Replacing the automatically set Component with one that makes more sense.
comment:9 by , 11 years ago
| Cc: | added |
|---|
comment:10 by , 10 years ago
| Milestone: | → Future |
|---|
comment:11 by , 5 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
All the example models work with both the old and the new frontend, so I guess this was fixed some time ago.
comment:12 by , 5 years ago
| Milestone: | Future → 1.14.0 |
|---|

Ticket in MathCore TRAC: http://intranet/trac/mathmodelica/ticket/3107