Revision 1108 trunk/src/nh99/vec_io.cpp
vec_io.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 <admodel.h> 
8  8  
9 
vector_kludge::vector_kludge(const param_init_number_vector & _v) :


9 
vector_kludge::vector_kludge(const param_init_number_vector & _v):


10  10 
dvar_vector() 
11  11 
{ 
12 
param_init_number_vector & v = (param_init_number_vector &) _v;


12 
param_init_number_vector & v = (param_init_number_vector &) _v; 

13  13 
int mmin=v.indexmin(); 
14  14 
int mmax=v.indexmax(); 
15  15 
dvar_vector::allocate(mmin,mmax); 
...  ...  
18  18 
(*this)(i)=v(i); 
19  19 
} 
20  20 
} 
21 


22 
vector_kludge::vector_kludge(const param_init_bounded_number_vector & _v) :


21  
22 
vector_kludge::vector_kludge(const param_init_bounded_number_vector & _v):


23  23 
dvar_vector() 
24  24 
{ 
25 
param_init_number_vector & v = (param_init_number_vector &) _v;


25 
param_init_number_vector & v = (param_init_number_vector &) _v; 

26  26 
int mmin=v.indexmin(); 
27  27 
int mmax=v.indexmax(); 
28  28 
dvar_vector::allocate(mmin,mmax); 
...  ...  
31  31 
(*this)(i)=v(i); 
32  32 
} 
33  33 
} 
34 


35  34  
36 
matrix_kludge::matrix_kludge(const param_init_vector_vector & _v) :


35 
matrix_kludge::matrix_kludge(const param_init_vector_vector & _v):


37  36 
dvar_matrix() 
38  37 
{ 
39 
param_init_vector_vector & v = (param_init_vector_vector &) _v;


38 
param_init_vector_vector & v = (param_init_vector_vector &) _v; 

40  39 
int mmin=v.indexmin(); 
41  40 
int mmax=v.indexmax(); 
42  41 
dvar_matrix::allocate(mmin,mmax); 
...  ...  
45  44 
(*this)(i).shallow_copy(v(i)); 
46  45 
} 
47  46 
} 
48 


49 
matrix_kludge::matrix_kludge(const param_init_bounded_vector_vector & _v) :


47  
48 
matrix_kludge::matrix_kludge(const param_init_bounded_vector_vector & _v):


50  49 
dvar_matrix() 
51  50 
{ 
52 
param_init_bounded_vector_vector & v = (param_init_bounded_vector_vector &) _v;


51 
param_init_bounded_vector_vector & v = (param_init_bounded_vector_vector &) _v; 

53  52 
int mmin=v.indexmin(); 
54  53 
int mmax=v.indexmax(); 
55  54 
dvar_matrix::allocate(mmin,mmax); 
...  ...  
58  57 
(*this)(i).shallow_copy(v(i)); 
59  58 
} 
60  59 
} 
61 


62  
63  
64 
// 

60 
// 

65  61 
// ostream& operator << (const ostream& _s, const param_init_number_vector v) 
66  62 
// { 
67  63 
// ostream & s = (ostream &)(_s); 
68 
// int mmin=v.indexmin();


69 
// int mmax=v.indexmax();


64 
// int mmin=v.indexmin(); 

65 
// int mmax=v.indexmax(); 

70  66 
// for (int i=mmin;i<=mmax;i++) 
71  67 
// { 
72  68 
// s << v(i) << endl; 
73  69 
// } 
74  70 
// return s; 
75  71 
// } 
76 
//


72 
// 

77  73 
// ostream& operator << (const ostream& _s, const param_init_bounded_number_vector v) 
78  74 
// { 
79  75 
// ostream & s = (ostream &)(_s); 
80 
// int mmin=v.indexmin();


81 
// int mmax=v.indexmax();


76 
// int mmin=v.indexmin(); 

77 
// int mmax=v.indexmax(); 

82  78 
// for (int i=mmin;i<=mmax;i++) 
83  79 
// { 
84  80 
// s << v(i) << endl; 
Also available in: Unified diff