ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmat31.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
12 dvector diagonal(const dmatrix& matrix)
13 {
14  if (matrix.indexmin() != matrix.colmin()
15  || matrix.indexmax() != matrix.colmax())
16  {
17  cerr << "Error: matrix should be square"
18  << "in diagonal(const dmatrix&)";
19  ad_exit(1);
20  }
21  int min = matrix.indexmin();
22  int max = matrix.indexmax();
23  dvector vector(min, max);
24  for (int i = min;i <= max; ++i)
25  {
26  vector(i) = matrix(i, i);
27  }
28  return vector;
29 }
dvector diagonal(const dmatrix &matrix)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat31.cpp:12
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Definition: fvar.hpp:2917
exitptr ad_exit
Definition: gradstrc.cpp:53
#define min(a, b)
Definition: cbivnorm.cpp:188
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
int indexmax() const
Definition: fvar.hpp:2921
#define max(a, b)
Definition: cbivnorm.cpp:189
int colmax(void) const
Definition: fvar.hpp:2943