Opened 16 years ago

Last modified 14 years ago

#1025 closed defect (worksforme)

Some of the reduction expressions do not work.

Reported by: adrpo Owned by: adrpo
Priority: critical Milestone:
Component: Version:
Keywords: Cc: adrpo, adrpo

Description

{{{model foo

Real x[2];
Real y;

equation

x={1,3};
y=sum(x[i]2 for i in 1:2);

end foo;}}}

This should compile and produce the desired result y=10. With omc, I get the following error:
Type mismatch in equation y=<reduction>sum(x[1]2.0 for i in {1,2}) of type Real = Real[2]

I guess that reductions should be supported by the compiler, because of the diagnostic message mentioning them. However, there are bugs in there: sum is interpreted as a vector (it should be a scalar), and x[1] appears instead of x[i]. What's wrong here?

Cheers,
Francesco

Change History (1)

comment:1 Changed 14 years ago by sjoelund.se

This works in the trunk, probably has been for a while now.

Note: See TracTickets for help on using tickets.