MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / internalstatheapsort

Function internalstatheapsort

src/descriptivestatistics.cpp:347–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346
347static void internalstatheapsort(ap::real_1d_array& arr, int n)
348{
349 int i;
350 int k;
351 int t;
352 double tmp;
353
354 if( n==1 )
355 {
356 return;
357 }
358 i = 2;
359 do
360 {
361 t = i;
362 while(t!=1)
363 {
364 k = t/2;
365 if( ap::fp_greater_eq(arr(k-1),arr(t-1)) )
366 {
367 t = 1;
368 }
369 else
370 {
371 tmp = arr(k-1);
372 arr(k-1) = arr(t-1);
373 arr(t-1) = tmp;
374 t = k;
375 }
376 }
377 i = i+1;
378 }
379 while(i<=n);
380 i = n-1;
381 do
382 {
383 tmp = arr(i);
384 arr(i) = arr(0);
385 arr(0) = tmp;
386 t = 1;
387 while(t!=0)
388 {
389 k = 2*t;
390 if( k>i )
391 {
392 t = 0;
393 }
394 else
395 {
396 if( k<i )
397 {
398 if( ap::fp_greater(arr(k),arr(k-1)) )
399 {
400 k = k+1;
401 }
402 }
403 if( ap::fp_greater_eq(arr(t-1),arr(k-1)) )
404 {

Callers 1

calculatepercentileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected