ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_op4.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_ops.cpp
00012 // operators involving prevariables
00013 
00014 //#undef OPT_LIB
00015 #include "fvar.hpp"
00016 
00017 #ifdef __TURBOC__
00018   #pragma hdrstop
00019   #include <iostream.h>
00020 #endif
00021 
00022 #ifdef __ZTC__
00023   #include <iostream.hpp>
00024 #endif
00025 
00026 #include <stdio.h>
00027 #include <math.h>
00028 
00029 
00030 void gradfree(dlink *);
00031 
00032 #ifndef OPT_LIB
00033 
00038     prevariable dvar_vector::operator[] (int i)
00039     {
00040         if (i<indexmin())
00041         {
00042           cerr << "array bound exceeded -- index too low in "
00043           "prevariable::operator[]";
00044           ad_exit(1);
00045         }
00046         if (i>indexmax())
00047         {
00048           cerr << "array bound exceeded -- index too high in "
00049           "prevariable::operator[]";
00050           ad_exit(1);
00051         }
00052       //((va+i)->nc)++;
00053       return (va+i);
00054     }
00055 
00060     prevariable dvar_vector::operator() (int i)
00061     {
00062         if (i<indexmin())
00063         {
00064           cerr << "array bound exceeded -- index too low in "
00065           "prevariable::operator()";
00066           ad_exit(1);
00067         }
00068         if (i>indexmax())
00069         {
00070           cerr << "array bound exceeded -- index too high in "
00071           "prevariable::operator()";
00072           ad_exit(1);
00073         }
00074       //((va+i)->nc)++;
00075       return (va+i);
00076     }
00077 
00082 const prevariable dvar_vector::operator[](int i) const
00083     {
00084         if (i<indexmin())
00085         {
00086           cerr << "array bound exceeded -- index too low in "
00087           "prevariable::operator[]";
00088           ad_exit(1);
00089         }
00090         if (i>indexmax())
00091         {
00092           cerr << "array bound exceeded -- index too high in "
00093           "prevariable::operator[]";
00094           ad_exit(1);
00095         }
00096       //((va+i)->nc)++;
00097       return (va+i);
00098     }
00099 
00104 const prevariable dvar_vector::operator()(int i) const
00105     {
00106         if (i<indexmin())
00107         {
00108           cerr << "array bound exceeded -- index too low in "
00109           "prevariable::operator()";
00110           ad_exit(1);
00111         }
00112         if (i>indexmax())
00113         {
00114           cerr << "array bound exceeded -- index too high in "
00115           "prevariable::operator()";
00116           ad_exit(1);
00117         }
00118       //((va+i)->nc)++;
00119       return (va+i);
00120     }
00121 #endif