ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
imat1.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 <cassert>
00013 
00019 bool imatrix::is_valid_row(const int i) const
00020 {
00021   const bool valid = index_min <= i && i <= index_max;
00022   if (!valid)
00023   {
00024     cerr << "Error: Used invalid i = " << i << " for imatrix rows bounded by ["
00025          << index_min << ", " << index_max << "].\n";
00026   }
00027   return valid;
00028 }
00029 #if !defined(OPT_LIB)
00030 
00036 ivector& imatrix::operator()(int i)
00037 {
00038   assert((index_min <= i && i <= index_max) || is_valid_row(i));
00039 
00040   return elem(i);
00041 }
00048 const ivector& imatrix::operator()(int i) const
00049 {
00050   assert((index_min <= i && i <= index_max) || is_valid_row(i));
00051 
00052   return elem(i);
00053 }
00054 #endif