44 #include "EST_TVector.h"
45 #include "EST_matrix_support.h"
46 #include "EST_cutils.h"
47 #include "EST_error.h"
82 T *memory,
int offset,
int free_when_destroyed)
86 set_memory(memory, offset, n, free_when_destroyed);
96 if (p_memory != NULL && !p_sub_matrix)
98 delete [] (p_memory-p_offset);
107 for (
int i = 0; i < num_columns(); ++i)
113 int free_when_destroyed)
115 if (p_memory != NULL && !p_sub_matrix)
116 delete [] (p_memory-p_offset);
118 p_memory = buffer-offset;
120 p_num_columns = columns;
122 p_sub_matrix = !free_when_destroyed;
131 for(
int i=0, c=start_c, p=0; i<num_c; i++, c++, p+=step)
132 a_no_check(c) = data[p];
142 for(
int i=0, c=start_c, p=0; i<num_c; i++, c++, p+=step)
143 data[p] = a_no_check(c);
150 set_values(a.
p_memory, a.p_column_step, 0, num_columns());
156 resize(a.
n(), FALSE);
165 if (num_columns() != new_cols || p_memory == NULL )
168 EST_error(
"Attempt to resize Sub-Vector");
171 EST_error(
"Attempt to resize vector to negative size: %d",
174 new_m =
new T[new_cols];
176 if (p_memory != NULL)
178 if (old_vals != NULL)
179 *old_vals = p_memory;
180 else if (!p_sub_matrix)
181 delete [] (p_memory-p_offset);
187 p_num_columns = new_cols;
191 *old_vals = p_memory;
199 T * old_vals = p_memory;
200 int old_cols = num_columns();
201 int old_offset = p_offset;
202 int old_column_step = p_column_step;
204 just_resize(new_cols, &old_vals);
212 else if (old_vals != p_memory)
214 copy_c = Lof(num_columns(), old_cols);
216 for(i=0; i<copy_c; i++)
218 = old_vals[vcell_pos(i,
224 for(i=copy_c; i<new_cols; i++)
225 a_no_check(i) = *def_val;
228 if (old_vals && old_vals != p_memory && !p_sub_matrix)
229 delete [] (old_vals-old_offset);
242 if (!EST_vector_bounds_check(n, num_columns(), FALSE))
243 return *error_return;
260 for(
int i=0; i<num_columns() ; i++)
274 num = num_columns()-offset;
276 if (!EST_vector_bounds_check(num+offset-1, num_columns(), FALSE))
280 for(
int i=0; i<num; i++)
281 dest[i] = a_no_check(offset+i);
288 num = num_columns()-offset;
290 if (!EST_vector_bounds_check(num+offset-1, num_columns(), FALSE))
293 for(
int i=0; i<num; i++)
294 a_no_check(offset+i) = src[i];
299 int start_c,
int len)
302 len = num_columns()-start_c;
304 if (sv.
p_memory != NULL && ! sv.p_sub_matrix)
307 sv.p_sub_matrix = TRUE;
308 sv.
p_offset = p_offset + start_c*p_column_step;
310 sv.p_column_step=p_column_step;
317 cout <<
"integrity: p_memory=" << p_memory << endl;
318 if(p_memory == (T *)0x00080102)
320 cout <<
"fatal value!!!\n";