OMCompiler icon indicating copy to clipboard operation
OMCompiler copied to clipboard

implement natural merge sort to have O(n) for already sorted lists

Open hkiel opened this issue 7 years ago • 6 comments

hkiel avatar Oct 10 '17 10:10 hkiel

The test suite is unstable according to OpenModelica_TEST_PULL_REQUEST 2017-10-10_12-15-02.

OpenModelica-Hudson avatar Oct 10 '17 10:10 OpenModelica-Hudson

The test suite is unstable according to OpenModelica_TEST_PULL_REQUEST 2017-10-10_16-14-06.

OpenModelica-Hudson avatar Oct 10 '17 14:10 OpenModelica-Hudson

The test suite is unstable according to OpenModelica_TEST_PULL_REQUEST 2017-10-12_14-59-45.

OpenModelica-Hudson avatar Oct 12 '17 13:10 OpenModelica-Hudson

@sjoelund The current merge sort implementation in List.sort is not stable. In fact it reverts the order of equal elements.

My natural merge sort implementation should however be stable but leads to failures in the test suite. E.g. simulation/libraries/msl32/Modelica.Fluid.Examples.HeatingSystem.mos does not compile anymore. Do you have any hint why this can be?

hkiel avatar Oct 12 '17 13:10 hkiel

HeatingSystem is very sensitive to the order of elements. It's just some heuristics that choose a different path as far as I know.

sjoelund avatar Oct 12 '17 13:10 sjoelund

I still think that we should use a stable sort algorithm.

hkiel avatar Oct 18 '17 08:10 hkiel