ADMB Documentation  11.1.2192
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2vc6.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: f1b2vc6.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <df1b2fun.h>
00012 
00017 df1b2matrix exp(const df1b2matrix& _M)
00018 {
00019   ADUNCONST(df1b2matrix,M)
00020   int rmin=M.indexmin();
00021   int rmax=M.indexmax();
00022   df1b2matrix tmp(rmin,rmax);
00023   for (int i=rmin;i<=rmax;i++)
00024   {
00025     int cmin=M(i).indexmin();
00026     int cmax=M(i).indexmax();
00027     tmp(i).noallocate(cmin,cmax);
00028     for (int j=cmin;j<=cmax;j++)
00029       tmp(i,j)=exp(M(i,j));
00030   }
00031   return tmp;
00032 }
00033 
00038 df1b2vector colsum(const df1b2matrix& _M)
00039 {
00040   ADUNCONST(df1b2matrix,M)
00041   int rmin=M.indexmin();
00042   int rmax=M.indexmax();
00043   int cmin=M(rmin).indexmin();
00044   int cmax=M(rmin).indexmax();
00045   df1b2vector tmp(cmin,cmax);
00046   tmp.initialize();
00047   for (int i=rmin;i<=rmax;i++)
00048   {
00049     for (int j=cmin;j<=cmax;j++)
00050       tmp(j)+=M(i,j);
00051   }
00052   return tmp;
00053 }
00054 
00059 df1b2vector rowsum(const df1b2matrix& _M)
00060 {
00061   ADUNCONST(df1b2matrix,M)
00062   int rmin=M.indexmin();
00063   int rmax=M.indexmax();
00064   df1b2vector tmp(rmin,rmax);
00065   tmp.initialize();
00066   for (int i=rmin;i<=rmax;i++)
00067   {
00068     int cmin=M(rmin).indexmin();
00069     int cmax=M(rmin).indexmax();
00070     for (int j=cmin;j<=cmax;j++)
00071       tmp(i)+=M(i,j);
00072   }
00073   return tmp;
00074 }