ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a58.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
13 ivector sgn(const dvar_vector& variables)
14 {
15  int mmin = variables.indexmin();
16  int mmax = variables.indexmax();
17  ivector signs(mmin,mmax);
18  for (int i = mmin; i <= mmax; ++i)
19  {
20  signs(i) = variables(i) > 0.0 ? 1 : -1;
21  }
22  return signs;
23 }
ADMB variable vector.
Definition: fvar.hpp:2172
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
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: fvar.hpp:2287
int indexmax() const
Definition: fvar.hpp:2292