ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dsize.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 
17 unsigned int size_count(const dvector& x)
18 {
19  return x.size();
20 }
21 
26 int size_count_partial(const dvector& x, int n)
27 {
28  return n;
29 }
30 
35 unsigned int size_count(const dmatrix& x)
36 {
37  unsigned int count = 0;
38  int min = x.rowmin();
39  int max = x.rowmax();
40  const dvector* pxi = &x(min);
41  for (int i = min;i <= max; ++i)
42  {
43  count += size_count(*pxi);
44  ++pxi;
45  }
46  return count;
47 }
48 
53 int size_count_partial(const dmatrix& x, int n)
54 {
55  int tmp=0;
56  int min=x.rowmin();
57  int max=x.rowmax();
58  for (int i=min;i<=max;i++)
59  {
60  tmp+=size_count_partial(x(i),n);
61  }
62  return tmp;
63 }
64 
69 unsigned int size_count(const d3_array& x)
70 {
71  unsigned int count = 0;
72  int min = x.slicemin();
73  int max = x.slicemax();
74  const dmatrix* pxi = &x(min);
75  for (int i = min; i <= max; ++i)
76  {
77  count += size_count(*pxi);
78  ++pxi;
79  }
80  return count;
81 }
82 
87 int size_count_partial(const d3_array& x,int n)
88 {
89  int tmp=0;
90  int min=x.slicemin();
91  int max=x.slicemax();
92  for (int i=min;i<=max;i++)
93  {
94  tmp+=size_count_partial(x(i),n);
95  }
96  return tmp;
97 }
int size_count_partial(const dvector &x, int n)
Description not yet available.
Definition: dsize.cpp:26
#define x
Vector of double precision numbers.
Definition: dvector.h:50
int slicemax() const
Definition: fvar.hpp:3830
int rowmax() const
Definition: fvar.hpp:2929
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int slicemin() const
Definition: fvar.hpp:3826
Description not yet available.
Definition: fvar.hpp:2819
unsigned int size() const
Get number of elements in array.
Definition: dvector.h:209
unsigned int size_count(const dvector &x)
Returns total size of elements in vector x.
Definition: dsize.cpp:17
#define max(a, b)
Definition: cbivnorm.cpp:189
Description not yet available.
Definition: fvar.hpp:3727
int rowmin() const
Definition: fvar.hpp:2925