ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m37.cpp
Go to the documentation of this file.
1 
5 #include <fvar.hpp>
6 
7 #ifndef OPT_LIB
8  #include <cassert>
9 #endif
10 
20  const ad_integer& nrl, const ad_integer& nrh,
21  const index_type& ncl, const index_type& nch)
22 {
23  allocate(nrl,nrh,ncl,nch);
24 #ifndef OPT_LIB
25  initialize();
26 #endif
27 }
37  const ad_integer& nrl, const ad_integer& nrh,
38  const index_type& ncl, const index_type& nch)
39 {
40  if (nrl>nrh)
41  {
42  allocate();
43  }
44  else
45  {
46  //if (nrl !=ncl.indexmin() || nrh !=ncl.indexmax() ||
47  // nrl !=nch.indexmin() || nrh !=nch.indexmax())
48  if ((ncl.isinteger() && (nrl !=ncl.indexmin() || nrh !=ncl.indexmax())) ||
49  (nch.isinteger() && (nrl !=nch.indexmin() || nrh !=nch.indexmax())))
50  {
51  cerr << "Incompatible array bounds in dvar_matrix(int nrl,int nrh,"
52  "const ivector& ncl, const ivector& nch)" << endl;
53  ad_exit(1);
54  }
55  index_min=int(nrl);
56  index_max=int(nrh);
57  if ((m = new dvar_vector[rowsize()]) == 0)
58  {
59  cerr << " Error allocating memory in dmatrix contructor" << endl;
60  ad_exit(21);
61  }
62  if ((shape = new mat_shapex(m)) == 0)
63  {
64  cerr << " Error allocating memory in dvar_matrix contructor" << endl;
65  ad_exit(21);
66  }
67  m -= int(nrl);
68  for (int i=nrl; i<=nrh; i++)
69  {
70  m[i].allocate(ncl[i],nch[i]);
71  }
72  }
73 }
Uses polymorphism to get index information from various data types to be used in constructing and all...
Definition: fvar.hpp:7731
Description not yet available.
Definition: fvar.hpp:2030
int isinteger() const
Definition: fvar.hpp:7752
void initialize(void)
Zero initialize allocated dvar_matrix, then saves adjoint function and position data.
Definition: fvar_ma7.cpp:48
exitptr ad_exit
Definition: gradstrc.cpp:53
ADMB variable vector.
Definition: fvar.hpp:2172
mat_shapex * shape
Definition: fvar.hpp:2485
prnstream & endl(prnstream &)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void allocate(void)
Does not allocate, but initializes members.
Definition: fvar_mat.cpp:479
int indexmax() const
Definition: fvar.hpp:7764
int index_min
Definition: fvar.hpp:2482
unsigned int rowsize() const
Definition: fvar.hpp:2578
void allocate(int, int)
Allocate dvar_vector with indexmin = ncl and indexmax = nch.
Definition: fvar_arr.cpp:270
dvar_matrix()
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: fvar_mat.cpp:15
Stores integer.
Definition: fvar.hpp:7654
int index_max
Definition: fvar.hpp:2483
dvar_vector * m
Definition: fvar.hpp:2484
int indexmin() const
Definition: fvar.hpp:7760