ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_ma2.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  {
21 
22  if (m1.colmin() != m2.colmin() || m1.colmax() != m2.colmax())
23  {
24  cerr << " Incompatible array bounds in "
25  "dvar_matrix operator+(const dvar_matrix& x, const dmatrix& m)\n";
26  ad_exit(21);
27  }
28 
29  kkludge_object kk;
30  dvar_matrix tmp(m1.rowmin(),m1.rowmax(),kk);
31 
32  for (int i=m1.rowmin(); i<=m1.rowmax(); i++)
33  {
34  tmp(i)=m1(i)+m2(i);
35  }
37  return(tmp);
38  }
39 
45  {
48 
49  if (m1.colmin() != m2.colmin() || m1.colmax() != m2.colmax())
50  {
51  cerr << " Incompatible array bounds in "
52  "dvar_matrix operator+(const dvar_matrix& x, const dvar_matrix& m)\n";
53  ad_exit(21);
54  }
55  kkludge_object kk;
56  dvar_matrix tmp(m1.rowmin(),m1.rowmax(),kk);
57  //dvar_matrix tmp;
58  //tmp.allocate(m1);
59 
60  for (int i=m1.rowmin(); i<=m1.rowmax(); i++)
61  {
62  tmp(i)=m1(i)+m2(i);
63  }
65  return(tmp);
66  }
67 
73  {
76 
77  if (m1.colmin() != m2.colmin() || m1.colmax() != m2.colmax())
78  {
79  cerr << " Incompatible array bounds in "
80  "dvar_matrix operator+(const dmatrix& x, const dvar_matrix& m)\n";
81  ad_exit(21);
82  }
83  kkludge_object kk;
84  dvar_matrix tmp(m1.rowmin(),m1.rowmax(),kk);
85 
86  for (int i=m1.rowmin(); i<=m1.rowmax(); i++)
87  {
88  tmp(i)=m1(i)+m2(i);
89  }
91  return(tmp);
92  }
int rowmax(void) const
Definition: fvar.hpp:2564
int colmin(void) const
Definition: fvar.hpp:2552
d3_array operator+(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements addition of a(i, j, k) + b(i, j, k).
Definition: d3arr2a.cpp:132
exitptr ad_exit
Definition: gradstrc.cpp:53
Null class to allow specialized function overloads.
Definition: fvar.hpp:469
int rowmax() const
Definition: fvar.hpp:2929
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
int colmin(void) const
Definition: fvar.hpp:2939
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
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
int rowmin() const
Definition: fvar.hpp:2925
int colmax(void) const
Definition: fvar.hpp:2943
int colmax(void) const
Definition: fvar.hpp:2556