00001 /* 00002 * $Id$ 00003 * 00004 * Author: David Fournier 00005 * Copyright (c) 2008-2012 Regents of the University of California 00006 */ 00011 #include "fvar.hpp" 00012 00017 dvar_vector diagonal(const dvar_matrix& m) 00018 { 00019 if (m.indexmin() != m.colmin() || m.indexmax() != m.colmax()) 00020 { 00021 cerr << "Error matrix not square in function diagonal" << endl; 00022 exit(21); 00023 } 00024 int mmin=m.indexmin(); 00025 int mmax=m.indexmax(); 00026 dvar_vector tmp(mmin,mmax); 00027 for (int i=mmin;i<=mmax;i++) 00028 tmp(i)=m(i,i); 00029 return tmp; 00030 }
Generated on Tue Mar 8 2016 19:51:33 for ADMB Documentation by 1.8.0 |