// At this point, we populated Ai and b with elements for the current row (number currentStatePair),
// so it is time to sort these entries. There is no need to populate Ax right now:
// all we care about is the state pairs from which there have been transitions leading to the
// current state (and a diagonal element).
cern.colt.Sorting.quickSort(tmpAi.elements(),0, colEntriesNumber,new IntComparator() {
public int compare(int o1, int o2) { return o1-o2; }});
if (debugThread == threadNo) { for(int i=0;i< colEntriesNumber;++i) System.out.print(tmpAi.getQuick(i)+" ");System.out.println(); }
// Now we have to copy the result to the target array.
int pos = currentPosition[threadNo]-1;// the position where to start writing into Ai and Ax, minus 1 since it will be incremented when we find the our new value is above prev (below).
Ap[currentStatePair]=pos+1;// Ap maps each state pair to the corresponding position in Ai and Ax. We record here the first index (in Ai) of the current column