ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
mfupper.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 dvariable mf_upper_bound(const prevariable& x, double M, prevariable& fpen)
00018   {
00019     if (x<=M)
00020     {
00021       return x;
00022     }
00023     else
00024     {
00025       fpen+=square(x-M);
00026       return M+(1.+2.*(x-M))/(1.+x-M);
00027     }
00028   }