Beispiel #1
0
lie_Index searchterm(poly* p, entry* t)
{ lie_Index l=0, u, len=p->ncols; entry** expon;
  cmpfn_tp cmp=set_ordering(cmpfn,len,defaultgrp);
  if (!issorted(p)) { p=Reduce_pol(p); }
  u=p->nrows; expon=p->elm;
  while (u-l>1)
  { lie_Index m=(u+l)/2; cmp_tp c=(*cmp)(expon[m],t,len);
    if (c<0) u=m;  else if (c>0) l=m+1;  else return m;
  }
  return  l<u && eqrow(expon[l],t,len) ? l : -1;
}
Beispiel #2
0
void Precision_Scan(double (*P_To_Verify)(int, int, double, double, double, int), int order, double Precision)
{
	double YerhoE_max = 40;
	double a_max = Y_to_a * YerhoE_max;
	double LE_max = 2500;
	int N_Steps = 10;
	std::ofstream out_file("data/Precision_Scan.txt", std::fstream::app);

	std::string flavor_names[3] = {"e ", "mu", "tau"};
	int N_Total, N_Passed;
	double P_Tilde, P_Exact;

	for (int alpha = 0; alpha <= 1; alpha++)
	{
		for (int beta = 0; beta <= alpha; beta++)
		{
			N_Total = 0;
			N_Passed = 0;
			Progress_Bar Pbar;
			for (double a = -a_max; a <= a_max; a += 2 * a_max / N_Steps)
			{
				for (double LE = -LE_max; LE <= LE_max; LE += 2 * LE_max / N_Steps)
				{
					for (double delta = 0; delta <= 2 * M_PI; delta += 2 * M_PI / N_Steps)
					{
						for (int ord = 0; ord <= 1; ord++)
						{
							set_ordering(ord == 0);
							P_Tilde = P_To_Verify(alpha, beta, a, LE, delta, order);
							P_Exact = Exact::Palphabeta(alpha, beta, a, LE, delta);
							N_Total++;
							if (is_accurate(P_Tilde, P_Exact, Precision))
								N_Passed++;
						} // ord
					} // delta
				} // LE
				Pbar.update(-a_max, a_max, a, true);
			} // a
			out_file << flavor_names[alpha] << " -> " << flavor_names[beta] << ": ";
			out_file << std::setprecision(3) << std::setw(5) << (double)N_Passed / N_Total;
			out_file << " passed, ord = " << order << ", prec = " << Precision << std::endl;
		} // beta
	} // alpha
	out_file << std::setfill('=') << std::setw(60) << "=" << std::setfill(' ') << std::endl;
	out_file.close();
}
Beispiel #3
0
local void heap_sort_p(poly* p, cmpfn_tp criterion)
{ lie_Index i=p->nrows; entry** a=p->elm; bigint** coef=p->coef; if (i<2) return;
  compare=set_ordering(criterion,p->ncols,defaultgrp); build_heap_p(p);
  while (swap_terms(a,coef,0,--i),i>1) heapify_p(p,1,i);
}
Beispiel #4
0
local void heap_sort_m(matrix* m, cmpfn_tp criterion)
{ lie_Index i=m->nrows; entry** a=m->elm; if (i<2) return;
  compare=set_ordering(criterion,m->ncols,defaultgrp); build_heap_m(m);
  while (swap_rows(a,&a[--i]),i>1) heapify_m(m,1,i);
}
Beispiel #5
0
void Qksortmat(matrix* m,cmpfn_tp criterion)
{ compare=set_ordering(criterion,m->ncols,defaultgrp);
  sort_matrix(m->elm,m->nrows,m->ncols);
}