ObjectVision / GeoDMS

Source code for the GeoDMS software
https://www.geodms.nl/
Other
8 stars 1 forks source link

unify code of GetCounts and Modus functions, and Unique #684

Closed MaartenHilferink closed 2 months ago

MaartenHilferink commented 8 months ago

Places where frequency tables are made and used

  1. GetCounts (in CalcClassBreaks.h) results contain a ValueCountPairContainer, used in class-break functions and in the MapView for creating a suitable palette for a range of values.
  2. ModusTotBySet, ModusTotByTable, ModusPartBySet and ModusPartByTable (in Modus.cpp) and Weighted variants, and formerly: [Weighed]Modus[xxx]ByIndex, used for the modus and similar aggregation functions:
  3. GetUniqueValues (in Unique.cpp), very similar to 1, but without counting
  4. rlookup -> MakeIndex, also similar, but with keeping first index as a way of 'counting'.

See also #556

Advantages of options 1 and 3 are: very Multithreaded by bottom-up sort and aggregate by merge method Advantage of 2. is: bucket count when appropiate (when pCount * vCount < nCount), but bucket count is much less suitable for multithreading.

MaartenHilferink commented 8 months ago

Improvements at merge:

Further options:

Issues:

MaartenHilferink commented 8 months ago

ref the first issue: https://chat.openai.com/share/5518acdd-4f17-4811-bb39-df953efa5a64

jipclaassens commented 5 months ago

Use case:

2BURP, to calculate degree of urbanisation it uses 20 iterations per time step: /Analysis/Future/Indicators/Prep/DegreesOfUrbanisation/Y2030/Urban_Centre/Apply_smoothing/smoothing_loop/iter0/NextValue/MedianFiltering

MaartenHilferink commented 5 months ago

/Preprocessing/DegreesOfUrbanisation/Y2020/Urban_Centre/Typology nulmeting: 05:28. image

MaartenHilferink commented 5 months ago

image 01:36 instead of 05:28 = 232 of the 328 seconds faster, i.e. 70% speed-up.

MaartenHilferink commented 5 months ago

Todo's:

jipclaassens commented 5 months ago

Test Modus tijd:

/Preprocessing/DegreesOfUrbanisation/y2020/StoreTypology Africa

15.3.0 (2024-06-26 10.00) 2.36 min image

15.2.0 (Release) 6.37 min image

MaartenHilferink commented 5 months ago

Met parallelle sums: 01:13 i.p.v. 01:36.