MCPcopy Create free account
hub / github.com/avaneev/biteopt / calcWatson

Function calcWatson

tests/testfn.h:3326–3352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3324 0.0, &calcPermFunction02, &calcPermFunction02_p };
3325
3326static double calcWatson( const double* const x, const int N )
3327{
3328 double s = sqr(x[0]);
3329 int i;
3330
3331 for( i = 0; i < 30; i++ )
3332 {
3333 const double a = i/29.0;
3334 double s1 = 0.0;
3335 double s2 = 0.0;
3336 int j;
3337
3338 for( j = 0; j < 5; j++ )
3339 {
3340 s1 += (j+1)*pow(a,j)*x[j+1];
3341 }
3342
3343 for( j = 0; j < 6; j++ )
3344 {
3345 s2 += pow(a,j)*x[j];
3346 }
3347
3348 s += sqr(s1-sqr(s2)-1.0);
3349 }
3350
3351 return( s );
3352}
3353
3354static const CTestFn TestFnWatson = { "Watson", 6, -5.00, 5.0,
3355 0.0022876700536, &calcWatson, NULL };

Callers

nothing calls this directly

Calls 1

sqrFunction · 0.85

Tested by

no test coverage detected