Remi Ricard remi.ricard at simlog.com
Mon Jun 18 08:20:29 MST 2007


I was looking at this since the dRandInt is one of the most called function.

In the code is :
if ((iteration & 7) == 0) {
   for (i=1; i<m; ++i) {
     IndexError tmp = order[i];
     int swapi = dRandInt(i+1);
     order[i] = order[swapi];
     order[swapi] = tmp;

My observation on this code is:
1- The values at the beginning of the array "order" have more chances
to be swapped. Is there a reason for that.

2- Why not do: dRandInt(m); instead of dRandInt(i+1);

Then if  dRandInt(m); is used why not do 3*m/4 or even m/2 randomization 
instead of m.  I don't think that every thing must be randomized. If 
order[x-1] has been swapped and order[x+1] has been swapped order[x] 
does not really need to be swapped since the order of the rows in the 
big matrix to be solved have changed.


More information about the ODE mailing list