
Source-code of GOA in C++ 199
15.4 Source-code of GOA in C++
Listing 15.3 provides the C++ implementation of GOA technique. For the
linear algebra the Armadillo library was used [1]. It saves the user from the
additional time overhead needed to implement vectorized operations. It allows
us also to use automatic multi-threading.
1
2 double Dist , c , cMax , cMin , x j_xi ;
3 i n t i , i t e r , j , k , odd ;
4 mat X, X_new, X_temp, fit_X , r_ij_vec , s_ ij , sorted_X , temp ;
5 rowvec out_L , out_U ;
6 v ec S_i , S_i_total , sor t ed_fit_X , so rt ed _i n de x ;
7 i
8 f (UB. n_rows==1)
9 {
10 UB = arma : : ones<mat>(N, 1) ∗UB ;
11 LB = arma : : ones<mat>(N