Opened 9 years ago
Last modified 9 years ago
#3556 new defect
pseudo loops with function
Reported by: | Vitalij Ruge | Owned by: | somebody |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | *unknown* | Version: | |
Keywords: | Cc: | Willi Braun |
Description
In the following example
model A function f2 input Real dx1; input Real dx2; input Real x1; input Real x2; output Real y1; output Real y2; protected Real[2] c = {dx1 + dx2, x1 + x2}; algorithm y1 := c[1] + c[2]; y2 := c[2]; end f2; Real x,z,y; Real dx = (x-y)/exp(z), dz(start=1) = der(z), dy(start=1.5) = der(y); equation (x, z) = f2(dx, dy, x, y); dz = x - z; end A;
we have loops of the size 2.
By replace
Real[2] c = {dx1 + dx2, x1 + x2};
with
Real c1 = dx1 + dx2, c2 = x1 + x2;
we get
model A2 function f2 input Real dx1; input Real dx2; input Real x1; input Real x2; output Real y1; output Real y2; protected Real c1 = dx1 + dx2, c2 = x1 + x2; algorithm y1 := c1 + c2; y2 := c2; end f2; Real x,z,y; Real dx = (x-y)/exp(z), dz(start=1) = der(z), dy(start=1.5) = der(y); equation (x, z) = f2(dx, dy, x, y); dz = x - z; end A2;
without loops.
Note:
See TracTickets
for help on using tickets.
extends of inlining for array protected types include (currently) performence issues (see #3531)