40 #ifndef SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_LZ6_H 41 #define SHARK_OBJECTIVEFUNCTIONS_BENCHMARK_LZ6_H 92 std::size_t counter1 = 0, counter2 = 0, counter3 = 0;
93 for( std::size_t i = 3; i <= x.size(); i++ ) {
94 if( (i-1) % 3 == 0 ) {
96 value[0] +=
sqr(x(i-1)-2*x( 1 )*::sin( 2 * M_PI * x( 0 ) + i*M_PI/x.size() ) );
97 }
else if( (i-2) % 3 == 0 ) {
99 value[1] +=
sqr(x(i-1)-2*x( 1 )*::sin( 2 * M_PI * x( 0 ) + i*M_PI/x.size() ) );
100 }
else if( i % 3 == 0 ) {
102 value[2] +=
sqr(x(i-1)-2*x( 1 )*::sin( 2 * M_PI * x( 0 ) + i*M_PI/x.size() ) );
106 value[0] *= counter1 > 0 ? 2./counter1 : 1;
107 value[1] *= counter2 > 0 ? 2./counter2 : 1;
108 value[2] *= counter3 > 0 ? 2./counter3 : 1;
110 value[0] += ::cos( 0.5*M_PI * x( 0 ) ) * ::cos( 0.5*M_PI * x( 1 ) );
111 value[1] += ::cos( 0.5*M_PI * x( 0 ) ) * ::sin( 0.5*M_PI * x( 1 ) );
112 value[2] += ::sin( 0.5*M_PI * x( 0 ) );