ADMB Documentation  11.1.2490
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_m38.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fvar_m38.cpp 1942 2014-04-28 22:22:45Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <fvar.hpp>
00012 
00017 dvar_matrix operator*(const prevariable& x, const dmatrix& m)
00018 {
00019   RETURN_ARRAYS_INCREMENT();
00020   int rmin=m.rowmin();
00021   int rmax=m.rowmax();
00022 
00023   ivector cmin(rmin,rmax);
00024   ivector cmax(rmin,rmax);
00025 
00026   int i;
00027   for (i=rmin;i<=rmax;i++)
00028   {
00029     cmin(i)=(m(i)).indexmin();
00030     cmax(i)=(m(i)).indexmax();
00031   }
00032   dvar_matrix tmp(rmin,rmax,cmin,cmax);
00033 
00034   for (i=rmin;i<=rmax;i++)
00035   {
00036     tmp(i)=x*m(i);
00037   }
00038   RETURN_ARRAYS_DECREMENT();
00039   return tmp;
00040 }
00041 
00046 dvar_matrix operator*(const dvar_matrix& m, const double x)
00047 {
00048   RETURN_ARRAYS_INCREMENT();
00049   int rmin=m.rowmin();
00050   int rmax=m.rowmax();
00051 
00052   ivector cmin(rmin,rmax);
00053   ivector cmax(rmin,rmax);
00054 
00055   int i;
00056   for (i=rmin;i<=rmax;i++)
00057   {
00058     cmin(i)=(m(i)).indexmin();
00059     cmax(i)=(m(i)).indexmax();
00060   }
00061   dvar_matrix tmp(rmin,rmax,cmin,cmax);
00062 
00063   for (i=rmin;i<=rmax;i++)
00064   {
00065     tmp(i)=x*m(i);
00066   }
00067   RETURN_ARRAYS_DECREMENT();
00068   return tmp;
00069 }
00070 
00075 dvar_matrix operator*(const double x, const dvar_matrix& m)
00076 {
00077   RETURN_ARRAYS_INCREMENT();
00078   int rmin=m.rowmin();
00079   int rmax=m.rowmax();
00080 
00081   ivector cmin(rmin,rmax);
00082   ivector cmax(rmin,rmax);
00083 
00084   int i;
00085   for (i=rmin;i<=rmax;i++)
00086   {
00087     cmin(i)=(m(i)).indexmin();
00088     cmax(i)=(m(i)).indexmax();
00089   }
00090   dvar_matrix tmp(rmin,rmax,cmin,cmax);
00091 
00092   for (i=rmin;i<=rmax;i++)
00093   {
00094     tmp(i)=x*m(i);
00095   }
00096   RETURN_ARRAYS_DECREMENT();
00097   return tmp;
00098 }