ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
d7arr1.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 d7_array operator/(const d7_array& m, const double d)
00018    {
00019      d7_array tmp;
00020      tmp.allocate(m);
00021      for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
00022      {
00023        tmp(i)=m(i)/d;
00024      }
00025      return tmp;
00026    }
00027 
00032 void d7_array::operator/=(const double d)
00033    {
00034      for (int i=indexmin();i<=indexmax();i++)
00035      {
00036        (*this)(i)/=d;
00037      }
00038    }
00039 
00044 double sum(const d7_array& m)
00045   {
00046     RETURN_ARRAYS_INCREMENT();
00047     double tmp=0.;
00048     for (int i=m.indexmin();i<=m.indexmax();i++)
00049     {
00050       tmp+=sum(m.elem(i));
00051     }
00052     RETURN_ARRAYS_DECREMENT();
00053     return tmp;
00054   }