Opened 11 years ago

Closed 11 years ago

#2143 closed defect (fixed)

Wrong flattening of element-wise operators

Reported by: sjoelund.se Owned by: perost
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 Changed 11 years ago by sjoelund.se

  • Owner changed from somebody to perost
  • Status changed from new to assigned

comment:2 Changed 11 years ago by perost

  • Resolution set to fixed
  • Status changed from assigned to closed

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.