ADMB Documentation  11.2.2853
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2vc8.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: f1b2vc8.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 df1b2vector operator + (const df1b2variable& _x,const dvector& _v)
00018 {
00019   ADUNCONST(dvector,v)
00020   ADUNCONST(df1b2variable,x)
00021   //check_shape(x,M,"operator *");
00022   int mmin=v.indexmin();
00023   int mmax=v.indexmax();
00024   df1b2vector tmp;
00025   tmp.noallocate(mmin,mmax);
00026   for (int i=mmin;i<=mmax;i++) tmp(i)=x+v(i);
00027   return tmp;
00028 }
00029 
00034 df1b2vector operator - (const df1b2vector& _v,const df1b2variable& _x)
00035 {
00036   ADUNCONST(df1b2vector,v)
00037   ADUNCONST(df1b2variable,x)
00038   //check_shape(x,M,"operator *");
00039   int mmin=v.indexmin();
00040   int mmax=v.indexmax();
00041   df1b2vector tmp;
00042   tmp.noallocate(mmin,mmax);
00043   for (int i=mmin;i<=mmax;i++) tmp(i)=v(i)-x;
00044   return tmp;
00045 }
00046 
00051 df1b2vector operator - (const df1b2variable& _x,const df1b2vector& _v)
00052 {
00053   ADUNCONST(df1b2vector,v)
00054   ADUNCONST(df1b2variable,x)
00055   //check_shape(x,M,"operator *");
00056   int mmin=v.indexmin();
00057   int mmax=v.indexmax();
00058   df1b2vector tmp;
00059   tmp.noallocate(mmin,mmax);
00060   for (int i=mmin;i<=mmax;i++) tmp(i)=x-v(i);
00061   return tmp;
00062 }
00063 
00068 df1b2vector operator - (const df1b2variable& _x,const dvector& _v)
00069 {
00070   ADUNCONST(dvector,v)
00071   ADUNCONST(df1b2variable,x)
00072   //check_shape(x,M,"operator *");
00073   int mmin=v.indexmin();
00074   int mmax=v.indexmax();
00075   df1b2vector tmp;
00076   tmp.noallocate(mmin,mmax);
00077   for (int i=mmin;i<=mmax;i++) tmp(i)=x-v(i);
00078   return tmp;
00079 }
00080 
00085 df1b2vector operator - (const dvector& _v,const df1b2variable& _x)
00086 {
00087   ADUNCONST(dvector,v)
00088   ADUNCONST(df1b2variable,x)
00089   //check_shape(x,M,"operator *");
00090   int mmin=v.indexmin();
00091   int mmax=v.indexmax();
00092   df1b2vector tmp;
00093   tmp.noallocate(mmin,mmax);
00094   for (int i=mmin;i<=mmax;i++) tmp(i)=v(i)-x;
00095   return tmp;
00096 }
00097 
00102 df1b2vector operator + (const dvector& _v,const df1b2variable& _x)
00103 {
00104   ADUNCONST(dvector,v)
00105   ADUNCONST(df1b2variable,x)
00106   //check_shape(x,M,"operator *");
00107   int mmin=v.indexmin();
00108   int mmax=v.indexmax();
00109   df1b2vector tmp;
00110   tmp.noallocate(mmin,mmax);
00111   for (int i=mmin;i<=mmax;i++) tmp(i)=v(i)+x;
00112   return tmp;
00113 }
00114 
00119 df1b2vector operator * (const dvector& _v,const df1b2variable& _x)
00120 {
00121   ADUNCONST(dvector,v)
00122   ADUNCONST(df1b2variable,x)
00123   //check_shape(x,M,"operator *");
00124   int mmin=v.indexmin();
00125   int mmax=v.indexmax();
00126   df1b2vector tmp;
00127   tmp.noallocate(mmin,mmax);
00128   for (int i=mmin;i<=mmax;i++) tmp(i)=v(i)*x;
00129   return tmp;
00130 }