ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect24.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
11 ivector sgn(const dvector& v)
12 {
13  int mmin = v.indexmin();
14  int mmax = v.indexmax();
15  ivector ret(mmin, mmax);
16  for (int i = mmin; i <= mmax; ++i)
17  {
18  ret(i)= v(i) > 0 ? 1 : -1;
19  }
20  return ret;
21 }
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
ivector sgn(const dvector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dvect24.cpp:11
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.