ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
imsort.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Author: David Fournier
4  *
5  * Copyright (c) 2009-2012 ADMB Foundation
6  */
11 #include <fvar.hpp>
12 
17 imatrix sort(const imatrix& m, int col, int NSTACK)
18 {
19  ivector ind(m.rowmin(),m.rowmax());
20  ivector ind1(m.rowmin(),m.rowmax());
21  ivector ind2(m.rowmin(),m.rowmax());
22  int i;
23  for (i=m.rowmin();i<=m.rowmax();i++)
24  {
25  ind1(i)=m(i).indexmin();
26  ind2(i)=m(i).indexmax();
27  }
28  //const ivector& iv=column(m,col);
29  sort(column(m,col),ind);
30  imatrix tmp(m.rowmin(),m.rowmax(),ind1,ind2);
31  for (i=m.rowmin();i<=m.rowmax();i++)
32  {
33  tmp(i)=m(ind(i));
34  }
35  return tmp;
36 }
int indexmax() const
Definition: imatrix.h:142
Description not yet available.
Definition: imatrix.h:69
int indexmin() const
Definition: imatrix.h:138
int rowmin() const
Definition: imatrix.h:146
dmatrix sort(const dmatrix &m, int column, int NSTACK)
Description not yet available.
Definition: dmsort.cpp:17
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector column(const dmatrix &matrix, int j)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat6.cpp:13
int rowmax() const
Definition: imatrix.h:150