ADMB Documentation  11.1.1916
 All Classes Files Functions Variables Typedefs Friends Defines
vcumdlog.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: vcumdlog.cpp 1677 2014-02-25 20:58:46Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <fvar.hpp>
00012 
00017 dvariable cumd_logistic(const prevariable& x)
00018 {
00019   if (value(x)>=0.0)
00020   {
00021     return 1.0/(1.0+exp(-x));
00022   }
00023   else
00024   {
00025     dvariable y=exp(x);
00026     return y/(1.0+y);
00027   }
00028 }
00029 
00034 dvariable inv_cumd_logistic(const prevariable& x)
00035 {
00036   return log(x/(1.0-x));
00037 }