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 operator+(const dvar_vector& t1, const double x) 00018 { 00019 return x+t1; 00020 } 00021 00022 void DF_cdble_dv_add(void); 00023 00028 dvar_vector operator+(const double x, const dvar_vector& t1) 00029 { 00030 RETURN_ARRAYS_INCREMENT(); 00031 dvar_vector tmp(t1.indexmin(),t1.indexmax()); 00032 save_identifier_string("wctf"); 00033 for (int i=t1.indexmin(); i<=t1.indexmax(); i++) 00034 { 00035 tmp.elem_value(i)=t1.elem_value(i)+x; 00036 } 00037 tmp.save_dvar_vector_position(); 00038 t1.save_dvar_vector_position(); 00039 save_identifier_string("ddtu"); 00040 RETURN_ARRAYS_DECREMENT(); 00041 gradient_structure::GRAD_STACK1->set_gradient_stack(DF_cdble_dv_add); 00042 return(tmp); 00043 } 00044 00049 void DF_cdble_dv_add(void) 00050 { 00051 verify_identifier_string("ddtu"); 00052 dvar_vector_position t1_pos=restore_dvar_vector_position(); 00053 dvar_vector_position tmp_pos=restore_dvar_vector_position(); 00054 dvector dftmp=restore_dvar_vector_derivatives(tmp_pos); 00055 dvector dft1(t1_pos.indexmin(),t1_pos.indexmax()); 00056 verify_identifier_string("wctf"); 00057 for (int i=t1_pos.indexmax(); i>=t1_pos.indexmin(); i--) 00058 { 00059 // tmp.elem_value(i)=x+t1.elem_value(i); 00060 dft1(i)=dftmp(i); 00061 } 00062 dft1.save_dvector_derivatives(t1_pos); 00063 }
Generated on Tue Mar 8 2016 19:51:33 for ADMB Documentation by 1.8.0 |