ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_a29.cpp
Go to the documentation of this file.
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 
00013 /*
00014 //  "template" for precompiled derivative code
00015  //   change XXX to function name and YYY to derivative function name
00016 void DF_dvXXX(void);
00017 dvar_vector XXX(const dvar_vector& v1)
00018 {
00019   //dvector cv1=value(v1);
00020   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00021   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00022   {
00023     vtmp.elem_value(i)=XXX(v1.elem_value(i));
00024   }
00025 
00026   save_identifier_string("ddd");
00027   v1.save_dvar_vector_value();
00028   v1.save_dvar_vector_position();
00029   vtmp.save_dvar_vector_position();
00030   save_identifier_string("eee");
00031   gradient_structure::GRAD_STACK1->
00032             set_gradient_stack(DF_dvXXX);
00033   return vtmp;
00034 }
00035 
00036 void DF_dvXXX(void)
00037 {
00038   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00039   verify_identifier_string("eee");
00040   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00041   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00042   dvar_vector_position v1pos=restore_dvar_vector_position();
00043   dvector v1=restore_dvar_vector_value(v1pos);
00044   verify_identifier_string("ddd");
00045   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00046   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00047   {
00048     //vtmp.elem(i)=sin(value(v1.elem(i))));
00049     dfv1(i)=dfvtmp(i)*YYY(v1.elem(i));
00050   }
00051   dfv1.save_dvector_derivatives(v1pos);
00052   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00053 }
00054 
00055 */
00056 
00057 
00058 void DF_dvsin(void);
00059 
00064 dvar_vector sin(const dvar_vector& v1)
00065 {
00066   //dvector cv1=value(v1);
00067   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00068   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00069   {
00070     vtmp.elem_value(i)=sin(v1.elem_value(i));
00071   }
00072 
00073   save_identifier_string("ddd");
00074   v1.save_dvar_vector_value();
00075   v1.save_dvar_vector_position();
00076   vtmp.save_dvar_vector_position();
00077   save_identifier_string("eee");
00078   gradient_structure::GRAD_STACK1->
00079             set_gradient_stack(DF_dvsin);
00080   return vtmp;
00081 }
00082 
00087 void DF_dvsin(void)
00088 {
00089   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00090   verify_identifier_string("eee");
00091   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00092   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00093   dvar_vector_position v1pos=restore_dvar_vector_position();
00094   dvector v1=restore_dvar_vector_value(v1pos);
00095   verify_identifier_string("ddd");
00096   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00097   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00098   {
00099     //vtmp.elem(i)=sin(value(v1.elem(i))));
00100     dfv1(i)=dfvtmp(i)*cos(v1.elem(i));
00101   }
00102   dfv1.save_dvector_derivatives(v1pos);
00103   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00104 }
00105 
00106 void DF_dvexp(void);
00107 
00112 dvar_vector exp(const dvar_vector& v1)
00113 {
00114   //dvector cv1=value(v1);
00115   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00116   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00117   {
00118     vtmp.elem_value(i)=exp(v1.elem_value(i));
00119   }
00120 
00121   save_identifier_string("ddd");
00122   v1.save_dvar_vector_position();
00123   vtmp.save_dvar_vector_value();
00124   vtmp.save_dvar_vector_position();
00125   save_identifier_string("hee");
00126   gradient_structure::GRAD_STACK1->
00127             set_gradient_stack(DF_dvexp);
00128   return vtmp;
00129 }
00130 
00135 void DF_dvexp(void)
00136 {
00137   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00138   verify_identifier_string("hee");
00139   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00140   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00141   dvector vtmp=restore_dvar_vector_value(tmp_pos);
00142   dvar_vector_position v1pos=restore_dvar_vector_position();
00143   verify_identifier_string("ddd");
00144   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00145   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00146   {
00147     //vtmp.elem(i)=sin(value(v1.elem(i))));
00148     dfv1(i)=dfvtmp(i)*vtmp.elem(i);
00149   }
00150   dfv1.save_dvector_derivatives(v1pos);
00151   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00152 }
00153 
00154 
00155 void DF_dvcos(void);
00156 
00161 dvar_vector cos(const dvar_vector& v1)
00162 {
00163   //dvector cv1=value(v1);
00164   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00165   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00166   {
00167     vtmp.elem_value(i)=cos(v1.elem_value(i));
00168   }
00169 
00170   save_identifier_string("ddd");
00171   v1.save_dvar_vector_value();
00172   v1.save_dvar_vector_position();
00173   vtmp.save_dvar_vector_position();
00174   save_identifier_string("cee");
00175   gradient_structure::GRAD_STACK1->
00176             set_gradient_stack(DF_dvcos);
00177   return vtmp;
00178 }
00179 
00184 void DF_dvcos(void)
00185 {
00186   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00187   verify_identifier_string("cee");
00188   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00189   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00190   dvar_vector_position v1pos=restore_dvar_vector_position();
00191   dvector v1=restore_dvar_vector_value(v1pos);
00192   verify_identifier_string("ddd");
00193   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00194   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00195   {
00196     //vtmp.elem(i)=sin(value(v1.elem(i))));
00197     dfv1(i)=-dfvtmp(i)*sin(v1.elem(i));
00198   }
00199   dfv1.save_dvector_derivatives(v1pos);
00200   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00201 }
00202 
00203 void DF_dvlog(void);
00204 
00209 dvar_vector log(const dvar_vector& v1)
00210 {
00211   //dvector cv1=value(v1);
00212   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00213   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00214   {
00215     vtmp.elem_value(i)=log(v1.elem_value(i));
00216   }
00217 
00218   save_identifier_string("cdd");
00219   v1.save_dvar_vector_value();
00220   v1.save_dvar_vector_position();
00221   vtmp.save_dvar_vector_position();
00222   save_identifier_string("eee");
00223   gradient_structure::GRAD_STACK1->
00224             set_gradient_stack(DF_dvlog);
00225   return vtmp;
00226 }
00227 
00228 int ad_debug_arithmetic=1;
00229 
00234 void DF_dvlog(void)
00235 {
00236   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00237   verify_identifier_string("eee");
00238   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00239   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00240   dvar_vector_position v1pos=restore_dvar_vector_position();
00241   dvector v1=restore_dvar_vector_value(v1pos);
00242   verify_identifier_string("cdd");
00243   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00244   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00245   {
00246 #    ifndef OPT_LIB
00247      if (ad_debug_arithmetic==1)
00248       if (v1.elem(i)==0.0 || fabs(v1.elem(i))<1.e-150 ||
00249         dfvtmp(i) > 1.e+150)
00250       {
00251         cerr << "Possible overflow in DF_dvlog" << endl;
00252       }
00253 #    endif
00254     dfv1(i)=dfvtmp(i)/(v1.elem(i));
00255   }
00256   dfv1.save_dvector_derivatives(v1pos);
00257   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00258 }
00259 
00260 void DF_dvtan(void);
00261 
00266 dvar_vector tan(const dvar_vector& v1)
00267 {
00268   //dvector cv1=value(v1);
00269   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00270   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00271   {
00272     vtmp.elem_value(i)=tan(v1.elem_value(i));
00273   }
00274 
00275   save_identifier_string("ddd");
00276   v1.save_dvar_vector_value();
00277   v1.save_dvar_vector_position();
00278   vtmp.save_dvar_vector_position();
00279   save_identifier_string("xee");
00280   gradient_structure::GRAD_STACK1->
00281             set_gradient_stack(DF_dvtan);
00282   return vtmp;
00283 }
00284 
00289 void DF_dvtan(void)
00290 {
00291   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00292   verify_identifier_string("xee");
00293   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00294   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00295   dvar_vector_position v1pos=restore_dvar_vector_position();
00296   dvector v1=restore_dvar_vector_value(v1pos);
00297   verify_identifier_string("ddd");
00298   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00299   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00300   {
00301     //vtmp.elem(i)=tan(value(v1.elem(i))));
00302     dfv1(i)=dfvtmp(i)/pow(cos(v1.elem(i)),2);
00303   }
00304   dfv1.save_dvector_derivatives(v1pos);
00305   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00306 }
00307 
00308 void DF_dvatan(void);
00309 
00314 dvar_vector atan(const dvar_vector& v1)
00315 {
00316   //dvector cv1=value(v1);
00317   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00318   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00319   {
00320     vtmp.elem_value(i)=atan(v1.elem_value(i));
00321   }
00322 
00323   save_identifier_string("udd");
00324   v1.save_dvar_vector_value();
00325   v1.save_dvar_vector_position();
00326   vtmp.save_dvar_vector_position();
00327   save_identifier_string("eee");
00328   gradient_structure::GRAD_STACK1->
00329             set_gradient_stack(DF_dvatan);
00330   return vtmp;
00331 }
00332 
00337 void DF_dvatan(void)
00338 {
00339   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00340   verify_identifier_string("eee");
00341   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00342   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00343   dvar_vector_position v1pos=restore_dvar_vector_position();
00344   dvector v1=restore_dvar_vector_value(v1pos);
00345   verify_identifier_string("udd");
00346   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00347   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00348   {
00349     //vtmp.elem(i)=sin(value(v1.elem(i))));
00350     dfv1(i)=dfvtmp(i)/(1.+pow(v1.elem(i),2));
00351   }
00352   dfv1.save_dvector_derivatives(v1pos);
00353   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00354 }
00355 
00356 void DF_dvsqrt(void);
00357 
00362 dvar_vector sqrt(const dvar_vector& v1)
00363 {
00364   //dvector cv1=value(v1);
00365   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00366   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00367   {
00368     vtmp.elem_value(i)=sqrt(v1.elem_value(i));
00369   }
00370 
00371   save_identifier_string("ddd");
00372   v1.save_dvar_vector_value();
00373   v1.save_dvar_vector_position();
00374   vtmp.save_dvar_vector_position();
00375   save_identifier_string("eve");
00376   gradient_structure::GRAD_STACK1->
00377             set_gradient_stack(DF_dvsqrt);
00378   return vtmp;
00379 }
00380 
00385 dvar_vector sqr(const dvar_vector& v1)
00386 {
00387   //dvector cv1=value(v1);
00388   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00389   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00390   {
00391     vtmp.elem_value(i)=sqrt(v1.elem_value(i));
00392   }
00393 
00394   save_identifier_string("ddd");
00395   v1.save_dvar_vector_value();
00396   v1.save_dvar_vector_position();
00397   vtmp.save_dvar_vector_position();
00398   save_identifier_string("eve");
00399   gradient_structure::GRAD_STACK1->
00400             set_gradient_stack(DF_dvsqrt);
00401   return vtmp;
00402 }
00403 
00408 void DF_dvsqrt(void)
00409 {
00410   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00411   verify_identifier_string("eve");
00412   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00413   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00414   dvar_vector_position v1pos=restore_dvar_vector_position();
00415   dvector v1=restore_dvar_vector_value(v1pos);
00416   verify_identifier_string("ddd");
00417   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00418   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00419   {
00420     //vtmp.elem(i)=sin(value(v1.elem(i))));
00421     dfv1(i)=dfvtmp(i)/(2*sqrt(v1.elem(i)));
00422   }
00423   dfv1.save_dvector_derivatives(v1pos);
00424   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00425 }
00426 
00427 void DF_dvpow(void);
00428 
00433 dvar_vector pow(const dvar_vector& v1, const double e)
00434 {
00435   //dvector cv1=value(v1);
00436   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00437   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00438   {
00439     vtmp.elem_value(i)=pow(v1.elem_value(i),e);
00440   }
00441 
00442   save_identifier_string("ddf");
00443   v1.save_dvar_vector_value();
00444   save_double_value(e);
00445   v1.save_dvar_vector_position();
00446   vtmp.save_dvar_vector_position();
00447   save_identifier_string("eef");
00448   gradient_structure::GRAD_STACK1->
00449             set_gradient_stack(DF_dvpow);
00450   return vtmp;
00451 }
00452 
00457 void DF_dvpow(void)
00458 {
00459   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00460   verify_identifier_string("eef");
00461   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00462   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00463   dvar_vector_position v1pos=restore_dvar_vector_position();
00464   double e=restore_double_value();
00465   dvector v1=restore_dvar_vector_value(v1pos);
00466   verify_identifier_string("ddf");
00467   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00468   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00469   {
00470     //vtmp.elem(i)=sin(value(v1.elem(i))));
00471     dfv1(i)=dfvtmp(i)*e*pow(v1.elem(i),e-1);
00472   }
00473   dfv1.save_dvector_derivatives(v1pos);
00474   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00475 }
00476 
00477 
00478 //  Don't have the functions for savinf and restoring
00479 //    prevariables as yet
00480 
00481 void DF_dvdvpow(void);
00482 
00487 dvar_vector pow(const dvar_vector& v1, const prevariable& e)
00488 {
00489   //dvector cv1=value(v1);
00490   double ce=value(e);
00491   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00492   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00493   {
00494     vtmp.elem_value(i)=pow(v1.elem_value(i),ce);
00495   }
00496 
00497   save_identifier_string("ddg");
00498   e.save_prevariable_value();
00499   e.save_prevariable_position();
00500   v1.save_dvar_vector_value();
00501   v1.save_dvar_vector_position();
00502   vtmp.save_dvar_vector_position();
00503   save_identifier_string("eeg");
00504   gradient_structure::GRAD_STACK1->
00505             set_gradient_stack(DF_dvdvpow);
00506   return vtmp;
00507 }
00508 
00513 void DF_dvdvpow(void)
00514 {
00515   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00516 
00517   verify_identifier_string("eeg");
00518   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00519   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00520   dvar_vector_position v1pos=restore_dvar_vector_position();
00521   dvector v1=restore_dvar_vector_value(v1pos);
00522   prevariable_position epos=restore_prevariable_position();
00523   double e=restore_prevariable_value();
00524   verify_identifier_string("ddg");
00525   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00526   double dfe=0.;
00527   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00528   {
00529     double tmp=pow(v1.elem(i),e-1);
00530     //vtmp.elem(i)=pow(value(v1.elem(i)),e);
00531     dfv1(i)=dfvtmp(i)*e*tmp;
00532     dfe+=dfvtmp(i)*v1.elem(i)*tmp*log(v1.elem(i));
00533   }
00534   dfv1.save_dvector_derivatives(v1pos);
00535   save_double_derivative(dfe,epos);
00536   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00537 }
00538 
00539 void DF_dvcpow(void);
00540 
00545 dvar_vector pow(const dvar_vector& v1,int e)
00546 {
00547   //dvector cv1=value(v1);
00548   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00549   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00550   {
00551     vtmp.elem_value(i)=pow(v1.elem_value(i),e);
00552   }
00553 
00554   save_identifier_string("ddf");
00555   v1.save_dvar_vector_value();
00556   save_double_value(double(e));
00557   v1.save_dvar_vector_position();
00558   vtmp.save_dvar_vector_position();
00559   save_identifier_string("eef");
00560   gradient_structure::GRAD_STACK1->
00561             set_gradient_stack(DF_dvcpow);
00562   return vtmp;
00563 }
00564 
00569 void DF_dvcpow(void)
00570 {
00571   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00572   verify_identifier_string("eef");
00573   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00574   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00575   dvar_vector_position v1pos=restore_dvar_vector_position();
00576   double e=restore_double_value();
00577   dvector v1=restore_dvar_vector_value(v1pos);
00578   verify_identifier_string("ddf");
00579   dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00580   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00581   {
00582     //vtmp.elem(i)=sin(value(v1.elem(i))));
00583     dfv1(i)=dfvtmp(i)*e*pow(v1.elem(i),e-1);
00584   }
00585   dfv1.save_dvector_derivatives(v1pos);
00586   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00587 }
00588 
00589 void DF_cdvpow(void);
00590 
00595 dvar_vector pow(const dvector& v1,const prevariable& e)
00596 {
00597   //dvector cv1=value(v1);
00598   double ce=value(e);
00599   dvar_vector vtmp(v1.indexmin(),v1.indexmax());
00600   for (int i=v1.indexmin();i<=v1.indexmax();i++)
00601   {
00602     vtmp.elem_value(i)=pow(v1.elem(i),ce);
00603   }
00604 
00605   save_identifier_string("eddg");
00606   e.save_prevariable_value();
00607   e.save_prevariable_position();
00608   v1.save_dvector_value();
00609   v1.save_dvector_position();
00610   vtmp.save_dvar_vector_position();
00611   save_identifier_string("feeg");
00612   gradient_structure::GRAD_STACK1->
00613             set_gradient_stack(DF_cdvpow);
00614   return vtmp;
00615 }
00616 
00621 void DF_cdvpow(void)
00622 {
00623   // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00624 
00625   verify_identifier_string("feeg");
00626   dvar_vector_position tmp_pos=restore_dvar_vector_position();
00627   dvector dfvtmp=restore_dvar_vector_derivatives(tmp_pos);
00628   dvector_position v1pos=restore_dvector_position();
00629   dvector v1=restore_dvector_value(v1pos);
00630   prevariable_position epos=restore_prevariable_position();
00631   double e=restore_prevariable_value();
00632   verify_identifier_string("eddg");
00633   //dvector dfv1(dfvtmp.indexmin(),dfvtmp.indexmax());
00634   double dfe=0.;
00635   for (int i=dfvtmp.indexmin();i<=dfvtmp.indexmax();i++)
00636   {
00637     double tmp=pow(v1.elem(i),e);
00638     //vtmp.elem(i)=pow(value(v1.elem(i)),e);
00639     //dfv1(i)=dfvtmp(i)*e*tmp;
00640     dfe+=dfvtmp(i)*tmp*log(v1.elem(i));
00641   }
00642   //dfv1.save_dvector_derivatives(v1pos);
00643   save_double_derivative(dfe,epos);
00644   //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
00645 }
00646 dvar_vector pow(const dvector& x,const dvar_vector& a)
00647 {
00648   RETURN_ARRAYS_INCREMENT();
00649 
00650   dvar_vector y(x.indexmin(), x.indexmax());
00651   for(int i=x.indexmin(); i<=x.indexmax(); i++)
00652   {
00653     y(i)=pow(x(i),a(i));
00654   }
00655 
00656   RETURN_ARRAYS_DECREMENT();
00657 
00658   return(y);
00659 }