double F4::compute(double*x){ int i; double result = 0.0; if(Ovector == NULL) { Ovector = readOvector(); Pvector = readPermVector(); r25 = readR(25); r50 = readR(50); r100 = readR(100); s = readS(s_size); w = readW(s_size); } for(i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } // for (int i = 0; i < dimension; ++i) // { // cout<<anotherz[i]<<endl; // } // cout<<endl; // // T_{osz} // transform_osz(anotherz); // s_size non-separable part with rotation int c = 0; for (i = 0; i < s_size; i++) { // cout<<"c="<<c<<", i="<<i<<endl; anotherz1 = rotateVector(i, c); // cout<<"done rot"<<endl; result += w[i] * elliptic(anotherz1, s[i]); delete []anotherz1; // cout<<result<<endl; } // one separable part without rotation double* z = new double[dimension-c]; for (i = c; i < dimension; i++) { // cout<<i-c<<" "<<Pvector[i]<<" "<<anotherz[Pvector[i]]<<endl; z[i-c] = anotherz[Pvector[i]]; } // cout<<"sep\n"<<elliptic(z, dimension-c)<<endl; result += elliptic(z, dimension-c); delete[] z; // printf("Rotated Part = %1.16E\n", rot_elliptic(anotherz1,nonSeparableGroupSize) * 1e6); // printf("Separable Part = %1.16E\n", elliptic(anotherz2,dimension - nonSeparableGroupSize)); return(result); }
double F9::compute(vector<double> x) { int i,k; double result=0.0; if(Ovector==NULL) { Ovector=createShiftVector(dimension,minX,maxX); Pvector=createPermVector(dimension); RotMatrix=createRotMatrix1D(nonSeparableGroupSize); /* * print the multi rotated matrix printf("\n\n\n print the multi rotated matrix\n\n\n"); for (k = 0; k<dimension/(2*nonSeparableGroupSize); k++){ printf("\n matrix %d: \n", k+1); for (i = 0; i<nonSeparableGroupSize*nonSeparableGroupSize; i++){ printf("%1.20E\t", MultiRotMatrix1D[k][i]); } } */ } for(i=0; i<dimension; i++) { anotherz[i]=x[i]-Ovector[i]; } for(k=1; k<=dimension/(2*nonSeparableGroupSize); k++) { result+=rot_elliptic(anotherz,nonSeparableGroupSize,k); } // printf("Rotated Part = %1.20E\n", result); result+=elliptic(anotherz, dimension, 2); return(result); }
double F8::compute(double* x){ int i; double result=0.0; if(Ovector == NULL) { Ovector = readOvector(); Pvector = readPermVector(); r25 = readR(25); r50 = readR(50); r100 = readR(100); s = readS(s_size); w = readW(s_size); } for(i = 0; i < dimension; i++) { anotherz[i] = x[i] - Ovector[i]; } // s_size non-separable part with rotation int c = 0; for (i = 0; i < s_size; i++) { // cout<<"c="<<c<<", i="<<i<<endl; anotherz1 = rotateVector(i, c); // cout<<"done rot"<<endl; result += w[i] * elliptic(anotherz1, s[i]); delete []anotherz1; // cout<<result<<endl; } update(result); return(result); }
/* * Elliptic multiply: x := n * {x, 1} */ void elliptic_simple(giant x, giant n, curveParams *par) { giant ztmp = borrowGiant(par->maxDigits); giant cur_n = borrowGiant(par->maxDigits); START_ELL_MEASURE(n); int_to_giant(1, ztmp); elliptic(x, ztmp, n, par); binvg_cp(par, ztmp); mulg(ztmp, x); feemod(par, x); END_ELL_MEASURE; returnGiant(cur_n); returnGiant(ztmp); }
double F1::compute(double* x) { double result; int i; if(Ovector == NULL) { // Ovector = createShiftVector(dimension,minX,maxX); Ovector = readOvector(); } for(i = dimension - 1; i >= 0; i--) { anotherz[i] = x[i] - Ovector[i]; } // T_{OSZ} // transform_osz(anotherz,dimension); // result = elliptic(anotherz,dimension); result = elliptic(anotherz,dimension); return(result); }
double MyHCJob24::basic_func(int func_no, double *x,int length) { double result = 0.0; // This part is according to Matlab reference code switch(func_no) { case 0: result = weierstrass(x,length); break; case 1: result = EScafferF6(x,length); break; case 2: result = F8F2(x,length); break; case 3: result = ackley(x,length); break; case 4: result = rastrigin(x,length); break; case 5: result = griewank(x,length); break; case 6: result = EScafferF6NonCont(x,length); break; case 7: result = rastriginNonCont(x,length); break; case 8: result = elliptic(x,length); break; case 9: result = sphere_noise(x,length); break; default: puts("func_no is out of range."); exit(-1); } return (result); }