Opened 14 years ago
Closed 12 years ago
#1415 closed defect (fixed)
array bindings need to be handled better in the compiler
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Backend | Version: | |
Keywords: | Cc: | Martin Sjölund, AlexeyLebedev, Frenkel, TUD, Willi Braun |
Description (last modified by )
class ArrayCall function fn input Real r; output Real array[10]; algorithm array := 1:10.0; array := cos(r*array); end fn; Real x[10] = fn(time); end ArrayCall;
Either we do common subexpression elimination in the backend or keep the arrays non-expanded. Common subexpression elimination would of course be preferrable as then we could do things like:
class ArrayCall Real x[10] = fn(time); Real y[10] = fn(time)*2; Real z[10] = fn(time)*3; end ArrayCall;
And only call fn once. We probably need to introduce temporary variables to deal with duplicated function calls.
Change History (3)
comment:1 by , 14 years ago
comment:2 by , 12 years ago
Cc: | added; removed |
---|---|
Component: | → Backend |
Description: | modified (diff) |
comment:3 by , 12 years ago
Milestone: | → 1.9.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
We now move the binding into the equation section.
Note:
See TracTickets
for help on using tickets.
The binding
x = fn(time)
could be moved into the equation-section, which avoids some of these issues.