ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m46.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  if (m.indexmin() != m.colmin() || m.indexmax() != m.colmax())
20  {
21  cerr << "Error matrix not square in function diagonal" << endl;
22  ad_exit(21);
23  }
24  int mmin=m.indexmin();
25  int mmax=m.indexmax();
26  dvar_vector tmp(mmin,mmax);
27  for (int i=mmin;i<=mmax;i++)
28  tmp(i)=m(i,i);
29  return tmp;
30 }
dvector diagonal(const dmatrix &matrix)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat31.cpp:12
int colmin(void) const
Definition: fvar.hpp:2552
exitptr ad_exit
Definition: gradstrc.cpp:53
ADMB variable vector.
Definition: fvar.hpp:2172
prnstream & endl(prnstream &)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmax(void) const
Definition: fvar.hpp:2572
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
int indexmin(void) const
Definition: fvar.hpp:2568
int colmax(void) const
Definition: fvar.hpp:2556