Revision 1108 trunk/src/nh99/param_init_bounded_number_matrix.cpp
param_init_bounded_number_matrix.cpp (revision 1108)  

2  2 
* $Id$ 
3  3 
* 
4  4 
* Author: David Fournier 
5 
* Copyright (c) 20082012 Regents of the University of California


5 
* Copyright (c) 20082012 Regents of the University of California 

6  6 
*/ 
7  7 
#include "param_init_bounded_number_matrix.h" 
8  8 
#include "admb_messages.h" 
...  ...  
10  10 
param_init_bounded_number_matrix::param_init_bounded_number_matrix(): v(NULL), index_min(0), index_max(0) 
11  11 
{ 
12  12 
} 
13 
void param_init_bounded_number_matrix::allocate(int rowmin, int rowmax,


14 
int colmin, int colmax,


15 
const dmatrix& bmin, const dmatrix& bmax,


13 
void param_init_bounded_number_matrix::allocate(int rowmin, int rowmax, 

14 
int colmin, int colmax, 

15 
const dmatrix& bmin, const dmatrix& bmax, 

16  16 
const char* s) 
17  17 
{ 
18 
imatrix phase_start(rowmin, rowmax, colmin, colmax);


18 
imatrix phase_start(rowmin, rowmax, colmin, colmax); 

19  19 
phase_start = 1; 
20  20 
allocate(rowmin, rowmax, colmin, colmax, bmin, bmax, phase_start, s); 
21  21 
} 
22 
void param_init_bounded_number_matrix::allocate(int rowmin, int rowmax,


23 
int colmin, int colmax,


24 
const dmatrix& bmin, const dmatrix& bmax,


22 
void param_init_bounded_number_matrix::allocate(int rowmin, int rowmax, 

23 
int colmin, int colmax, 

24 
const dmatrix& bmin, const dmatrix& bmax, 

25  25 
const imatrix& phase_start, 
26  26 
const char* s) 
27  27 
{ 
...  ...  
93  93 
} 
94  94 
} 
95  95 
param_init_bounded_number_vector& param_init_bounded_number_matrix::operator[](const int i) const 
96 
{


96 
{ 

97  97 
//#ifdef SAFE_ARRAYS 
98 
if (i < index_min)


98 
if (i < index_min) 

99  99 
{ 
100  100 
ADMB_ARRAY_BOUNDS_ERROR("Index too low", "param_init_bounded_number_vector& param_init_bounded_number_matrix::operator[](const int i) const", index_min, index_max, i); 
101  101 
} 
102 
if (i > index_max)


102 
if (i > index_max) 

103  103 
{ 
104  104 
ADMB_ARRAY_BOUNDS_ERROR("Index too high", "param_init_bounded_number_vector& param_init_bounded_number_matrix::operator[](const int i) const", index_min, index_max, i); 
105  105 
} 
...  ...  
107  107 
return v[i]; 
108  108 
} 
109  109 
param_init_bounded_number_vector& param_init_bounded_number_matrix::operator()(const int i) const 
110 
{


110 
{ 

111  111 
//#ifdef SAFE_ARRAYS 
112 
if (i < index_min)


112 
if (i < index_min) 

113  113 
{ 
114  114 
ADMB_ARRAY_BOUNDS_ERROR("Index too low", "param_init_bounded_number_vector& param_init_bounded_number_matrix::operator[](const int i) const", index_min, index_max, i); 
115  115 
} 
116 
if (i > index_max)


116 
if (i > index_max) 

117  117 
{ 
118  118 
ADMB_ARRAY_BOUNDS_ERROR("Index too high", "param_init_bounded_number_vector& param_init_bounded_number_matrix::operator[](const int i) const", index_min, index_max, i); 
119  119 
} 
...  ...  
121  121 
return v[i]; 
122  122 
} 
123  123 
param_init_bounded_number& param_init_bounded_number_matrix::operator()(const int i, const int j) const 
124 
{


124 
{ 

125  125 
return this>operator()(i)(j); 
126  126 
} 
Also available in: Unified diff