ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
ivect11.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  */
00007 #include "fvar.hpp"
00008 
00014 void ivector::reallocate(double s)
00015 {
00016   if (::allocated(*this))
00017   {
00018     int oldmin=indexmin();
00019     int oldmax=indexmax();
00020     ivector tmp(indexmin(),indexmax());
00021     tmp=(*this);
00022     deallocate();
00023     allocate(indexmin(),int(s*indexmax()));
00024 #ifndef OPT_LIB
00025     initialize();
00026 #endif
00027     int max = oldmax < indexmax() ? oldmax : indexmax();
00028     (*this)(oldmin, max) = tmp(oldmin, max);
00029   }
00030 }