[ADMB Users] Application of 'sort' function to variables

dave fournier otter at otter-rsch.com
Mon Apr 26 08:20:56 PDT 2010


  Of course it is not necessary to sort
  the whole matrix, just the column ic.

  However I fear that whatever you have in mind
  will turn out to be non differentiable.

     dmatrix CM(rmin,rmax,1,2);
     int i;
     for (i=rmin;i<=rmax;i++)
     {
       CM(i,1)=value(M(i,ic));
       CM(i,2)=i;   // keep track of the rows
     }
     dmatrix SCM=sort(CM,1);
     dvector ind=column(SCM,2);




More information about the Users mailing list