Revision 1582 trunk/src/linad99/dvec_acc.cpp

dvec_acc.cpp (revision 1582)
8 8
 * \file
9 9
 * Description not yet available.
10 10
 */
11
//#undef OPT_LIB
12 11
#include "fvar.hpp"
13 12
#include "admb_messages.h"
14 13

  
15 14
#if !defined(OPT_LIB)
16

  
17 15
/**
18
 * Description not yet available.
19
 * \param
20
 */
21
 double& dvector::operator[] (int i)
22
 {
23
   #ifdef SAFE_ARRAYS
24
   if (i > indexmax())
25
   {
26
#if defined(USE_EXCEPTIONS)
27
     throw vector_range_exception(i,indexmin(),indexmax());
28
#else
29
     ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too high", "double& dvector::operator[] (int i)", indexmin(), indexmax(), i);
30
#endif
31
   }
32
   if (i < indexmin())
33
   {
34
#if defined(USE_EXCEPTIONS)
35
       throw vector_range_exception(i,indexmin(),indexmax());
36
#else
37
     ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too low", "double& dvector::operator[] (int i)", indexmin(), indexmax(), i);
38
#endif
39
   }
40
   #endif
41
   return(*(v+i));
42
 }
16
Returns a reference to the element at index __i__ in the array.
43 17

  
18
\param __i__ index
19
*/
20
double& dvector::operator[](int i)
21
{
22
#ifdef SAFE_ARRAYS
23
  if (i < index_min || index_max < i)
24
  {
25
  #if defined(USE_EXCEPTIONS)
26
    throw vector_range_exception(i,index_min,index_max);
27
  #else
28
    ADMB_ARRAY_BOUNDS_ERROR("invalid index for array", "double& dvector::operator[] (int i)", index_min, index_max, i);
29
  #endif
30
  }
31
#endif
32
  return *(v+i);
33
}
44 34
/**
45
 * Description not yet available.
46
 * \param
47
 */
48
 double& dvector::operator() (int i)
49
 {
50
   #ifdef SAFE_ARRAYS
51
   if (i > indexmax())
52
   {
53
     ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too high", "double& dvector::operator() (int i)", indexmin(), indexmax(), i);
54
   }
55
   if (i < indexmin())
56
   {
57
     ADMB_ARRAY_BOUNDS_ERROR("array bound exceeded -- index too low", "double& dvector::operator() (int i)", indexmin(), indexmax(), i);
58
   }
59
   #endif
60
   return(*(v+i));
61
 }
35
Returns a reference to the element at index __i__ in the array.
62 36

  
37
\param __i__ index
38
*/
39
double& dvector::operator()(int i)
40
{
41
#ifdef SAFE_ARRAYS
42
  if (i < index_min || index_max < i)
43
  {
44
  #if defined(USE_EXCEPTIONS)
45
    throw vector_range_exception(i,index_min,index_max);
46
  #else
47
    ADMB_ARRAY_BOUNDS_ERROR("invalid index for array", "double& dvector::operator[] (int i)", index_min, index_max, i);
48
  #endif
49
  }
50
#endif
51
  return *(v+i);
52
}
63 53
/**
64
 * Description not yet available.
65
 * \param
66
 */
67
 const double& dvector::operator[](int i) const
68
 {
69
   #ifdef SAFE_ARRAYS
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff