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 dvariable max(const dvar_vector& t1) 00020 { 00021 dvariable tmp; 00022 int mmin=t1.indexmin(); 00023 int mmax=t1.indexmax(); 00024 tmp=t1.elem(mmin); 00025 for (int i=mmin+1; i<=mmax; i++) 00026 { 00027 if (tmp<t1.elem(i)) tmp=t1.elem(i); 00028 } 00029 return(tmp); 00030 } 00031 00032 00039 dvariable min(const dvar_vector& t1) 00040 { 00041 dvariable tmp; 00042 int mmin=t1.indexmin(); 00043 int mmax=t1.indexmax(); 00044 tmp=t1.elem(mmin); 00045 for (int i=mmin+1; i<=mmax; i++) 00046 { 00047 if (tmp>t1.elem(i)) tmp=t1.elem(i); 00048 } 00049 return(tmp); 00050 }
Generated on Tue Mar 8 2016 19:51:33 for ADMB Documentation by 1.8.0 |