ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m12.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  dvariable tmp;
20  tmp=0.0;
21  if (M.colmin()!=M.rowmin() || M.colmax()!=M.rowmax() )
22  {
23  cerr << " Matrix not square in trace\n";
24  ad_exit(1);
25  }
26  for (int i=M.colmin();i<=M.colmax();i++)
27  {
28  tmp+=M.elem(i,i);
29  }
30  return tmp;
31 }
int rowmax(void) const
Definition: fvar.hpp:2564
dvar_vector & elem(int i)
Definition: fvar.hpp:2507
int colmin(void) const
Definition: fvar.hpp:2552
exitptr ad_exit
Definition: gradstrc.cpp:53
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
#define M
Definition: rngen.cpp:57
int rowmin(void) const
Definition: fvar.hpp:2560
double trace(const dmatrix &mat)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat14.cpp:12
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518
int colmax(void) const
Definition: fvar.hpp:2556