19 #include <iostream.hpp>
25 long int _farptr_tolong(
void* px);
26 long int farptr_tolong(
void*);
47 cout <<
"Copy constructor called for ivector with address "
48 << _farptr_tolong(t.
v) <<
"\n";
82 cerr <<
"trying to allocate an already allocated dvector " <<
endl;
112 cerr <<
"Warning -- Unable to deallocate an unallocated i3_array.\n";
125 cerr <<
"trying to deallocate a ivector with copies" <<
endl;
139 cout <<
"Copy constructor called for ivector with address "
140 << _farptr_tolong(other.
v) <<
"\n";
154 cerr <<
"Warning -- Unable to shallow copy an unallocated i3_array.\n";
173 cerr <<
" Array sizes do not match in ivector operator"
174 " =(const ivector&)" <<
endl;
209 assert(sz > 0 && sz <= INT_MAX);
216 for (
unsigned int i = 0; i < sz; i++)
222 assert(xi <= INT_MAX);
223 v[i] =
static_cast<int>(xi);
237 elem(i) =
static_cast<int>(u.
elem(i));
239 double ui = u.
elem(i);
240 assert(ui <= INT_MAX);
241 elem(i) =
static_cast<int>(ui);
271 if ((
v =
new int[static_cast<unsigned int>(nch - ncl + 1)]) == 0 )
273 cerr <<
" Error: ivector unable to allocate memory in "
274 << __FILE__ <<
':' << __LINE__ <<
'\n';
279 cerr <<
" Error: ivector unable to allocate memory in "
280 << __FILE__ <<
':' << __LINE__ <<
'\n';
289 #ifdef SAFE_INITIALIZE
290 for (
int i = ncl; i <= nch; ++i)
330 cout <<
"starting out in ivector constructor\n";
341 cerr <<
"Taking a subvector of an unallocated ivector" <<
endl;
359 sum += ivec(i) * ivec(i);
380 for (
int i = level + 1; i <=
max; ++i)
void safe_deallocate()
Safely deallocates memory by reporting if shallow copies are still in scope.
void * trueptr
Address of first element in the vector.
ivector()
Default constructor.
double sumsq(const d3_array &a)
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
~ivector()
Default destructor.
void clean(ivector &v, int level)
Set elements of ivec to zero starting from level + 1;.
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
ivector & operator=(const ivector &t)
Description not yet available.
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
int indexmax() const
Get maximum valid index.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
unsigned int ncopies
Copy counter to enable shallow copies.
double norm2(const d3_array &a)
Return sum of squared elements in a.
void allocate()
Does not allocate, but initializes class members.
Holds "shape" information for vector objects.
void deallocate()
Deallocate i3_array memory.
void safe_allocate(int ncl, int ncu)
Description not yet available.
dvector value(const df1_one_vector &v)
void shallow_copy(const ivector &t)
Shallow copy other data structure pointers.