ADMB Documentation  11.1.2274
 All Classes Files Functions Variables Typedefs Friends Defines
lmat1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: lmat1.cpp 1858 2014-04-05 00:33:52Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 #include "admb_messages.h"
00013 #ifdef __TURBOC__
00014   #pragma hdrstop
00015 #endif
00016 
00017 #if !defined(OPT_LIB)
00018 
00022 lvector& lmatrix::operator()(int i)
00023 {
00024   if (i < rowmin())
00025   {
00026     ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00027     "lvector& lmatrix::operator() (int i)", rowmin(), rowmax(), i);
00028   }
00029   if (i > rowsize() + rowmin() - 1)
00030   {
00031     ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00032     "lvector& lmatrix::operator() (int i)", rowmin(), rowmax(), i);
00033   }
00034   return m[i];
00035 }
00036 
00041 const lvector& lmatrix::operator()(int i) const
00042 {
00043   if (i < rowmin())
00044   {
00045     cerr << "matrix bound exceeded -- row index too low in "
00046     "lmatrix::operator[]" << "value was" << i;
00047     ad_exit(21);
00048   }
00049   if (i > rowsize() + rowmin() - 1)
00050   {
00051     cerr << "matrix bound exceeded -- row index too high in "
00052     "lmatrix::operator[]" << "value was" << i;
00053     ad_exit(22);
00054   }
00055   return m[i];
00056 }
00057 #endif