ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
imat6.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 
00017 void imatrix::allocate(const imatrix& dm)
00018 {
00019   int nrl=dm.rowmin();
00020   int nrh=dm.rowmax();
00021   //int ncl=dm.colmin();
00022   //int nch=dm.colmax();
00023   index_min=nrl;
00024   index_max=nrh;
00025 
00026   int rs=rowsize();
00027   if ( (m = new ivector [rs]) == 0)
00028   {
00029     cerr << " Error allocating memory in imatrix contructor" << endl;
00030     ad_exit(21);
00031   }
00032   if ( (shape = new mat_shapex(m))== 0)
00033   {
00034     cerr << " Error allocating memory in imatrix contructor" << endl;
00035     ad_exit(21);
00036   }
00037 
00038   m -= rowmin();
00039   for (int i=rowmin(); i<=rowmax(); i++)
00040   {
00041     m[i].allocate(dm(i));
00042   }
00043 }