ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m11.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 
18 {
19  int min = rowmin();
20  int max = rowmax();
21 
22 #ifndef OPT_LIB
23  if (min != m1.rowmin() || max != m1.rowmax())
24  {
25  cerr << " Incompatible array bounds in "
26  "dvar_matrix& operator += (const dvar_vector&)\n";
27  ad_exit(21);
28  }
29 #endif
30 
31  dvar_vector* pmi = m + min;
32  const dvar_vector* pm1i = &m1(min);
33  for (int i = min; i <= max; ++i)
34  {
35  *pmi += *pm1i;
36 
37  ++pmi;
38  ++pm1i;
39  }
40  return *this;
41 }
42 
48 {
49  int min = rowmin();
50  int max = rowmax();
51 
52 #ifndef OPT_LIB
53  if (min != m1.rowmin() || max != m1.rowmax())
54  {
55  cerr << " Incompatible array bounds in "
56  "dvar_matrix& operator+=(const dvar_vector&)\n";
57  ad_exit(21);
58  }
59 #endif
60 
61  dvar_vector* pmi = m + min;
62  const dvector* pm1i = &m1(min);
63  for (int i = min; i <= max; ++i)
64  {
65  *pmi += *pm1i;
66 
67  ++pmi;
68  ++pm1i;
69  }
70  return *this;
71 }
72 
78 {
79  int min = rowmin();
80  int max = rowmax();
81 
82 #ifndef OPT_LIB
83  if (min != m1.rowmin() || max != m1.rowmax())
84  {
85  cerr << " Incompatible array bounds in "
86  "dvar_matrix& operator -= (const dvar_vector&)\n";
87  ad_exit(21);
88  }
89 #endif
90 
91  dvar_vector* pmi = m + min;
92  const dvar_vector* pm1i = &m1(min);
93  for (int i = min; i <= max; ++i)
94  {
95  *pmi -= *pm1i;
96 
97  ++pmi;
98  ++pm1i;
99  }
100  return *this;
101 }
102 
108 {
109  int min = rowmin();
110  int max = rowmax();
111 
112 #ifndef OPT_LIB
113  if (min != m1.rowmin() || max != m1.rowmax())
114  {
115  cerr << " Incompatible array bounds in "
116  "dvar_matrix& operator-=(const dvar_vector&)\n";
117  ad_exit(21);
118  }
119 #endif
120 
121  dvar_vector* pmi = m + min;
122  const dvector* pm1i = &m1(min);
123  for (int i = min; i <= max; ++i)
124  {
125  *pmi -= *pm1i;
126 
127  ++pmi;
128  ++pm1i;
129  }
130  return *this;
131 }
dvar_matrix & operator-=(const dvar_matrix &x)
Description not yet available.
Definition: fvar_m11.cpp:77
int rowmax(void) const
Definition: fvar.hpp:2564
Vector of double precision numbers.
Definition: dvector.h:50
exitptr ad_exit
Definition: gradstrc.cpp:53
ADMB variable vector.
Definition: fvar.hpp:2172
dvar_matrix & operator+=(const dvar_matrix &x)
Description not yet available.
Definition: fvar_m11.cpp:17
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 rowmin(void) const
Definition: fvar.hpp:2560
Description not yet available.
Definition: fvar.hpp:2819
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
#define max(a, b)
Definition: cbivnorm.cpp:189
int rowmin() const
Definition: fvar.hpp:2925
dvar_vector * m
Definition: fvar.hpp:2484