ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect15.cpp
Go to the documentation of this file.
1 
5 #include <fvar.hpp>
6 #ifdef DEBUG
7  #include <cassert>
8  #include <climits>
9 #endif
10 
17 dvector operator&(const dvector& a, const dvector& b)
18 {
19 #ifdef DEBUG
20  assert(a.size() + b.size() <= INT_MAX);
21 #endif
22  dvector results(1, static_cast<int>(a.size() + b.size()));
23  int max = a.indexmax();
24  for (int i = a.indexmin(); i <= max; ++i)
25  {
26  results(i) = a(i);
27  }
28  int index = max;
29  max = b.indexmax();
30  for (int i = b.indexmin(); i <= max; ++i)
31  {
32  results(++index) = b(i);
33  }
34  return results;
35 }
43 {
44 #ifdef DEBUG
45  assert(a.size() + b.size() <= INT_MAX);
46 #endif
47 
48  dvar_vector results(1, static_cast<int>(a.size() + b.size()));
49  int max = a.indexmax();
50  for (int i = a.indexmin(); i <= max; ++i)
51  {
52  results(i) = a(i);
53  }
54  int index = max;
55  max = b.indexmax();
56  for (int i = a.indexmin(); i <= max; ++i)
57  {
58  results(++index) = b(i);
59  }
60  return results;
61 }
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
ADMB variable vector.
Definition: fvar.hpp:2172
unsigned int size() const
Definition: fvar.hpp:2297
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
unsigned int size() const
Get number of elements in array.
Definition: dvector.h:209
int indexmin() const
Definition: fvar.hpp:2287
#define max(a, b)
Definition: cbivnorm.cpp:189
dvector operator&(const dvector &a, const dvector &b)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dvect15.cpp:17
int indexmax() const
Definition: fvar.hpp:2292