Hey,
I am sorting values in a matrix by row, along with the indices.
While using fire-array timer to time my code for sorting array of values with indices; i got somewhat confusing results.
The code fragment is:
array A = randu(n,n);
array sorted , idx;
//start timer
timer::toc();
//sort matrix row-wise along with indices
sort(sorted,idx,A);
//print the execution time.
printf(“%g\n”, (timer::toc())*1000000 );
size time (microseconds)
10000 53
10000 51
10000 53
10000 53
10000 52
40000 223793
40000 223670
40000 223821
40000 223562
40000 224029
90000 224240
90000 223927
90000 223998
90000 224119
90000 224087
160000 437
160000 430
160000 646
160000 882
160000 620
250000 537
250000 500
250000 574
250000 1085
250000 713
360000 943
360000 447
360000 463
360000 874
360000 671
490000 960
490000 602
490000 339
490000 347
490000 566
640000 802
640000 690
640000 516
640000 717
640000 344
810000 378
810000 823
810000 304
810000 321
810000 769
For matrix size from 40000 to 90000 it takes the greatest time. I am not sure how it is. Moreover, there should
be an increase in time-spent with the increase in size of matrix size which we don’t observe here.
Any help in this regard’ll be greatly appreciated.
thanks,
haji