44#include "EST_TVector.h"
45#include "EST_matrix_support.h"
46#include "EST_cutils.h"
96 if (p_memory != NULL && !p_sub_matrix)
98 delete [] (p_memory-p_offset);
107 for (
int i = 0; i < num_columns(); ++i)
115 if (p_memory != NULL && !p_sub_matrix)
116 delete [] (p_memory-p_offset);
118 p_memory = buffer-offset;
132 a_no_check(c) = data[p];
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",
176 if (p_memory != NULL)
180 else if (!p_sub_matrix)
181 delete [] (p_memory-p_offset);
225 a_no_check(i) = *def_val;
242 if (!EST_vector_bounds_check(n, num_columns(), FALSE))
243 return *error_return;
257 if (num_columns() !=
v.num_columns())
260 for(
int i=0; i<num_columns() ; i++)
262 if (fast_a_v(i) ==
v.fast_a_v(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];
304 if (
sv.p_memory != NULL && !
sv.p_sub_matrix)
305 delete [] (
sv.p_memory -
sv.p_offset);
307 sv.p_sub_matrix = TRUE;
308 sv.p_offset = p_offset +
start_c*p_column_step;
309 sv.p_memory = p_memory - p_offset +
sv.p_offset;
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";
const T & a_check(int n) const
read-only const access operator: with bounds checking
void just_resize(int new_cols, T **old_vals)
resize the memory and reset the bounds, but don't set values.
void resize(int n, int set=1)
void default_vals()
sets data and length to default values (0 in both cases).
EST_TVector & operator=(const EST_TVector &s)
assignment operator
void copy_data(const EST_TVector< T > &a)
just copy data, no resizing, no size check.
void copy_section(T *dest, int offset=0, int num=-1) const
Copy data in and out. Subclassed by SimpleVector for speed.
void copy(const EST_TVector< T > &a)
private copy function, called from all other copying functions.
int operator==(const EST_TVector &v) const
is true if vectors are equal size and all elements are equal.
EST_TVector()
default constructor
void sub_vector(EST_TVector< T > &sv, int start_c=0, int len=-1)
Create a sub vector.
void fill(const T &v)
Fill entire array will value <parameter>v</parameter>.
~EST_TVector()
destructor.
void set_values(const T *data, int step, int start_c, int num_c)
Get and set values from array.