ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sdmat.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  allocate(irh);
20 }
21 
24 {
25  //unsigned nrl = 0;
26  //unsigned nrh = 0;
27  shape=NULL;
28  m=NULL;
29 }
30 
35 void sdmatrix::allocate(int irh)
36 {
37  int nrl = 1;
38  //unsigned nrh = irh;
39  index_min=nrl;
40  index_max=nrl;
41 
42  #ifdef DIAG
43  myheapcheck("Entering sdmatrix(nrh)" );
44  #endif
45 
46  #ifdef DIAG
47  cerr << "created a ncopies with address "<< farptr_tolong(&(shape->ncopies))<<"\n";
48  #endif
49  m = new dvector [rowsize()];
50 
51  #ifdef DIAG
52  cerr << "Created a sdmatrix with adress "<< farptr_tolong(m)<<"\n";
53  #endif
54 
55  shape= new mat_shapex(m);
56  m -= rowmin();
57 
58  for (int i=rowmin(); i<=rowmax(); i++)
59  {
60  m[i].allocate(1, i);
61  #ifdef DIAG
62  cerr << "Created a dvector with address "<< farptr_tolong((void*)(m+i))<<"\n";
63  #endif
64  }
65  #ifdef DIAG
66  myheapcheck("Leaving sdmatrix(nrh)" );
67  #endif
68 }
69 
74 {
75  #ifdef DIAG
76  myheapcheck("Entering ~sdmatrix() ");
77  #endif
78  deallocate();
79 }
80 
86 {
88 }
int index_min
Definition: fvar.hpp:2822
void myheapcheck(char *msg)
Does nothing.
Definition: dvector.cpp:669
Description not yet available.
Definition: fvar.hpp:2030
void deallocate()
Deallocate dmatrix memory.
Definition: dmat.cpp:363
Vector of double precision numbers.
Definition: dvector.h:50
void allocate(int ncl, int ncu)
Allocate memory for a dvector.
Definition: dvector.cpp:409
int index_max
Definition: fvar.hpp:2823
mat_shapex * shape
Definition: fvar.hpp:2825
int rowmax() const
Definition: fvar.hpp:2929
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector * m
Definition: fvar.hpp:2824
unsigned int ncopies
Definition: fvar.hpp:2034
sdmatrix()
Default constructor.
Definition: sdmat.cpp:23
~sdmatrix()
Destructor.
Definition: sdmat.cpp:73
unsigned int rowsize() const
Definition: fvar.hpp:2934
int rowmin() const
Definition: fvar.hpp:2925
void deallocate()
Description not yet available.
Definition: sdmat.cpp:85
void allocate()