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