ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
dmat_acc.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 
00014 #if !defined(OPT_LIB)
00015 
00020  dvector& dmatrix::operator[] (int i)
00021  {
00022      if (i < rowmin())
00023      {
00024        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
00025        "dvector& dmatrix::operator[] (int i)", rowmin(), rowmax(), i);
00026      }
00027      if (i > rowsize()+rowmin()-1)
00028      {
00029        ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
00030        "dvector& dmatrix::operator[] (int i)", rowmin(), rowmax(), i);
00031      }
00032    return *(m+i);
00033  }
00034 
00039 const dvector& dmatrix::operator[](int i) const
00040  {
00041      if (i<rowmin())
00042      {
00043        cerr << "matrix bound exceeded -- row index too low in "
00044        "dmatrix::operator[]" << "value was" << i;
00045        ad_exit(21);
00046      }
00047      if (i>rowsize()+rowmin()-1)
00048      {
00049        cerr << "matrix bound exceeded -- row index too high in "
00050        "dmatrix::operator[]" << "value was" << i;
00051        ad_exit(22);
00052      }
00053    return *(m+i);
00054  }
00055 #endif