ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmat14.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
12 double trace(const dmatrix& mat)
13 {
14  if (mat.colmin() != mat.rowmin() || mat.colmax() != mat.rowmax() )
15  {
16  cerr << "Matrix not square in trace\n";
17  ad_exit(1);
18  }
19 
20  double sum = 0.0;
21  for (int i = mat.colmin(); i <= mat.colmax(); ++i)
22  {
23  sum += mat.elem(i, i);
24  }
25  return sum;
26 }
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
exitptr ad_exit
Definition: gradstrc.cpp:53
int rowmax() const
Definition: fvar.hpp:2929
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int colmin(void) const
Definition: fvar.hpp:2939
Description not yet available.
Definition: fvar.hpp:2819
dvector & elem(int i)
Definition: fvar.hpp:3011
double trace(const dmatrix &mat)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat14.cpp:12
int rowmin() const
Definition: fvar.hpp:2925
int colmax(void) const
Definition: fvar.hpp:2943