Opened 16 years ago

Last modified 14 years ago

#1091 closed defect (fixed)

Flattening of equation with transpose() fails with some literal inputs.

Reported by: rruusu Owned by: rruusu
Priority: high Milestone:
Component: Version:
Keywords: Cc: rruusu,

Description

Something very strange happens when the model below is flattened. The literal array expressions should be semantically identical, but only the brace expression fails.

model Test
  Real[3,3] array1, array2;
equation
  array1 = transpose({{1, 2, 3},{4, 5, 6},{7, 8, 9}});
  array2 = transpose([1, 2, 3; 4, 5, 6; 7, 8, 9]);
end Test;

Result:

fclass Test
Real array1[1,1];
Real array1[1,2];
Real array1[1,3];
Real array1[2,1];
Real array1[2,2];
Real array1[2,3];
Real array1[3,1];
Real array1[3,2];
Real array1[3,3];
Real array2[1,1];
Real array2[1,2];
Real array2[1,3];
Real array2[2,1];
Real array2[2,2];
Real array2[2,3];
Real array2[3,1];
Real array2[3,2];
Real array2[3,3];
equation
  array1[1,1] = 2.0;
  array1[1,2] = 5.0;
  array1[1,3] = 8.0;
  array1[2,1] = 3.0;
  array1[2,2] = 6.0;
  array1[2,3] = 9.0;
  array1[3,1] = {{2.0,5.0,8.0},{3.0,6.0,9.0}}[3][1];
  array1[3,2] = {{2.0,5.0,8.0},{3.0,6.0,9.0}}[3][2];
  array1[3,3] = {{2.0,5.0,8.0},{3.0,6.0,9.0}}[3][3];
  array2[1,1] = 1.0;
  array2[1,2] = 4.0;
  array2[1,3] = 7.0;
  array2[2,1] = 2.0;
  array2[2,2] = 5.0;
  array2[2,3] = 8.0;
  array2[3,1] = 3.0;
  array2[3,2] = 6.0;
  array2[3,3] = 9.0;
end Test;

Similar results are produced for {{transpose(identity(3))}}, {{transpose(zeros(3,3))}}, {{transpose(ones(3,3))}}, {{transpose(fill(<value>,3,3))}} and {{transpose(diagonal(<vector>))}}.

Change History (1)

comment:1 Changed 14 years ago by sjoelund.se

Closing as it was working in the trunk when I checked.

Note: See TracTickets for help on using tickets.