ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
f7arr1.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 dvar7_array operator/(const d7_array& m, const prevariable& d)
00018    {
00019      RETURN_ARRAYS_INCREMENT();
00020      dvar7_array tmp;
00021      tmp.allocate(m);
00022      for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00023      {
00024        tmp(i)=m(i)/d;
00025      }
00026      RETURN_ARRAYS_DECREMENT();
00027      return tmp;
00028    }
00029 
00034 dvar7_array operator/(const dvar7_array& m, const double d)
00035    {
00036      RETURN_ARRAYS_INCREMENT();
00037      dvar7_array tmp;
00038      tmp.allocate(m);
00039      for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00040      {
00041        tmp(i)=m(i)/d;
00042      }
00043      RETURN_ARRAYS_DECREMENT();
00044      return tmp;
00045    }
00046 
00051 dvar7_array operator/(const dvar7_array& m, const prevariable& d)
00052    {
00053      RETURN_ARRAYS_INCREMENT();
00054      dvar7_array tmp;
00055      tmp.allocate(m);
00056      for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00057      {
00058        tmp(i)=m(i)/d;
00059      }
00060      RETURN_ARRAYS_DECREMENT();
00061      return tmp;
00062    }
00063 
00068 void dvar7_array::operator/=(const prevariable& d)
00069    {
00070      RETURN_ARRAYS_INCREMENT();
00071      for (int i=indexmin();i<=indexmax();i++)
00072      {
00073        (*this)(i)/=d;
00074      }
00075      RETURN_ARRAYS_DECREMENT();
00076    }
00077 
00082 void dvar7_array::operator/=(const double& d)
00083    {
00084      RETURN_ARRAYS_INCREMENT();
00085      for (int i=indexmin();i<=indexmax();i++)
00086      {
00087        (*this)(i)/=d;
00088      }
00089      RETURN_ARRAYS_DECREMENT();
00090    }
00091 
00096 dvariable sum(const dvar7_array& m)
00097 {
00098   RETURN_ARRAYS_INCREMENT();
00099   dvariable tmp=0.;
00100   for (int i=m.indexmin();i<=m.indexmax();i++)
00101   {
00102     tmp+=sum(m.elem(i));
00103   }
00104   RETURN_ARRAYS_DECREMENT();
00105   return tmp;
00106 }