ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
dmat26.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 // file fvar.cpp
00012 // constructors, destructors and misc functions involving class dvariable
00013 
00014 #include "fvar.hpp"
00015 
00016 #ifdef __TURBOC__
00017   #pragma hdrstop
00018   #include <iostream.h>
00019 #endif
00020 
00021 #ifdef __ZTC__
00022   #include <iostream.hpp>
00023 #endif
00024 
00025 
00026 #include <stdio.h>
00027 #ifndef __SUN__
00028 #endif
00029 #include <math.h>
00030 
00035 dmatrix mfexp(const dmatrix& m)
00036 {
00037   ivector cmin(m.rowmin(),m.rowmax());
00038   ivector cmax(m.rowmin(),m.rowmax());
00039   int i;
00040   for (i=m.rowmin();i<=m.rowmax();i++)
00041   {
00042     cmin(i)=m(i).indexmin();
00043     cmax(i)=m(i).indexmax();
00044   }
00045   dmatrix tmp(m.rowmin(),m.rowmax(),cmin,cmax);
00046   for (i=m.rowmin();i<=m.rowmax();i++)
00047   {
00048     tmp(i)=mfexp(m(i));
00049   }
00050   return tmp;
00051 }
00052 
00057 dmatrix mfexp(const dmatrix& m, const double d)
00058 {
00059   ivector cmin(m.rowmin(),m.rowmax());
00060   ivector cmax(m.rowmin(),m.rowmax());
00061   int i;
00062   for (i=m.rowmin();i<=m.rowmax();i++)
00063   {
00064     cmin(i)=m(i).indexmin();
00065     cmax(i)=m(i).indexmax();
00066   }
00067   dmatrix tmp(m.rowmin(),m.rowmax(),cmin,cmax);
00068   for (i=m.rowmin();i<=m.rowmax();i++)
00069   {
00070     tmp(i)=mfexp(m(i),d);
00071   }
00072   return tmp;
00073 }