ADMB Documentation  11.1.2274
 All Classes Files Functions Variables Typedefs Friends Defines
df1b2-separable/bounder.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: bounder.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "df1b2fun.h"
00012 
00020 df1b2variable bounder(const df1b2variable&  x,double min,double max,
00021     double scale)
00022 {
00023   df1b2variable y=x/scale;
00024   df1b2variable z;
00025   if (value(y)<20.0)
00026   {
00027     z=exp(y)/(1.0+exp(y));
00028   }
00029   else
00030   {
00031     z=1.0/(1+exp(-y));
00032   }
00033   return min+(max-min)*z;
00034 }