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 00019 dvector extract_diagonal(const dmatrix& m) 00020 { 00021 if ( (m.rowmin()!=m.colmin()) || (m.rowmax()!=m.colmax())) 00022 { 00023 cerr << "Error in extract_diagonal function " 00024 "-- input matrix not square" <<endl; 00025 ad_exit(1); 00026 } 00027 00028 dvector tmp(m.rowmin(),m.rowmax()); 00029 for (int i=m.rowmin(); i<=m.rowmax(); i++) 00030 { 00031 tmp.elem(i)=m.elem(i,i); 00032 } 00033 00034 return(tmp); 00035 }
Generated on Tue Mar 8 2016 19:51:32 for ADMB Documentation by 1.8.0 |