ADMB Documentation  11.1.2438
 All Classes Files Functions Variables Typedefs Friends Defines
dvect26.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: dvect26.cpp 2414 2014-09-26 22:14:00Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 
00018 void dvector::reallocate(double s)
00019 {
00020   if (::allocated(*this))
00021   {
00022     int oldmin=indexmin();
00023     int oldmax=indexmax();
00024     dvector tmp(indexmin(),indexmax());
00025     tmp=(*this);
00026     deallocate();
00027     allocate(indexmin(),int(s*indexmax()));
00028 #ifndef OPT_LIB
00029     initialize();
00030 #endif
00031     int max = oldmax < indexmax() ? oldmax : indexmax();
00032     (*this)(oldmin, max) = tmp(oldmin, max);
00033   }
00034 }