无语
以前看到CPF,以为是CFP;现在看到CFP,以为是CPF。。。
Super Lazy Cat
Written by Pan Yu at 12:05 AM 2 comments
Labels: thoughts, travelling
看到同住的Kwoon lim正在为病怏怏Joshua煮晚餐,我称赞他说,不愧是哥们儿啊。他回答道:没什么嘛,顺手牵羊而已嘛。
Written by Pan Yu at 8:26 PM 3 comments
Written by Pan Yu at 5:05 PM 3 comments
Labels: cuda, gpgpu, programming
关上灯,耳机中响起《gone too soon》的旋律。歌声中夹杂的气息,呼吸声,点点的喉音,一切听起来都那么清晰,那么近,就像那个人还在耳边歌唱,还没有离去。
我们的这个时代,没有披头士,没有猫王,但是却很幸运的有MJ。他其实一直都是一个天真的孩子。只是,这个世界太复杂。May you rest in peace,默默的,祝福。
Written by Pan Yu at 8:33 PM 2 comments
Article is "statistical confidence levels for estimating error probability".
The first function calculates the confidence level (CL) given the number bit errors measured (n), the total number of bits tested (N), and the expected BER (ph).
// CL = 1 - (\Sigma^{0}_{N}(n * ph)^k/(k!)) * e^{-n * ph}
double solve_CL_from_N_n_ph(unsigned N, double n, double ph)
{
double emnp = exp(-n * ph);
double sum = 1;
double product = 1;
for(unsigned k = 1; k <= N; k++)
{
product *= (n * ph / k);
sum += product;
}
sum *= emnp;
return(1 - sum);
}
double solve_n_from_ph_CL_N(double ph, double CL, unsigned N)
{
if(N==0)
return(-log(1-CL)/ph);
else
{
// solve n using binary search, based on "solve_CL_from_N_n_ph"
double upper_n = N/ph * max(100, N), // enlarge at least 100 times
lower_n = 100000, // at least 100000 data
cur_n = upper_n, next_n;
double min_interval = 100; // minimum internal to break the search
while(1)
{
double cur_CL = solve_CL_from_N_n_ph(N, cur_n, ph);
if(cur_CL >= CL) // if calculated value is more confident, try to reduce n
{
upper_n = cur_n;
next_n = lower_n + (upper_n - lower_n)/2;
} else
{
lower_n = cur_n;
next_n = upper_n - (upper_n - lower_n)/2;
}
if(fabs(next_n - cur_n) < min_interval)
break;
cur_n = next_n;
}
return(cur_n);
}
}
Written by Pan Yu at 4:08 PM 3 comments