51 const d3_array* pdarrayi = &darray(min);
52 for (
int i = min; i <=
max; ++i)
54 total +=
sum(*pdarrayi);
69 for (
int i=nrl; i<=nrh; i++)
101 cerr <<
"Warning -- Unable to shallow copy an unallocated d4_array.\n";
126 cerr <<
"Warning -- Unable to deallocate an unallocated d4_array.\n";
147 cerr <<
"Incompatible bounds in"
148 <<
" d4_array& d4_array::operator=(const d4_array&).\n";
152 const d3_array* potheri = &other(min);
153 for (
int i = min; i <=
max; ++i)
173 const d3_array* potheri = &other(min);
174 for (
int i = min; i <=
max; ++i)
208 "d3_array& d4_array::operator[] (int i)",
218 dmatrix& d4_array::operator ( ) (
int i ,
int j)
220 if (i < hslicemin() || i > hslicemax())
223 "dmatrix& d4_array::operator() (int i, int j)",
224 hslicemin(), hslicemax(), i);
226 return ((*
this)(i))(
j);
233 dvector& d4_array::operator ( ) (
int i,
int j,
int k)
235 if (i < hslicemin() || i > hslicemax())
238 "dvector& d4_array::operator() (int i, int j, int k)",
239 hslicemin(), hslicemax(), i);
241 return (((*
this)(i,j))(k));
248 double& d4_array::operator ( ) (
int i,
int j,
int k,
int l)
250 if (i < hslicemin() || i > hslicemax())
253 "double& d4_array::operator() (int i, int j, int k, int l)",
254 hslicemin(), hslicemax(), i);
256 return ( ((*
this)(i,j,k))(l));
266 { cerr <<
"Error hslice index out of bounds in\n"
267 "d3_array& d4_array::operator ( )" <<
endl;
280 { cerr <<
"Error hslice index out of bounds in\n"
281 "d3_array& d4_array::operator ( )" <<
endl;
294 { cerr <<
"Error hslice index out of bounds in\n"
295 "dmatrix& d4_array::operator ( )" <<
endl;
298 return ((*
this)(i))(
j);
308 { cerr <<
"Error hslice index out of bounds in\n"
309 "dvector& d4_array::operator ( )" <<
endl;
312 return (((*
this)(i,j))(k));
322 { cerr <<
"Error hslice index out of bounds in\n"
323 "double& d4_array::operator ( )" <<
endl;
326 return ( ((*
this)(i,j,k))(l));
352 cerr <<
" Error: d4_array unable to allocate memory in "
353 << __FILE__ <<
':' << __LINE__ <<
'\n';
358 cerr <<
" Error: d4_array unable to allocate memory in "
359 << __FILE__ <<
':' << __LINE__ <<
'\n';
364 for (
int i = hsl; i <= hsu; ++i)
366 pti->
allocate(sl, sh, nrl, nrh, ncl, nch);
391 cerr <<
" Error: d4_array unable to allocate memory in "
392 << __FILE__ <<
':' << __LINE__ <<
'\n';
397 cerr <<
" Error: d4_array unable to allocate memory in "
398 << __FILE__ <<
':' << __LINE__ <<
'\n';
403 for (
int i = hsl; i <= hsu; ++i)
405 pti->
allocate(sl, sh, nrl, nrh, ncl, nch);
430 cerr <<
" Error: d4_array unable to allocate memory in "
431 << __FILE__ <<
':' << __LINE__ <<
'\n';
436 cerr <<
" Error: d4_array unable to allocate memory in "
437 << __FILE__ <<
':' << __LINE__ <<
'\n';
442 const int* pnrli = nrl.
get_v() + hsl;
443 const int* pnrhi = nrh.
get_v() + hsl;
444 const int* pncli = ncl.
get_v() + hsl;
445 const int* pnchi = nch.
get_v() + hsl;
446 for (
int i = hsl; i <= hsu; ++i)
448 pti->
allocate(sl, sh, *pnrli, *pnrhi, *pncli, *pnchi);
461 int nrl,
const imatrix& nrh,
int ncl,
int nch)
463 allocate(hsl,hsu,sl,sh,nrl,nrh,ncl,nch);
487 cerr <<
" Error: d4_array unable to allocate memory in "
488 << __FILE__ <<
':' << __LINE__ <<
'\n';
493 cerr <<
" Error: d4_array unable to allocate memory in "
494 << __FILE__ <<
':' << __LINE__ <<
'\n';
499 const int* pshi = sh.
get_v() + hsl;
500 const ivector* pnrhi = &nrh(hsl);
501 for (
int i = hsl; i <= hsu; ++i)
503 pti->
allocate(sl, *pshi, nrl, *pnrhi, ncl, nch);
515 int nrh,
int ncl,
int nch)
517 allocate(hsl,hsu,sl,sh,nrl,nrh,ncl,nch);
527 allocate(hsl,hsu,sl,sh,nrl,nrh,ncl,nch);
541 for (
int i = min; i <=
max; ++i)
556 allocate(hsl,hsu,sl,sh,nrl,nrh,ncl,nch);
571 cerr <<
" Error: d4_array unable to allocate memory in "
572 << __FILE__ <<
':' << __LINE__ <<
'\n';
577 cerr <<
" Error: d4_array unable to allocate memory in "
578 << __FILE__ <<
':' << __LINE__ <<
'\n';
583 const int* pshi = sh.
get_v() + hsl;
584 const ivector* pnrhi = &nrh(hsl);
585 const imatrix* pnchi = &nch(hsl);
586 for (
int i = hsl; i <= hsu; ++i)
588 pti->
allocate(sl, *pshi, nrl, *pnrhi, ncl, *pnchi);
604 allocate(hsl,hsu,sl,sh,nrl,nrh,ncl,nch);
627 static_cast<unsigned int>(hsu < hsl ? 0 : hsu - hsl + 1);
632 cerr <<
" Error: d4_array unable to allocate memory in "
633 << __FILE__ <<
':' << __LINE__ <<
'\n';
638 cerr <<
" Error: d4_array unable to allocate memory in "
639 << __FILE__ <<
':' << __LINE__ <<
'\n';
644 for (
int i=hsl; i<=hsu; i++)
654 pti->
allocate(aa,bb,rnrl,rnrh,rncl,rnch);
684 static_cast<unsigned int>(hsu < hsl ? 0 : hsu - hsl + 1);
689 cerr <<
" Error: d4_array unable to allocate memory in "
690 << __FILE__ <<
':' << __LINE__ <<
'\n';
694 cerr <<
" Error: d4_array unable to allocate memory in "
695 << __FILE__ <<
':' << __LINE__ <<
'\n';
699 for (
int i=hsl; i<=hsu; i++)
709 pti->
allocate(aa,bb,rnrl,rnrh,rncl,rnch);
736 static_cast<unsigned int>(hsu < hsl ? 0 : hsu - hsl + 1);
741 cerr <<
" Error: d4_array unable to allocate memory in "
742 << __FILE__ <<
':' << __LINE__ <<
'\n';
746 cerr <<
" Error: d4_array unable to allocate memory in "
747 << __FILE__ <<
':' << __LINE__ <<
'\n';
751 for (
int i = hsl; i <= hsu; ++i)
783 static_cast<unsigned int>(hsu < hsl ? 0 : hsu - hsl + 1);
788 cerr <<
" Error: d4_array unable to allocate memory in "
789 << __FILE__ <<
':' << __LINE__ <<
'\n';
794 cerr <<
" Error: d4_array unable to allocate memory in "
795 << __FILE__ <<
':' << __LINE__ <<
'\n';
800 for (
int i=hsl; i<=hsu; i++)
830 unsigned int size =
static_cast<unsigned int>(hsu - hsl + 1);
833 cerr <<
" Error: d4_array unable to allocate memory in "
834 << __FILE__ <<
':' << __LINE__ <<
'\n';
839 cerr <<
" Error: d4_array unable to allocate memory in "
840 << __FILE__ <<
':' << __LINE__ <<
'\n';
843 t -=
static_cast<int>(hsl);
845 for (
int i = hsl; i <= hsu; ++i)
Uses polymorphism to get index information from various data types to be used in constructing and all...
Description not yet available.
const d3_array & operator()(int i) const
int allocated(const ivector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Vector of double precision numbers.
void allocate(const ad_integer &sl, const ad_integer &sh, const index_type &nrl, const index_type &nrh, const index_type &ncl, const index_type &nch)
Allocate array of matrices with dimensions [sl to sh] x [nrl to nrh] x [ncl to nch].
void allocate(void)
Does not allocate, but initializes pointers to NULL.
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
four_array_shape(int hsl, int hsu)
Construct four_array_shape with initial values and setting min and max.
unsigned int hslicesize() const
void shallow_copy(const d4_array &)
Copies pointer locations from other to d4_array.
Description not yet available.
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
const d3_array & operator[](int i) const
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
friend class four_array_shape
#define ADMB_ARRAY_BOUNDS_ERROR(message, function, lower_bounds, upper_bounds, index)
void initialize()
Description not yet available.
void initialize(int sl, int sh, int nrl, const ivector &nrh, int ncl, const ivector &nch)
void deallocate(void)
Deallocates d4_array memory.
d4_array & operator=(const d4_array &)
Assigns element values from other to d4_array.
d4_array sub(int, int)
Description not yet available.
Description not yet available.
Description not yet available.
d4_array()
Default constructor.