| 128 | } |
| 129 | } |
| 130 | bool get_started(void) |
| 131 | { // ok |
| 132 | bool ok = true; |
| 133 | // |
| 134 | // eps99 |
| 135 | double eps99 = 99.0 * std::numeric_limits<double>::epsilon(); |
| 136 | // |
| 137 | // nx, ax |
| 138 | size_t nx = 10; |
| 139 | ad_vector ax(nx); |
| 140 | for(size_t j = 0; j < nx; ++j) |
| 141 | ax[j] = 1.0; |
| 142 | CppAD::Independent(ax); |
| 143 | // |
| 144 | // fun |
| 145 | ad_vector ay(1); |
| 146 | ay[0] = ax[0]; |
| 147 | for(size_t j = 1; j < nx; ++j) |
| 148 | ay[0] *= ax[j]; |
| 149 | # if USE_DEFAULT_ADFUN_CONSTRUCTOR |
| 150 | CppAD::ADFun<double> fun; |
| 151 | fun.Dependent(ax, ay); |
| 152 | # else |
| 153 | // This allocates memory for first order Taylor coefficients using thread 0. |
| 154 | // An assert will occur at f.capacity_order(0) in run_one_thread when |
| 155 | // it is called by a different thread. |
| 156 | CppAD::ADFun<double> fun(ax, ay); |
| 157 | # endif |
| 158 | // |
| 159 | // num_threads, f_thread |
| 160 | size_t num_threads = 4; |
| 161 | fun_vector f_thread(num_threads); |
| 162 | for(size_t i = 0; i < num_threads; ++i) |
| 163 | f_thread[i] = fun; |
| 164 | // |
| 165 | // x |
| 166 | d_vector x(nx); |
| 167 | for(size_t j = 0; j < nx; ++j) |
| 168 | x[j] = 1.0 + 1.0 / double(j+1); |
| 169 | // |
| 170 | // Jac |
| 171 | d_vector Jac(nx); |
| 172 | // |
| 173 | // n_per_thread, n_extra |
| 174 | size_t n_per_thread = nx / num_threads; |
| 175 | size_t n_extra = nx % num_threads; |
| 176 | // |
| 177 | // thread_info_vec |
| 178 | thread_info_vector thread_info_vec(num_threads); |
| 179 | size_t j_begin = 0; |
| 180 | size_t j_end; |
| 181 | for(size_t thread_num = 0; thread_num < num_threads; ++thread_num) |
| 182 | { j_end = j_begin + n_per_thread; |
| 183 | if( thread_num < n_extra ) |
| 184 | ++j_end; |
| 185 | // |
| 186 | thread_info_vec[thread_num].thread_num = thread_num; |
| 187 | thread_info_vec[thread_num].f_ptr = &f_thread[thread_num]; |
nothing calls this directly
no test coverage detected