ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_a31.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 dvar_vector colsum(const dvar_matrix &v)
00018   {
00019     int cmin=v.colmin();
00020     int cmax=v.colmax();
00021     int rmin=v.rowmin();
00022     int rmax=v.rowmax();
00023 
00024     dvar_vector tmp(cmin,cmax);
00025     tmp.initialize();
00026     for (int j=cmin; j<=cmax; j++)
00027     {
00028       for (int i=rmin; i<=rmax; i++)
00029       {
00030         tmp(j)+=v(i,j);
00031       }
00032     }
00033     return tmp;
00034   }
00035 
00040 dvar_vector rowsum(const dvar_matrix &v)
00041   {
00042     //int cmin=v.colmin();
00043     //int cmax=v.colmax();
00044     int rmin=v.rowmin();
00045     int rmax=v.rowmax();
00046 
00047     dvar_vector tmp(rmin,rmax);
00048     for (int i=rmin; i<=rmax; i++)
00049     {
00050       tmp(i)=sum(v(i));
00051     }
00052     return tmp;
00053   }