コード例 #1
0
ファイル: basic.cpp プロジェクト: eliask/sprng
/* finds the desired result, given y, the primes to be killed, the denominators,
   the full set of initial primes, and the density of relative primes */
extern BigNum find_M(BigNum * guess, BigNum * y, struct BIGNUM_ARRAY_TYPE left_to_kill,
		     struct BIGNUM_ARRAY_TYPE denom, struct BIGNUM_ARRAY_TYPE initial_primes,
		     BigRat *magic)
{
  BigNum temp, temp2, current_mu;

#if 0
  Mu(&current_mu, guess, left_to_kill, denom); 
  temp = y - current_mu;
  temp2 = b_abs(temp);

  while (b_cmp(temp2, LINEAR_SEARCH_LIMIT) > 0) {
    temp2 = guess_mu_inverse(&temp, magic);
    (*guess) = (*guess) + temp2;

    Mu(&current_mu, guess, left_to_kill, denom);

    temp = y - current_mu;
    temp2 = b_abs(temp);
  }

  temp = b_clear();
  temp2 = b_clear();

#else

  *guess = "11";
  current_mu = "1";
#endif
  return(linear_find(y, &current_mu, guess, initial_primes));
} 
コード例 #2
0
errr linear_find(const Target& x, const STLContainer& ref_data)
{
	if (!ref_data.empty()) return linear_find(x,ref_data.begin(),ref_data.end());
	return -1;
}
コード例 #3
0
errr linear_find(const char* const x, const STLcontainer& ref_data)
{
	assert(NULL!=x && '\0'!=x[0]);
	if (!ref_data.empty()) return linear_find(x,ref_data.begin(),ref_data.size());
	return -1;
}