ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmsort.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 dmatrix sort(const dmatrix& m, int column, 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  sort(extract_column(m,column),ind);
29  dmatrix tmp(m.rowmin(),m.rowmax(),ind1,ind2);
30  for (i=m.rowmin();i<=m.rowmax();i++)
31  {
32  tmp(i)=m(ind(i));
33  }
34  return tmp;
35 }
int indexmin() const
Definition: fvar.hpp:2917
dvector extract_column(const dmatrix &matrix, int j)
Extract copy of jth column vector from matrix m.
Definition: dmat6.cpp:34
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
int rowmax() const
Definition: fvar.hpp:2929
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
Definition: fvar.hpp:2819
int indexmax() const
Definition: fvar.hpp:2921
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 rowmin() const
Definition: fvar.hpp:2925