ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
imat4.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 #include "fvar.hpp"
00012 #include "admb_messages.h"
00013 #ifdef __TURBOC__
00014   #pragma hdrstop
00015 #endif
00016 
00017 #ifndef OPT_LIB
00018 
00023  ivector& imatrix::operator[] (int i)
00024  {
00025    if (i < rowmin())
00026    {
00027      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00028      "ivector& imatrix::operator[] (int i)", rowmin(), rowmax(), i);
00029    }
00030    if (i > rowsize() + rowmin() - 1)
00031    {
00032      ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00033      "ivector& imatrix::operator[] (int i)", rowmin(), rowmax(), i);
00034    }
00035    return m[i];
00036  }
00037 
00042 const ivector& imatrix::operator[](int i) const
00043  {
00044      if (i<rowmin())
00045      {
00046        cerr << "matrix bound exceeded -- row index too low in "
00047        "imatrix::operator[]" << "value was" << i;
00048        ad_exit(21);
00049      }
00050      if (i>rowsize()+rowmin()-1)
00051      {
00052        cerr << "matrix bound exceeded -- row index too high in "
00053        "imatrix::operator[]" << "value was" << i;
00054        ad_exit(22);
00055      }
00056    return m[i];
00057  }
00058 #endif