/[escript]/trunk/paso/src/Functions.c
ViewVC logotype

Diff of /trunk/paso/src/Functions.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1797 by phornby, Tue Jul 15 05:24:14 2008 UTC revision 1798 by gross, Wed Sep 17 06:21:12 2008 UTC
# Line 20  Line 20 
20   * setoff is workspace   * setoff is workspace
21   */   */
22    
23  err_t Paso_FunctionDerivative(double* J0w, const double* w, Paso_Function* F, const double *f0, const double *x0, double* setoff)  err_t Paso_FunctionDerivative(double* J0w, const double* w, Paso_Function* F, const double *f0, const double *x0, double* setoff, const bool_t w_is_normalized)
24  {  {
25     err_t err=0;     err_t err=0;
26     dim_t n=F->n;     dim_t n=F->n;
27     double norm_w,epsnew,norm_x0;     double norm_w,epsnew,norm_x0;
28     epsnew=10.*sqrt(EPSILON);     epsnew=10.*sqrt(EPSILON);
29     norm_w=Paso_l2(n,w,F->mpi_info);     if (! w_is_normalized) {
30            norm_w=Paso_l2(n,w,F->mpi_info);
31       } else {
32            norm_w=1.;
33       }
34    
35     if (norm_w>0) {     if (norm_w>0) {
         Paso_zeroes(n,J0w);  
    } else {  
36         epsnew = epsnew/norm_w;         epsnew = epsnew/norm_w;
37         norm_x0=Paso_l2(n,x0,F->mpi_info);         norm_x0=Paso_l2(n,x0,F->mpi_info);
38         if (norm_x0>0) epsnew*=norm_x0;         if (norm_x0>0) epsnew*=norm_x0;
# Line 39  err_t Paso_FunctionDerivative(double* J0 Line 41  err_t Paso_FunctionDerivative(double* J0
41         if (err==NO_ERROR) {         if (err==NO_ERROR) {
42             Paso_Update(n,1./epsnew,J0w,-1./epsnew,f0); /* J0w = (J0w - f0)/epsnew; */             Paso_Update(n,1./epsnew,J0w,-1./epsnew,f0); /* J0w = (J0w - f0)/epsnew; */
43         }         }
44       } else {
45           Paso_zeroes(n,J0w);
46     }     }
47     return err;     return err;
48  }  }

Legend:
Removed from v.1797  
changed lines
  Added in v.1798

  ViewVC Help
Powered by ViewVC 1.1.26