ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
dvect24.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00017 ivector sgn(const dvector& v)
00018 {
00019   int mmin=v.indexmin();
00020   int mmax=v.indexmax();
00021   ivector tmp(mmin,mmax);
00022   for (int i=mmin;i<=mmax;i++)
00023   {
00024     if (v(i)>0.0)
00025       tmp(i)=1;
00026     else
00027       tmp(i)=-1;
00028   }
00029   return tmp;
00030 }