ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a11.cpp
Go to the documentation of this file.
1 
9 #include "fvar.hpp"
10 
18 dvariable max(const dvar_vector& variables)
19 {
20  int mmin = variables.indexmin();
21  int mmax = variables.indexmax();
22  dvariable maximum = variables.elem(mmin);
23  for (int i = mmin + 1; i <= mmax; ++i)
24  {
25  if (maximum < variables.elem(i)) maximum = variables.elem(i);
26  }
27  return maximum;
28 }
36 dvariable min(const dvar_vector& variables)
37 {
38  int mmin = variables.indexmin();
39  int mmax = variables.indexmax();
40  dvariable minimum = variables.elem(mmin);
41  for (int i = mmin + 1; i <= mmax; ++i)
42  {
43  if (minimum > variables.elem(i)) minimum = variables.elem(i);
44  }
45  return minimum;
46 }
prevariable elem(int i)
Definition: fvar.hpp:2221
ADMB variable vector.
Definition: fvar.hpp:2172
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: fvar.hpp:2287
#define max(a, b)
Definition: cbivnorm.cpp:189
int indexmax() const
Definition: fvar.hpp:2292
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518