本文整理汇总了C++中CData::logB_U_L方法的典型用法代码示例。如果您正苦于以下问题:C++ CData::logB_U_L方法的具体用法?C++ CData::logB_U_L怎么用?C++ CData::logB_U_L使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CData
的用法示例。
在下文中一共展示了CData::logB_U_L方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rprintf
void CFeasibilityMap::Simulate_logUnif_case2(int n_simul, Uniform &randUnif, CData &Data) {
if (useMap) {return;}
if (feasibleMap.nrows() == 0 || feasibleMap.maximum()==0) {
Rprintf( "Feasibility Map need to be set or computed first\n");
return;
}
Data.logUnif_case2 =Matrix(Data.n_faulty,Data.n_tau); Data.logUnif_case2 = 0;
for (int i_original=1; i_original<=Data.n_sample; i_original++){
if (Data.is_case(i_original,2)) {
int i_faulty = Data.Original2Faulty[i_original-1];
ColumnVector tilde_y_i = Data.log_D_Observed.row(i_original).t();
for (int i_tau=1; i_tau<=Data.n_tau; i_tau++){
if ( feasibleMap(i_tau,i_faulty)==1 ){
double case2_count_out = 0;
ColumnVector s_i = tau_to_s_fn( i_tau, Data.n_var );
ColumnVector item_by_joint = Data.copy_non_balance_edit(s_i);
for (int i_simul=1; i_simul<=n_simul; i_simul++){
//Generate from uniform distribution
ColumnVector y_q = tilde_y_i;
for ( int temp_j=1; temp_j<=Data.n_var; temp_j++ ){
if ( item_by_joint(temp_j)==1 ){
y_q(temp_j) = Data.logB_L(temp_j)+Data.logB_U_L(temp_j)*randUnif.Next();
}
}
ColumnVector x_q = exp_ColumnVector(y_q) ;
Data.update_full_x_for_balance_edit(x_q);
if (!Data.PassEdits(x_q)) { case2_count_out += 1.0;}
}
double Area = 1.0;
for ( int temp_j=1; temp_j<=Data.n_var; temp_j++ ){
if ( item_by_joint(temp_j)==1 ){
Area = Area * Data.logB_U_L(temp_j) ;
}
}
Area = Area * case2_count_out / n_simul ;
Data.set_logUnif_case2(i_original, i_tau, -log(Area));
}
}
if ( ((1.0*i_original/100)==(floor(1.0*i_original/100))) ){
Rprintf( "logUnif_y_tilde for i_sample= %d\n",i_original);
}
}
}
}
示例2: count_x_out_fn
int CFeasibilityMap::count_x_out_fn(CData &Data,int i_tau, int i_original,int n_simul, Uniform &randUnif) {
// double case2_count_out = 0;
int case2_count_out = 0; // Changed by Hang on 5/16/2015
ColumnVector s_i = tau_to_s_fn( i_tau, Data.n_var );
ColumnVector item_by_joint = Data.copy_non_balance_edit(s_i);
ColumnVector tilde_y_i = Data.log_D_Observed.row(i_original).t();
for (int i_simul=1; i_simul<=n_simul; i_simul++){
//Generate from uniform distribution
ColumnVector y_q = tilde_y_i;
for ( int temp_j=1; temp_j<=Data.n_var; temp_j++ ){
if ( item_by_joint(temp_j)==1 ){
y_q(temp_j) = Data.logB_L(temp_j)+Data.logB_U_L(temp_j)*randUnif.Next();
}
}
ColumnVector x_q = exp_ColumnVector(y_q) ;
Data.update_full_x_for_balance_edit(x_q);
// if (!Data.PassEdits(x_q)) { case2_count_out += 1.0;}
if (!Data.PassEdits(x_q)) { case2_count_out += 1;} // Changed by Hang on 5/16/2015
}
if (case2_count_out ==0) {
case2_count_out = 1;
}
return case2_count_out; // ADDED by Hang on 5/16/2015
}