Opened 12 years ago

Closed 12 years ago

#2143 closed defect (fixed)

Wrong flattening of element-wise operators

Reported by: Martin Sjölund Owned by: Per Östlund
Priority: high Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

Wrong flattening of element-wise operators. Consider:

function f
  input Real r1[:];
  input Real r2[size(r1,1)];
  output Real o[size(r1,1)];
algorithm
  o := r1 .* r2;
end f;

model M
  Real r[:] = f({1,2,3},{4,5,6});
end M;

omc prints:

function f
  input Real[:] r1;
  input Real[size(r1, 1)] r2;
  output Real[size(r1, 1)] o;
algorithm
  o := r1 * r2;
end f;

Which is wrong since r1 * r2 returns a scalar Real. This is an annoyance when debugging.

Change History (2)

comment:1 by Martin Sjölund, 12 years ago

Owner: changed from somebody to Per Östlund
Status: newassigned

comment:2 by Per Östlund, 12 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r15776. We don't actually save the exact operator that the user used, so we don't know whether they were written as element-wise or not (in many cases it doesn't matter). Element-wise operators are now output when they are the only option, while 'normal' operators are output for the cases where it doesn't matter.

Note: See TracTickets for help on using tickets.