ADMB Documentation  11.1.2490
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2v11.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: f1b2v11.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 first_difference(const df1b2vector& _x)
00018 {
00019   ADUNCONST(df1b2vector,x)
00020   int mmin=x.indexmin();
00021   int mmax=x.indexmax();
00022   df1b2vector tmp;
00023   tmp.noallocate(mmin,mmax-1);
00024   int i;
00025   for (i=mmin;i<mmax;i++)
00026   {
00027     tmp(i)=x(i+1)-x(i);
00028   }
00029   return tmp;
00030 }
00031 
00036 df1b2vector square(const df1b2vector& _x)
00037 {
00038   ADUNCONST(df1b2vector,x)
00039   int mmin=x.indexmin();
00040   int mmax=x.indexmax();
00041   df1b2vector tmp;
00042   tmp.noallocate(mmin,mmax);
00043   int i;
00044   for (i=mmin;i<=mmax;i++)
00045   {
00046     tmp(i)=square(x(i));
00047   }
00048   return tmp;
00049 }
00050 
00055 df1b2vector cube(const df1b2vector& _x)
00056 {
00057   ADUNCONST(df1b2vector,x)
00058   int mmin=x.indexmin();
00059   int mmax=x.indexmax();
00060   df1b2vector tmp;
00061   tmp.noallocate(mmin,mmax);
00062   int i;
00063   for (i=mmin;i<=mmax;i++)
00064   {
00065     tmp(i)=square(x(i));
00066   }
00067   return tmp;
00068 }