ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ivect10.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
12 int Max(const ivector& ivec)
13 {
14  return max(ivec);
15 }
21 int max(const ivector& ivec)
22 {
23  int min = ivec.indexmin();
24  int max = ivec.indexmax();
25  int maximum = ivec.elem(min);
26  for (int i = min + 1; i <= max; ++i)
27  {
28  if (maximum < ivec.elem(i)) maximum = ivec.elem(i);
29  }
30  return maximum;
31 }
37 int min(const ivector& ivec)
38 {
39  int min = ivec.indexmin();
40  int max = ivec.indexmax();
41  int minimum = ivec.elem(min);
42  for (int i = min + 1; i <= max; ++i)
43  {
44  if (minimum > ivec.elem(i)) minimum = ivec.elem(i);
45  }
46  return minimum;
47 }
int & elem(int i)
Definition: ivector.h:90
int Max(const ivector &t1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: ivect10.cpp:12
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
#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: ivector.h:99
int indexmax() const
Definition: ivector.h:104
#define max(a, b)
Definition: cbivnorm.cpp:189