ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lmat_a.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include "fvar.hpp"
12 
18  {
19  int nrl=pos.row_min;
20  int nrh=pos.row_max;
21  ivector& ncl=(ivector&) pos.lb;
22  ivector& nch=(ivector&) pos.ub;
23  if (nrl !=ncl.indexmin() || nrh !=ncl.indexmax() ||
24  nrl !=nch.indexmin() || nrh !=nch.indexmax())
25  {
26  cerr << "Incompatible array bounds in "
27  " lmatrix(int nrl,int nrh, const ivector& ncl, const ivector& nch)\n";
28  ad_exit(1);
29  }
30 
31  if ( (shape = new mat_shape(nrl,nrh,ncl[nrl],nch[nrl]))== 0)
32  {
33  cerr << " Error allocating memory in lmatrix contructor\n";
34  ad_exit(21);
35  }
36 
37  size_t rs=rowsize();
38  if ( (m = new lvector [rs]) == 0)
39  {
40  cerr << " Error allocating memory in lmatrix contructor\n";
41  ad_exit(21);
42  }
43 
44  #ifdef DIAG
45  cerr << "Created a lmatrix with adress "<< farptr_tolong(m)<<"\n";
46  #endif
47 
48  m -= rowmin();
49 
50  for (int i=rowmin(); i<=rowmax(); i++)
51  {
52  m[i].allocate(ncl[i],nch[i]);
53  }
54  }
Description not yet available.
Definition: fvar.hpp:7479
Description not yet available.
Definition: fvar.hpp:656
ivector lb
Definition: fvar.hpp:7484
lmatrix(void)
Default constructor.
Definition: lmat.cpp:152
int rowmax(void) const
Definition: fvar.hpp:7596
exitptr ad_exit
Definition: gradstrc.cpp:53
unsigned int rowsize() const
Definition: fvar.hpp:7601
int rowmin(void) const
Definition: fvar.hpp:7592
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: ivector.h:99
int indexmax() const
Definition: ivector.h:104
Description not yet available.
Definition: fvar.hpp:2001
mat_shape * shape
Definition: fvar.hpp:7504
size_t pos(const adstring &substr, const adstring &s)
Definition: string3.cpp:56
lvector * m
Definition: fvar.hpp:7503
void allocate(int ncl, int ncu)
Allocate vector of AD_LONG_INT.
Definition: lvector.cpp:156
ivector ub
Definition: fvar.hpp:7485