void gwfft_weight_setup ( void *dd_data_arg, int zero_pad, double k, unsigned long b, unsigned long n, signed long c, unsigned long fftlen) { x86_FIX dd_data->gw__b = dd_real ((double) b); dd_data->gw__logb = log (dd_real ((double) b)); dd_data->gw__fftlen_inverse = dd_real (1.0) / dd_real ((double) fftlen); if (zero_pad) { dd_data->gw__num_b_per_word = dd_real ((double) (n + n)) * dd_data->gw__fftlen_inverse; dd_data->gw__c_is_one = TRUE; dd_data->gw__over_fftlen = dd_real (2.0) * dd_data->gw__fftlen_inverse; } else { dd_data->gw__num_b_per_word = (dd_real ((double) n) + log (dd_real (k)) / dd_data->gw__logb) * dd_data->gw__fftlen_inverse; dd_data->gw__c_is_one = (abs ((int) c) == 1); dd_data->gw__logb_abs_c_div_fftlen = log (dd_real (abs ((int) c))) / dd_data->gw__logb * dd_data->gw__fftlen_inverse; dd_data->gw__over_fftlen = dd_real (k * 2.0) * dd_data->gw__fftlen_inverse; } dd_data->gwdbl__b = (double) b; dd_data->gwdbl__b_inverse = 1.0 / (double) b; dd_data->gwdbl__num_b_per_word = (double) dd_data->gw__num_b_per_word; dd_data->gwdbl__logb_abs_c_div_fftlen = (double) dd_data->gw__logb_abs_c_div_fftlen; dd_data->last_inv_sloppy_j = 0; dd_data->last_inv_sloppy_result = 1.0; dd_data->fast_inv_sloppy_multiplier = gwfft_weight_inverse (dd_data, 1); dd_data->last_partial_sloppy_power[0] = dd_data->last_partial_sloppy_power[1] = 999.0; dd_data->last_partial_inv_sloppy_power[0] = dd_data->last_partial_inv_sloppy_power[1] = 999.0; END_x86_FIX }
void c_dd_div_dd_d(const double *a, double b, double *c) { dd_real cc; cc = dd_real(a) / b; TO_DOUBLE_PTR(cc, c); }
/* div */ void c_dd_div(const double *a, const double *b, double *c) { dd_real cc; cc = dd_real(a) / dd_real(b); TO_DOUBLE_PTR(cc, c); }
void c_dd_write(const double *a) { std::cout << dd_real(a).to_string(dd_real::_ndigits) << std::endl; }
void c_dd_swrite(const double *a, int precision, char *s, int len) { dd_real(a).write(s, len, precision); }
void c_dd_sincosh(const double *a, double *s, double *c) { dd_real ss, cc; sincosh(dd_real(a), ss, cc); TO_DOUBLE_PTR(ss, s); TO_DOUBLE_PTR(cc, c); }
void c_qd_sub_qd_dd(const double *a, const double *b, double *c) { qd_real cc; cc = qd_real(a) - dd_real(b); TO_DOUBLE_PTR(cc, c); }
void c_dd_cos(const double *a, double *b) { dd_real bb; bb = cos(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
void c_dd_floor(const double *a, double *b) { dd_real bb; bb = floor(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
void c_dd_log10(const double *a, double *b) { dd_real bb; bb = log10(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
void c_dd_nint(const double *a, double *b) { dd_real bb; bb = nint(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
void c_dd_nroot(const double *a, int n, double *b) { dd_real bb; bb = nroot(dd_real(a), n); TO_DOUBLE_PTR(bb, b); }
void c_qd_mul_dd_qd(const double *a, const double *b, double *c) { qd_real cc; cc = dd_real(a) * qd_real(b); TO_DOUBLE_PTR(cc, c); }
void c_dd_div_d_dd(double a, const double *b, double *c) { dd_real cc; cc = a / dd_real(b); TO_DOUBLE_PTR(cc, c); }
void c_dd_atan2(const double *a, const double *b, double *c) { dd_real cc; cc = atan2(dd_real(a), dd_real(b)); TO_DOUBLE_PTR(cc, c); }
dd_real gwceil (dd_real val) { return (dd_real (ceil (double (val)))); }
void c_dd_atanh(const double *a, double *b) { dd_real bb; bb = atanh(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
void gwasm_constants ( double *asm_values) { dd_real arg, sine1, cosine1, sine2, cosine2, sine3, cosine3; #define P951 asm_values[0] #define P618 asm_values[1] #define P309 asm_values[2] #define M262 asm_values[3] #define P588 asm_values[4] #define M162 asm_values[5] #define M809 asm_values[6] #define M382 asm_values[7] #define P866 asm_values[8] #define P433 asm_values[9] #define P577 asm_values[10] #define P975 asm_values[11] #define P445 asm_values[12] #define P180 asm_values[13] #define P623 asm_values[14] #define M358 asm_values[15] #define P404 asm_values[16] #define M223 asm_values[17] #define M901 asm_values[18] #define M691 asm_values[19] #define P924 asm_values[20] #define P383 asm_values[21] #define P782 asm_values[22] #define P434 asm_values[23] /* Do some initial setup */ x86_FIX /* Initialize the five_reals sine-cosine data. */ /* NOTE: When computing cosine / sine, divide by the 64-bit sine not the */ /* extra precision sine since macros will multiply by the 64-bit sine. */ arg = dd_real::_2pi / 5.0; // 2*PI * 1 / 5 sincos (arg, sine1, cosine1); arg = arg * 2.0; // 2*PI * 2 / 5 sincos (arg, sine2, cosine2); P951 = double (sine1); P618 = double (sine2 / P951); // 0.588 / 0.951 P309 = double (cosine1); M262 = double (cosine2 / P309); // -0.809 / 0.309 P588 = double (sine2); M162 = double (-sine1 / P588); // -0.951 / 0.588 M809 = double (cosine2); M382 = double (cosine1 / M809); // 0.309 / -0.809 /* Initialize the six_reals sine-cosine data. */ arg = dd_real::_2pi / 3.0; // 2*PI / 3 sine1 = sin (arg); // Compute sine (0.866) P866 = double (sine1); P433 = double (sine1 * 0.5); // 0.5 * P866 P577 = double (dd_real (0.5) / sine1); // 0.5 / 0.866 /* Initialize the seven_reals sine-cosine data. */ arg = dd_real::_2pi / 7.0; // 2*PI * 1 / 7 sincos (arg, sine1, cosine1); // cosine (0.623), sine (0.782) arg = arg * 2.0; // 2*PI * 2 / 7 sincos (arg, sine2, cosine2); // cosine (-.223), sine (0.975) arg = arg * 1.5; // 2*PI * 3 / 7 sincos (arg, sine3, cosine3); // cosine (-.901), sine (0.434) P975 = double (sine2); P445 = double (sine3 / P975); // 0.434 / 0.975 P180 = double (sine1 / P975 / P445); // 0.782 / (0.975 * 0.445) P623 = double (cosine1); M358 = double (cosine2 / P623); // -0.223 / 0.623 P404 = double (cosine3 / P623 / M358); // -.901 / (.623 * -.358) M223 = double (cosine2); M901 = double (cosine3); M691 = double (cosine1 / M901); // 0.623 / -0.901 P782 = double (sine1); P434 = double (sine3); /* Initialize the roots of -1 used by r4_four_complex_first_fft. */ arg = dd_real::_2pi / 16.0; // 2*PI / 16 sincos (arg, sine1, cosine1); // cosine (0.924), sine (0.383) P924 = double (cosine1); P383 = double (sine1); END_x86_FIX }
void c_qd_selfdiv_dd(const double *a, double *b) { qd_real bb(b); bb /= dd_real(a); TO_DOUBLE_PTR(bb, b); }