ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect8.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include "fvar.hpp"
12 
13 #ifndef OPT_LIB
14  #include <cassert>
15  #include <climits>
16 #endif
17 
23  {
24  allocate(u.indexmin(),u.indexmax());
25  for ( int i=indexmin(); i<=indexmax(); i++)
26  {
27  elem(i)=u.elem(i);
28  }
29  }
30 
37 {
38  allocate(u.indexmin(), u.indexmax());
39  for (int i=indexmin(); i <= indexmax(); i++)
40  {
41  elem(i) = static_cast<double>(u.elem(i));
42  }
43 }
44 
50  {
51  dvector tmp(u.indexmin(),u.indexmax());
52 
53  for ( int i=u.indexmin(); i<=u.indexmax(); i++)
54  {
55  tmp(i)=(*this)(u(i));
56  }
57  return tmp;
58  }
59 
65  {
66  dvector tmp(u.indexmin(),u.indexmax());
67 
68  for ( int i=u.indexmin(); i<=u.indexmax(); i++)
69  {
70 #ifdef OPT_LIB
71  tmp(i)=(*this)((int)u(i));
72 #else
73  const AD_LONG_INT ui = u(i);
74  assert(ui <= INT_MAX);
75  tmp(i)=(*this)((int)ui);
76 #endif
77  }
78  return tmp;
79  }
int & elem(int i)
Definition: ivector.h:90
dvector()
Construct a dvector without allocating memory.
Definition: dvector.cpp:378
double & elem(int i)
Definition: dvector.h:152
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
int indexmin() const
Definition: fvar.hpp:676
Description not yet available.
Definition: fvar.hpp:656
void allocate(void)
Allocate dvector without allocating memory.
Definition: dvector.cpp:495
int indexmax() const
Definition: fvar.hpp:681
AD_LONG_INT & elem(int i)
Definition: fvar.hpp:667
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: ivector.h:99
int indexmax() const
Definition: ivector.h:104
#define AD_LONG_INT
Definition: fvar.hpp:81
dvector operator()(int lb, int ub)
Get subvector.
Definition: dvector.h:108