ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
f5arr1.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 sum(const dvar5_array& m)
00018 {
00019   RETURN_ARRAYS_INCREMENT();
00020   dvariable tmp=0.;
00021   for (int i=m.indexmin();i<=m.indexmax();i++)
00022   {
00023     tmp+=sum(m.elem(i));
00024   }
00025   RETURN_ARRAYS_DECREMENT();
00026   return tmp;
00027 }
00028 
00029 
00034 dvar5_array sqrt(const dvar5_array& m)
00035 {
00036   RETURN_ARRAYS_INCREMENT();
00037   dvar5_array tmp;
00038   tmp.allocate(m);
00039   for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00040   {
00041     tmp(i)=sqrt(m(i));
00042   }
00043   RETURN_ARRAYS_DECREMENT();
00044   return tmp;
00045 }
00046 
00051 dvar5_array exp(const dvar5_array& m)
00052 {
00053   RETURN_ARRAYS_INCREMENT();
00054   dvar5_array tmp;
00055   tmp.allocate(m);
00056   for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00057   {
00058     tmp(i)=exp(m(i));
00059   }
00060   RETURN_ARRAYS_DECREMENT();
00061   return tmp;
00062 }
00063 
00068 dvar5_array mfexp(const dvar5_array& m)
00069 {
00070   RETURN_ARRAYS_INCREMENT();
00071   dvar5_array tmp;
00072   tmp.allocate(m);
00073   for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00074   {
00075     tmp(i)=mfexp(m(i));
00076   }
00077   RETURN_ARRAYS_DECREMENT();
00078   return tmp;
00079 }
00080 
00085 dvar5_array log(const dvar5_array& m)
00086 {
00087   RETURN_ARRAYS_INCREMENT();
00088   dvar5_array tmp;
00089   tmp.allocate(m);
00090   for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00091   {
00092     tmp(i)=log(m(i));
00093   }
00094   RETURN_ARRAYS_DECREMENT();
00095   return tmp;
00096 }