ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_m35.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 #include "admb_messages.h"
00013 
00018 dvariable colsum(const dvar_matrix& m, int col)
00019 {
00020   if (col < m.rowmin() || col > m.rowmax())
00021   {
00022     ADMB_ARRAY_BOUNDS_ERROR("Row out of bounds",
00023     "dvariable colsum(const dvar_matrix& m, int col)",
00024     m.rowmin(), m.rowmax(), col);
00025   }
00026   dvariable isum=0.0;
00027   int mmin=m.rowmin();
00028   int mmax=m.rowmax();
00029   for (int i=mmin;i<=mmax;i++)
00030   {
00031     isum+=m(i,col);
00032   }
00033   return isum;
00034 }