00001 /* 00002 * $Id: fvar_op8.cpp 542 2012-07-10 21:04:06Z johnoel $ 00003 * 00004 * Author: David Fournier 00005 * Copyright (c) 2008-2012 Regents of the University of California 00006 */ 00011 #include "fvar.hpp" 00012 00019 prevariable& cube(const prevariable& v1) 00020 { 00021 double x=value(v1); 00022 double x2=x*x; 00023 if (++gradient_structure::RETURN_PTR > gradient_structure::MAX_RETURN) gradient_structure::RETURN_PTR = gradient_structure::MIN_RETURN; 00024 gradient_structure::RETURN_PTR->v->x=x2*x; 00025 gradient_structure::GRAD_STACK1->set_gradient_stack(default_evaluation2, 00026 &(gradient_structure::RETURN_PTR->v->x), &(v1.v->x),3*x2 ); 00027 return(*gradient_structure::RETURN_PTR); 00028 } 00029 00036 prevariable& fourth(const prevariable& v1) 00037 { 00038 double x=value(v1); 00039 double x2=x*x; 00040 if (++gradient_structure::RETURN_PTR > gradient_structure::MAX_RETURN) gradient_structure::RETURN_PTR = gradient_structure::MIN_RETURN; 00041 gradient_structure::RETURN_PTR->v->x=x2*x2; 00042 gradient_structure::GRAD_STACK1->set_gradient_stack(default_evaluation2, 00043 &(gradient_structure::RETURN_PTR->v->x), &(v1.v->x),4*x2*x ); 00044 return(*gradient_structure::RETURN_PTR); 00045 }
|
|
Generated on Wed May 22 2013 13:57:38 for ADMB Documentation by 1.8.0
|