Ejemplo n.º 1
0
double Bsmumu_untag(double C0b[], double C1b[], double C2b[], double complex CQ0b[], double complex CQ1b[], double Cpb[], double complex CQpb[], struct parameters* param, double mu_b)
/* computes the inclusive untagged branching ratio of Bs -> mu+ mu- */
{
	
	double alphas_mub=alphas_running(mu_b,param->mass_top_pole,param->mass_b_pole,param);
	double C10=C0b[10]+alphas_mub/4./pi*C1b[10]+alphas_mub*alphas_mub/16./pi/pi*C2b[10];
		
	double complex CQ1=CQ0b[1]+alphas_mub/4./pi*CQ1b[1];
	double complex CQ2=CQ0b[2]+alphas_mub/4./pi*CQ1b[2];
	double C10p=Cpb[10];
	double complex CQp1=CQpb[1];
	double complex CQp2=CQpb[2];
	
	double complex S=sqrt(1.-4.*param->mass_mu*param->mass_mu/param->m_Bs/param->m_Bs)*param->m_Bs*param->m_Bs/2./param->mass_mu/(param->mass_b_pole+param->mass_s)*(CQ1-CQp1);
	
	double complex P=(C10-C10p)+param->m_Bs*param->m_Bs/2./param->mass_mu/(param->mass_b_pole+param->mass_s)*(CQ2-CQp2);
	
	double phiS=carg(S);
	
	double phiP=carg(P);
	
	double ys=0.088;
	
	double A_Dgamma=(pow(cabs(P),2.)*cos(2.*phiP)-pow(cabs(S),2.)*cos(2.*phiS))/(pow(cabs(P),2.)+pow(cabs(S),2.));
	
	return (1.+A_Dgamma*ys)/(1.-ys*ys)*Bsmumu(C0b,C1b,C2b,CQ0b,CQ1b,Cpb,CQpb,param,mu_b);
}
Ejemplo n.º 2
0
// compute mean time offset.
// the instantaneous time offset is given by deltaPhi/(2*pi*f)
// this needs the initial dephasing at low frequencies to be small (i.e. 2*pi*deltaT < 0.1)
REAL8 meanTimeOffset(COMPLEX16FrequencySeries* hPlusTildeFD, COMPLEX16FrequencySeries* hCrossTildeFD, COMPLEX16* hPlusTildeTD, COMPLEX16* hCrossTildeTD, REAL8 Fplus, REAL8 Fcross, INT4 iStart, INT4 jStart, INT4 nSkip, INT4 nMax, REAL8 fMin, REAL8 deltaF)
{
    INT4 i, j;
    REAL8 out = 0.;
    REAL8 dPhi = 0.;
    REAL8 dPhiOld = 0.;
    REAL8 omega;
    COMPLEX16 htTD, htFD;
    for(i = iStart, j = jStart; j < nMax; i += nSkip, j++)
    {
        omega = LAL_TWOPI*(fMin + j*deltaF);
        htTD = Fplus*hPlusTildeTD[i] + Fcross*hCrossTildeTD[i];
        htFD = Fplus*hPlusTildeFD->data->data[j] + Fcross*hCrossTildeFD->data->data[j];
        dPhi = carg(htTD) - carg(htFD);
        while(dPhi - dPhiOld > LAL_PI)
        {
            dPhi -= LAL_TWOPI;
        }
        while(dPhi - dPhiOld < -LAL_PI)
        {
            dPhi += LAL_TWOPI;
        }
        dPhiOld = dPhi;
        out += dPhi/omega;
    }
    return out/(nMax-jStart);
}
Ejemplo n.º 3
0
int collision_projectile(Projectile *p) {
	if(p->type == FairyProj) {
		double angle = carg(global.plr.pos - p->pos) + p->angle;
		double projr = sqrt(pow(p->tex->w/4*cos(angle),2)*5/10.0 + pow(p->tex->h/2*sin(angle)*5/10.0,2));
		double grazer = max(p->tex->w, p->tex->h);
		double dst = cabs(global.plr.pos - p->pos);
		grazer = (0.9 * sqrt(grazer) + 0.1 * grazer) * 5;
		
		if(dst < projr + 1)
			return 1;
		
		if(!p->grazed && dst < grazer && global.frames - abs(global.plr.recovery) > 0) {
			p->grazed = True;
			player_graze(&global.plr, p->pos - grazer * 0.3 * cexp(I*carg(p->pos - global.plr.pos)), 10);
		}
	} else if(p->type >= PlrProj) {
		Enemy *e = global.enemies;
		while(e != NULL) {
			if(e->hp != ENEMY_IMMUNE && cabs(e->pos - p->pos) < 15) {
				global.points += 100;
				e->hp -= p->type - PlrProj;
				return 2;
			}
			e = e->next;
		}
		
		if(global.boss && cabs(global.boss->pos - p->pos) < 42
		&& global.boss->current->type != AT_Move && global.boss->current->type != AT_SurvivalSpell && global.boss->current->starttime < global.frames) {
			global.boss->dmg += p->type - PlrProj;
			return 2;
		}
	}
	return 0;
}
Ejemplo n.º 4
0
static void findroots(complex double a, complex double b, complex double c,
							complex double e[])
{
	int i;
	complex double p = (b - a * a / 3.) / 3.;
	complex double q = (2. * a * a * a / 27. - a * b / 3. + c) / 2.;
	complex double D = creal(p * p * p + q * q); /* MODEL SPECIFIC!!! */
	double eps;

	assert(abs(cimag(p)) < 1e-10);
	assert(abs(creal(q)) < 1e-10);
	assert(abs(cimag(p * p * p + q * q)) < 1e-10);

	complex double upr = -q + csqrt(D);
	double mod_upr = pow(cabs(upr), 1. / 3.);
	double arg_upr = carg(upr);
	complex double umr = -q - csqrt(D);
	double mod_umr = pow(cabs(umr), 1. / 3.);
	double arg_umr = carg(umr);

	complex double rp = .5 * (-1. + I * sqrt(3.));
	complex double rm = .5 * (-1. - I * sqrt(3.));
	complex double up = mod_upr * cexp(I * arg_upr / 3.);

	for (eps = 1e-30; eps < 1e-6; eps *= 10.) {
		complex double um[3];
		double sort[3];

		for (i = 0; i < 3; i++) {
			um[i] = mod_umr * cexp(I*(2. * M_PI * i + arg_umr) / 3.);
			sort[i] = cabs((um[i] * up + p) / p);
		}
		qsort(sort, 3, sizeof(*sort), cmp);

		for (i = 0; i < 3; i++) {
			double test = cabs((um[i] * up + p) / p);
			if (test == sort[0] && test < eps) {
				e[0] = up + um[i] - a / 3.;
				e[1] = rp * up + rm * um[i] - a / 3.;
				e[2] = rm * up + rp * um[i] - a / 3.;
				return;
			}
		}
	}
	fprintf(stderr, "This should never happen!\n");
	fprintf(stderr, "up=%lg%+lg*I p=%lg%+lg*I q=%lg%+lg*I D=%lg\n",
		creal(up), cimag(up), creal(p), cimag(p),
		creal(q), cimag(q), creal(D));
}
Ejemplo n.º 5
0
int collision_projectile(Projectile *p) {	
	if(p->type == FairyProj) {
		float angle = carg(global.plr.pos - p->pos) + p->angle;
		int projr = sqrt(pow(p->tex->w/4*cos(angle),2)*5/10.0 + pow(p->tex->h/2*sin(angle)*5/10.0,2));		
		
		if(cabs(global.plr.pos - p->pos) < projr + 1)
			return 1;
	} else if(p->type >= PlrProj) {
		Enemy *e = global.enemies;
		while(e != NULL) {
			if(e->hp != ENEMY_IMMUNE && cabs(e->pos - p->pos) < 15) {
				global.points += 100;
				e->hp -= p->type - PlrProj;
				return 2;
			}
			e = e->next;
		}
		
		if(global.boss && cabs(global.boss->pos - p->pos) < 15
		&& global.boss->current->type != AT_Move && global.boss->current->type != AT_SurvivalSpell && global.boss->current->starttime < global.frames) {
			global.boss->dmg += p->type - PlrProj;
			return 2;
		}
	}
	return 0;
}
Ejemplo n.º 6
0
static void draw_laser_beam(complex src, complex dst, double size, double step, double t, Texture *tex, Uniform *u_length) {
	complex dir = dst - src;
	complex center = (src + dst) * 0.5;

	r_mat_push();

	r_mat_translate(creal(center), cimag(center), 0);
	r_mat_rotate_deg(180/M_PI*carg(dir), 0, 0, 1);
	r_mat_scale(cabs(dir), size, 1);

	r_mat_mode(MM_TEXTURE);
	r_mat_identity();
	r_mat_translate(-cimag(src) / step + t, 0, 0);
	r_mat_scale(cabs(dir) / step, 1, 1);
	r_mat_mode(MM_MODELVIEW);

	r_uniform_sampler("tex", tex);
	r_uniform_float(u_length, cabs(dir) / step);
	r_draw_quad();

	r_mat_mode(MM_TEXTURE);
	r_mat_identity();
	r_mat_mode(MM_MODELVIEW);

	r_mat_pop();
}
Ejemplo n.º 7
0
//## Complex Complex.cargf();
static KMETHOD Complex_cargf(KonohaContext *kctx, KonohaStack *sfp)
{
	kComplex *kc = (kComplex *) sfp[0].asObject;
	float _Complex zf = (float _Complex)kc->z;
	float ret = carg(zf);
	KReturnFloatValue(ret);
}
Ejemplo n.º 8
0
//## Complex Complex.cargl();
static KMETHOD Complex_cargl(KonohaContext *kctx, KonohaStack *sfp)
{
	kComplex *kc = (kComplex *) sfp[0].asObject;
	long double _Complex zl = (long double _Complex)kc->z;
	long double ret = carg(zl);
	KReturnFloatValue(ret);
}
Ejemplo n.º 9
0
double complex cpow (double complex X, double complex Y)
{
  double complex Res;
  double i;
  double r = hypot (__real__ X, __imag__ X);
  if (r == 0.0)
    {
       __real__ Res = __imag__ Res = 0.0;
    }
  else
    {
      double rho;
      double theta;
      i = carg (X);
      theta = i * __real__ Y;
 
      if (__imag__ Y == 0.0)
	/* This gives slightly more accurate results in these cases. */
   	rho = pow (r, __real__ Y);
      else
	{
          r = log (r);
	  /* rearrangement of cexp(X * clog(Y)) */
	  theta += r * __imag__ Y;
	  rho = exp (r * __real__ Y - i * __imag__ Y);
	}

      __real__ Res = rho * cos (theta);
      __imag__ Res = rho * sin (theta);
    }
  return  Res;
}
Ejemplo n.º 10
0
void log_sweep(
    filter_fun filter, void *state,
    double f_min, double f_max, int steps, double exp
)
{
    printf(
        "%20s%20s%20s%20s%20s\n",
        "f", "re", "im", "abs", "phase"
    );

    double phase = 0;

    for (int i=0; i<steps; i++) {
        double f = f_min + pow((double)i/(steps-1), exp) * (f_max - f_min);
        complex double z = measure(filter, state, f);

        phase = unwrap(&phase, carg(z));

        printf("%20g%20g%20g%20g%20g\n", f,
            creal(z), cimag(z), cabs(z),  phase * 360 / M_TWOPI
        );
    }

    // data-set separator
    //
    printf("\n\n");
}
Ejemplo n.º 11
0
int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
	if(t < 0)
		return 1;
	p->angle = carg(p->args[0]);
	p->pos = p->pos0 + p->args[0]*t;
	
	return 1;
}
Ejemplo n.º 12
0
static float cfo_cp_estimate(srslte_sync_t *q, const cf_t *input)
{
  uint32_t cp_offset = 0; 
  cp_offset = srslte_cp_synch(&q->cp_synch, input, q->max_offset, q->cfo_cp_nsymbols, SRSLTE_CP_LEN_NORM(1,q->fft_size));
  cf_t cp_corr_max = srslte_cp_synch_corr_output(&q->cp_synch, cp_offset);
  float cfo = -carg(cp_corr_max) / M_PI / 2; 
  return cfo; 
}
Ejemplo n.º 13
0
double complex clog(double complex z)
{
	double r, phi;

	r = cabs(z);
	phi = carg(z);
	return CMPLX(log(r), phi);
}
Ejemplo n.º 14
0
double complex
clog10 (double complex z)
{
  double complex v;

  COMPLEX_ASSIGN (v, log10 (cabs (z)), carg (z));
  return v;
}
Ejemplo n.º 15
0
/* do measurements: load density, ploop, etc. and phases onto lattice */
void measure() {
   register int i,j,k, c, is_even;
   register site *s;
   int dx,dy,dz;	/* separation for correlated observables */
   int dir;		/* direction of separation */
   msg_tag *tag;
   register complex cc,dd;	/*scratch*/
   complex ztr, zcof, znum, zdet, TC, zd, density, zphase;
   complex p[4]; /* probabilities of n quarks at a site */
   complex np[4]; /* probabilities at neighbor site */
   complex pp[4][4]; /* joint probabilities of n here and m there */
   complex zplp, plp_even, plp_odd;
   Real locphase, phase;


   /* First make T (= timelike P-loop) from s->ploop_t 
      T stored in s->tempmat1
   */
   ploop_less_slice(nt-1,EVEN);
   ploop_less_slice(nt-1,ODD);

   phase = 0.;
   density = plp_even = plp_odd = cmplx(0.0, 0.0);
   for(j=0;j<4;j++){
	p[j]=cmplx(0.0,0.0);
	for(k=0;k<4;k++)pp[j][k]=cmplx(0.0,0.0);
   }
   FORALLSITES(i,s) {
      if(s->t != nt-1) continue;
      if( ((s->x+s->y+s->z)&0x1)==0 ) is_even=1; else is_even=0;
      mult_su3_nn(&(s->link[TUP]), &(s->ploop_t), &(s->tempmat1));

      zplp = trace_su3(&(s->tempmat1));
      if( is_even){CSUM(plp_even, zplp)}
      else        {CSUM(plp_odd, zplp)}

      ztr = trace_su3(&(s->tempmat1));
      CONJG(ztr, zcof);

      if(is_even){
        for(c=0; c<3; ++c) s->tempmat1.e[c][c].real += C;
        zdet = det_su3(&(s->tempmat1));
        znum = numer(C, ztr, zcof);
        CDIV(znum, zdet, zd);
        CSUM(density, zd);

        /* store n_quark probabilities at this site in lattice variable
	  qprob[], accumulate sum over lattice in p[] */
        cc= cmplx(C*C*C,0.0); CDIV(cc,zdet,s->qprob[0]); CSUM(p[0],s->qprob[0]);
        CMULREAL(ztr,C*C,cc); CDIV(cc,zdet,s->qprob[1]); CSUM(p[1],s->qprob[1]);
        CMULREAL(zcof,C,cc); CDIV(cc,zdet,s->qprob[2]); CSUM(p[2],s->qprob[2]);
        cc = cmplx(1.0,0.0); CDIV(cc,zdet,s->qprob[3]); CSUM(p[3],s->qprob[3]);
  
        locphase = carg(&zdet);
        phase += locphase;
      }

   }
Ejemplo n.º 16
0
complex las_sine_expanding(Laser *l, float t) {	// [0] = velocity; [1] = sine amplitude; [2] = sine frequency; [3] = sine phase
	if(t == EVENT_BIRTH) {
		l->shader = get_shader("laser_sine_expanding");
		return 0;
	}
	
	double s = (l->args[2] * t + l->args[3]);
	return l->pos + cexp(I * (carg(l->args[0]) + l->args[1] * sin(s))) * t * cabs(l->args[0]);
}
void test3(__complex__ double x, __complex__ double y, int i)
{
  if (carg(x) != atan2(__imag__ x, __real__ x))
    link_error ();

  if (ccos(x) != ccos(-x))
    link_error();

  if (ccos(ctan(x)) != ccos(ctan(-x)))
    link_error();

  if (ctan(x-y) != -ctan(y-x))
    link_error();

  if (ccos(x/y) != ccos(-x/y))
    link_error();

  if (ccos(x/y) != ccos(x/-y))
    link_error();

  if (ccos(x/ctan(y)) != ccos(-x/ctan(-y)))
    link_error();

  if (ccos(x*y) != ccos(-x*y))
    link_error();

  if (ccos(x*y) != ccos(x*-y))
    link_error();

  if (ccos(ctan(x)*y) != ccos(ctan(-x)*-y))
    link_error();

  if (ccos(ctan(x/y)) != ccos(-ctan(x/-y)))
    link_error();

  if (ccos(i ? x : y) != ccos(i ? -x : y))
    link_error();

  if (ccos(i ? x : y) != ccos(i ? x : -y))
    link_error();

  if (ccos(i ? x : ctan(y/x)) != ccos(i ? -x : -ctan(-y/x)))
    link_error();

  if (~x != -~-x)
    link_error();

  if (ccos(~x) != ccos(-~-x))
    link_error();

  if (ctan(~(x-y)) != -ctan(~(y-x)))
    link_error();

  if (ctan(~(x/y)) != -ctan(~(x/-y)))
    link_error();
}
Ejemplo n.º 18
0
int accelerated(Projectile *p, int t) {
	if(t < 0)
		return 1;
	p->angle = carg(p->args[0]);
	
	p->pos += p->args[0];
	p->args[0] += p->args[1];
	
	return 1;
}
Ejemplo n.º 19
0
int asymptotic(Projectile *p, int t) { // v = a[0]*(a[1] + 1); a[1] -> 0
	if(t < 0)
		return 1;
	p->angle = carg(p->args[0]);
	
	p->args[1] *= 0.8;
	p->pos += p->args[0]*(p->args[1] + 1);
	
	return 1;
}
int main(void)
{
	double complex z;
	
	z = 0.5  + I * (sqrt(3)/2);
	fprintf(stdout, "Z : \n");
	fprintf(stdout, "  Partie reelle     : %f\n", creal(z));
	fprintf(stdout, "  Partie imaginaire : %f\n", cimag(z));
	fprintf(stdout, "  Module            : %f\n", cabs(z));
	fprintf(stdout, "  Argument          : %f\n", carg(z));

	z = conj(z);		
	fprintf(stdout, "\nConjugue de Z : \n");
	fprintf(stdout, "  Partie reelle     : %f\n", creal(z));
	fprintf(stdout, "  Partie imaginaire : %f\n", cimag(z));
	fprintf(stdout, "  Module            : %f\n", cabs(z));
	fprintf(stdout, "  Argument          : %f\n", carg(z));

	return EXIT_SUCCESS;
}
Ejemplo n.º 21
0
int timeout_linear(Projectile *p, int t) {
	if(t >= creal(p->args[0]))
		return ACTION_DESTROY;
	if(t < 0)
		return 1;
	
	p->angle = carg(p->args[1]);
	p->pos = p->pos0 + p->args[1]*t;
	
	return 1;
}
Ejemplo n.º 22
0
int main(void)
{
  const char *filedir = "dirfile";
  const char *format = "dirfile/format";
  const char *data = "dirfile/data";
  const char *format_data = "data RAW COMPLEX128 1\n";
  double c[8];
#ifdef GD_NO_C99_API
  double data_data[100][2];
#else
  double complex data_data[100];
#endif
  int i, n, error, r = 0;
  DIRFILE *D;

  rmdirfile();
  mkdir(filedir, 0777);

  for (i = 0; i < 100; ++i) {
#ifdef GD_NO_C99_API
    const double v = i * 3.14159265358979323846 / 5.;
    data_data[i][0] = cos(v);
    data_data[i][1] = sin(v);
#else
    data_data[i] = cexp(_Complex_I * i * 3.14159265358979323846 / 5.);
#endif
  }

  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
  write(i, format_data, strlen(format_data));
  close(i);

  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
  write(i, data_data, 200 * sizeof(double));
  close(i);

  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
  n = gd_getdata(D, "data.a", 5, 0, 8, 0, GD_FLOAT64, &c);
  error = gd_error(D);

  gd_close(D);

  unlink(data);
  unlink(format);
  rmdir(filedir);

  CHECKI(error,0);
  CHECKI(n,8);
  for (i = 0; i < 8; ++i)
    CHECKFi(i,c[i],carg(data_data[5 + i]));

  return r;
}
Ejemplo n.º 23
0
static void
endvalues_edge(double * va, double * vb, double * dir,
        const cdouble * w, slong ia, slong ib, slong d)
{
    slong k;
    double a, b;
    cdouble ba = w[ib] - w[ia];

    *dir = carg(ba);
    a = b = (d - 1) * (*dir);
    
    for (k = 0; k < d; k++)
    {
        if (k == ia || k == ib)
            continue;
        a += carg((w[ia] - w[k]) / ba);
        b += carg((w[ib] - w[k]) / ba);
    }
    *va = a;
    *vb = b;
}
Ejemplo n.º 24
0
static int
do_test (void)
{
  check_return_ilogb ();
  check_return_lrint ();
  check_return_lround ();
  check_return_llrint ();
  check_return_llround ();

  printf ("%Zd\n", sizeof(carg (lx)));

  return errors != 0;
}
Ejemplo n.º 25
0
// Perform pitch adjustment on the given block of complex numbers..
void pitchadjust(complex double* in, complex double* out)
{
    // keep track of last rounds phases for each bin.
    // These persist accross calls to this function.
    static double inphases[N] = {0};
    static double outphases[N] = {0};

    bzero(out, sizeof(complex double) * N);

    int i;
    for (i = 0; i < N; i++) {
        double phase = carg(in[i]);
        double mag = cabs(in[i]);

        double dphase = phase - inphases[i];
        inphases[i] = phase;

        // Perform the adjustment
        // It's possible multiple different input bins could fall into the
        // same output bin, in which case we just use the last of those input
        // bins.
        int bin = i * PITCH_FACTOR;
        int nbin = (i+1) * PITCH_FACTOR;
        if (nbin != bin && bin >= 0 && bin < N) {
            double shifted = dphase * PITCH_FACTOR;
            outphases[bin] += shifted;
            out[bin] = cmplxmp(mag, outphases[bin]);
        }
    }
    printf("IN:\n");
    for (i = 0; i < N; i++) {
	printf("    ti?[%d] = cmplxmp(%f, tophase(%f));\n", i, cabs(in[i]), carg(in[i]));
    }
    printf("OUT:\n");
    for (i = 0; i < N; i++) {
	printf("    to?[%d] = cmplxmp(%f, tophase(%f));\n", i, cabs(out[i]), carg(out[i]));
    }
}
Ejemplo n.º 26
0
Archivo: pss.c Proyecto: srsLTE/srsLTE
/* Returns the CFO estimation given a PSS received sequence
 *
 * Source: An Efficient CFO Estimation Algorithm for the Downlink of 3GPP-LTE
 *       Feng Wang and Yu Zhu
 */
float srslte_pss_cfo_compute(srslte_pss_t* q, const cf_t *pss_recv) {
  cf_t y0, y1;

  const cf_t *pss_ptr = pss_recv;

  if (q->filter_pss_enable) {
    srslte_pss_filter(q, pss_recv, q->tmp_fft);
    pss_ptr = (const cf_t*) q->tmp_fft;
  }

  y0 = srslte_vec_dot_prod_ccc(q->pss_signal_time[q->N_id_2], pss_ptr, q->fft_size/2);
  y1 = srslte_vec_dot_prod_ccc(&q->pss_signal_time[q->N_id_2][q->fft_size/2], &pss_ptr[q->fft_size/2], q->fft_size/2);
  return carg(conjf(y0) * y1)/M_PI;
}
Ejemplo n.º 27
0
int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
	if(t == EVENT_DEATH) {
		return ACTION_ACK;
	}

	p->angle = carg(p->args[0]);

	if(t == EVENT_BIRTH) {
		return ACTION_ACK;
	}

	p->pos = p->pos0 + p->args[0]*t;

	return ACTION_NONE;
}
Ejemplo n.º 28
0
void
cmplx (double _Complex z)
{
  cabs (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 129 } */
  cacos (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 131 } */
  cacosh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 133 } */
  carg (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 135 } */
  casin (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 137 } */
  casinh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 139 } */
  catan (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 141 } */
  catanh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 143 } */
  ccos (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 145 } */
  ccosh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 147 } */
  cexp (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 149 } */
  cimag (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 151 } */
  clog (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 153 } */
  conj (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 155 } */
  cpow (z, z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 157 } */
  cproj (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 159 } */
  creal (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 161 } */
  csin (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 163 } */
  csinh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 165 } */
  csqrt (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 167 } */
  ctan (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 169 } */
  ctanh (z); /* { dg-warning "incompatible implicit" } */
  /* { dg-message "include ..complex.h.." "" { target *-*-* } 171 } */
}
Ejemplo n.º 29
0
int main()
{
	int ofs = 0;
	double sampbuf[(2*N+L)*2];
	
	/* Read in the initial payload. */
	read(0, sampbuf, N*2*sizeof(double));
	
	/* Then shift each one up by N+L. */
	while (read(0, sampbuf + (N*2), (N+L)*2*sizeof(double)) == ((N+L)*2*sizeof(double)))
	{
		int i;
		double complex samples[2*N+L];
		double max = -INFINITY;
		double epsilon;
		int argmax = 0;
		double rho = SNR / (SNR + 1.0);
		
		for (i = 0; i < (2*N+L); i++)
		{
			double complex phase;
			phase = 2.0i * M_PI * (double)OFSFRQ * ((double)(ofs+i) / FREQ);
			samples[i] = sampbuf[i*2] + sampbuf[i*2+1] * 1.0i;
			samples[i] *= cexp(phase);
		}
		
		for (i = 0; i < (2*N); i++)
		{
			double n = cabs(ml_gamma(samples, i)) - rho * ml_Phi(samples, i);
			if (n > max) {
				max = n;
				argmax = i;
			}
		}
		
		/* The generated result, epsilon, is not really what I
		 * expect; the number doesn't line up with my input
		 * expectations.  Hmm...  */
		epsilon = (-1.0 / (2.0 * M_PI)) * carg(ml_gamma(samples, argmax));
		
		printf("%d %d %lf %lf\n", ofs, argmax, epsilon, epsilon * FREQ / 2048.0);
		
		ofs += N+L;
		memmove(sampbuf, sampbuf + (N+L)*2, sizeof(double) * (N+L)*2);
	}
	
	return 0;
}
Ejemplo n.º 30
0
int asymptotic(Projectile *p, int t) { // v = a[0]*(a[1] + 1); a[1] -> 0
	if(t == EVENT_DEATH) {
		return ACTION_ACK;
	}

	p->angle = carg(p->args[0]);

	if(t == EVENT_BIRTH) {
		return ACTION_ACK;
	}

	p->args[1] *= 0.8;
	p->pos += p->args[0]*(p->args[1] + 1);

	return 1;
}