Opened 7 years ago

Closed 6 years ago

#4753 closed defect (fixed)

NF reductions use a poor generation

Reported by: Martin Sjölund Owned by: Per Östlund
Priority: high Milestone: Future
Component: New Instantiation Version:
Keywords: Cc: Francesco Casella, Per Östlund

Description

There are several problems with how reductions are handled in the new frontend. One is that for example sum is transformed into a sum *call* to a reduction returning an array instead of a single reduction that does not create a temporary array. The other is that it has problem with polymorphic types. It should be implemented in the same way as the old front-end handling of reductions.

function Modelica.Math.BooleanVectors.countTrue
  input Boolean[:] b;
  output Integer n;
algorithm
  /*Integer*/ n := /*polymorphic<ScalarBasicType>*/ sum(array(if /*Boolean*/ b[/*Integer*/ i] then 1 else 0 for i in 1:size(/*Boolean[:]*/ b, 1)));
end Modelica.Math.BooleanVectors.countTrue;

Change History (1)

comment:1 by Per Östlund, 6 years ago

Resolution: fixed
Status: newclosed

Fixed in bdd22db.

Note: See TracTickets for help on using tickets.