Changeset 75c47a9 in tol
- Timestamp:
- Jun 1, 2011, 9:51:48 AM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 6c2b35a
- Parents:
- e4cfd8b
- Location:
- tol/btol/bmodel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/bmodel/aia.cpp
re4cfd8b r75c47a9 89 89 :BObject(name), responseFunction_(rat), aia_(NIL), enabled_(BTRUE) 90 90 { 91 //Std(BText("\nCreating outlier ")+name+" = " +rat.Name()); 91 #ifdef TRACE_LEVEL 92 BText fun = BText(" BOutlier::BOutlier"); 93 #endif 94 TRACE_SHOW_TOP(fun,BText("\nCreating outlier ")+name+" = " +rat.Name()); 92 95 if(name.HasName()) 93 96 { … … 120 123 //-------------------------------------------------------------------- 121 124 { 125 #ifdef TRACE_LEVEL 126 BText fun = BText(" BOutlier::CalcExpand"); 127 #endif 122 128 expand_[n] = responseFunction_.Numerator().Coef(n); 123 //Std(BText("\n Expand[")+n+",0]="+expand_[n].Name());129 TRACE_SHOW_TOP(fun,BText("\n Expand[")+n+",0]="+expand_[n].Name()); 124 130 BInt i=n; 125 131 if(responseFunction_.Denominator().Degree()<n) … … 130 136 { 131 137 expand_[n] -= expand_[n-i]*responseFunction_.Denominator().Coef(i); 132 //Std(BText("\n Expand[")+n+","+i+"]="+expand_[n].Name());138 TRACE_SHOW_TOP(fun,BText("\n Expand[")+n+","+i+"]="+expand_[n].Name()); 133 139 } 134 140 expand_[n] /= responseFunction_.Denominator()[0].Coef(); … … 143 149 //-------------------------------------------------------------------- 144 150 { 151 #ifdef TRACE_LEVEL 152 BText fun = BText(" BOutlier::Expand"); 153 #endif 145 154 if((responseFunction_.Denominator().Degree()==0) && 146 155 (responseFunction_.Denominator()[0].Coef()!=0)) … … 155 164 if(n>=size) 156 165 { 157 //Std(BText("\nExpand : n = ")+n+", Size = "+ size +", MaxSize = "+expand_.MaxSize());166 TRACE_SHOW_TOP(fun,BText("\nExpand : n = ")+n+", Size = "+ size +", MaxSize = "+expand_.MaxSize()); 158 167 if(n>=expand_.MaxSize()) { expand_.ReallocBuffer(2*(n+1)); } 159 168 if(n>=expand_.MaxSize()) { expand_.ReallocBuffer(2*(n+1)); } … … 207 216 //-------------------------------------------------------------------- 208 217 { 218 #ifdef TRACE_LEVEL 219 BText fun = BText(" BOutlier::PutAia"); 220 #endif 209 221 int i, j; 210 222 int length = aia->N_; … … 212 224 rat_ = responseFunction_; 213 225 rat_*=aia_->rat_; 214 //Std(BText("\n Length = ")+length);226 TRACE_SHOW_TOP(fun,BText("\n Length = ")+length); 215 227 BPol expand = rat_ % (length+1); 216 228 x_.ReallocBuffer(length); … … 237 249 } 238 250 nearMaxAbs_.AllocBuffer(j); 239 //Std(BText("\n Ratio = ")+rat_.Name()+ " max (" + maxRelative_ +")="+max);251 TRACE_SHOW_TOP(fun,BText("\n Ratio = ")+rat_.Name()+ " max (" + maxRelative_ +")="+max); 240 252 } 241 253 … … 355 367 //-------------------------------------------------------------------- 356 368 { 369 #ifdef TRACE_LEVEL 370 BText fun = BText(" BOutlier::RecalcResiduous"); 371 #endif 357 372 if(!aia_) { return(NIL); } 358 373 t-=maxRelative_; … … 360 375 BDat sigma = 0; 361 376 BInt length = aia_->N_; 362 //Std(BText("\nRecalcResiduous(")+Name()+","+t+","+w+")");377 TRACE_SHOW_TOP(fun,BText("\nRecalcResiduous(")+Name()+","+t+","+w+")"); 363 378 for(; i<length; i++, j++) 364 379 { 365 380 aia_->res_->Data()[i]-=w*x_[j]; 366 //Std(BText("\n x[")+j+"]="+x_[j].Name());367 //Std(BText("; Res[")+i+"]="+aia_->res_->Data()[i]);381 TRACE_SHOW_TOP(fun,BText("\n x[")+j+"]="+x_[j].Name()); 382 TRACE_SHOW_TOP(fun,BText("; Res[")+i+"]="+aia_->res_->Data()[i]); 368 383 } 369 384 aia_->sigma_ = StandardDeviation(aia_->res_->Data()).Value(); … … 423 438 //-------------------------------------------------------------------- 424 439 { 440 #ifdef TRACE_LEVEL 441 BText fun = BText(" BAia::Initialize"); 442 #endif 425 443 BInt o; 426 444 BDat f = (*res_)[res_->FirstDate()]; //Forzes residuous calculation 427 445 N_ = res_->Data().Size(); 428 //Std(BText("\nResiduous dates ")+res_->FirstDate().Name()+", "+429 //res_->LastDate ().Name()+", "+N_);446 TRACE_SHOW_TOP(fun,BText("\nResiduous dates ")+res_->FirstDate().Name()+", "+ 447 res_->LastDate ().Name()+", "+N_); 430 448 sigma_ = StandardDeviation(res_->Data()).Value(); 431 449 //Std("\nUsing outlier's types: "); … … 433 451 { 434 452 userOutliers_[o]->PutAia(this); 435 //Std(BText("\n ")+userOutliers_[o]->Name());453 TRACE_SHOW_TOP(fun,BText("\n ")+userOutliers_[o]->Name()); 436 454 } 437 455 } … … 453 471 { 454 472 BReal absRes = Abs(res_->Data()[t]).Value(); 455 //Std(BText("\n ")+absRes+ " <=> " + max);473 TRACE_SHOW_TOP(fun,BText("\n ")+absRes+ " <=> " + max); 456 474 if(absRes>max) 457 475 { -
tol/btol/bmodel/maia.cpp
re4cfd8b r75c47a9 63 63 64 64 //-------------------------------------------------------------------- 65 bool BMultOutlier::IsDisjoint(const BMultOutlier& a) 66 //-------------------------------------------------------------------- 67 { 65 bool BMultOutlier::HasInput(BOutlier* outlier, int t) const 66 //-------------------------------------------------------------------- 67 { 68 #ifdef TRACE_LEVEL 69 BText fun = BText(" BMultOutlier::HasInput"); 70 #endif 71 int j; 72 bool has = false; 73 for(j=0; !has&&(j<input_.Size()); j++) 74 { 75 has = input_[j].t_ == t && 76 input_[j].outlier_ == outlier; 77 } 78 TRACE_SHOW_HIGH(fun, GetExpression()+"\n versus \n"+ 79 outlier->GetExpression(t,0) 80 +"\n -> "+has+"\n"); 81 return(has); 82 }; 83 84 //-------------------------------------------------------------------- 85 bool BMultOutlier::IsDisjoint(const BMultOutlier& a) const 86 //-------------------------------------------------------------------- 87 { 88 #ifdef TRACE_LEVEL 89 BText fun = BText(" BMultOutlier::IsDisjoint"); 90 #endif 68 91 int i, j; 69 92 bool ok = true; … … 79 102 } 80 103 } 104 TRACE_SHOW_HIGH(fun, GetExpression()+"\n versus \n"+a.GetExpression()+"\n -> "+ok+"\n"); 81 105 return(ok); 82 106 } … … 86 110 //-------------------------------------------------------------------- 87 111 { 88 int s = input_.Size(); 89 input_.ReallocBuffer(s+1); 90 input_[s].index_ = index; 91 input_[s].outlier_ = outlier; 92 input_[s].t_ = t; 93 input_[s].w0_ = w; 94 if(maxIndex_<index) { maxIndex_ = index; } 112 if(!HasInput(outlier, t)) 113 { 114 int s = input_.Size(); 115 input_.ReallocBuffer(s+1); 116 input_[s].index_ = index; 117 input_[s].outlier_ = outlier; 118 input_[s].t_ = t; 119 input_[s].w0_ = w; 120 if(maxIndex_<index) { maxIndex_ = index; } 121 } 95 122 } 96 123 … … 134 161 135 162 //-------------------------------------------------------------------- 136 BText BMultOutlier::GetExpression() 163 BText BMultOutlier::GetExpression() const 137 164 //-------------------------------------------------------------------- 138 165 { … … 164 191 { 165 192 #ifdef TRACE_LEVEL 166 BText fun = BText(" B Outlier::Estimate");193 BText fun = BText(" BMultOutlier::Estimate"); 167 194 #endif 168 195 TRACE_SHOW_HIGH(fun,"BEGIN"); … … 370 397 { 371 398 #ifdef TRACE_LEVEL 372 BText fun = BText(" B Outlier::SetResiduals");399 BText fun = BText(" BMultAia::SetResiduals"); 373 400 #endif 374 401 assert(y.Size()==res_->Data().Size()); … … 432 459 { 433 460 #ifdef TRACE_LEVEL 434 BText fun = BText(" B Outlier::RecalcResiduous");461 BText fun = BText(" BMultAia::RecalcResiduous"); 435 462 #endif 436 463 int s = mo.input_.Size(); … … 454 481 { 455 482 #ifdef TRACE_LEVEL 456 BText fun = BText(" B Aia::SearchMaxAbsRes");483 BText fun = BText(" BMultAia::SearchMaxAbsRes"); 457 484 #endif 458 485 if(optMaxOrder_>=N_) { return(false); } … … 497 524 { 498 525 #ifdef TRACE_LEVEL 499 BText fun = BText(" B Aia::SearchRefObs");526 BText fun = BText(" BMultAia::SearchRefObs"); 500 527 #endif 501 528 int maxNearRefObs = 3; … … 516 543 BMultOutlier& mor = mo[r]; 517 544 int t = mr[i].t_-userOutliers_[j]->nearMaxAbs_[k]; 518 mor.Add(r,userOutliers_[j],t,0); 519 r++; 545 if(!mor.HasInput(userOutliers_[j],t)) 546 { 547 mor.Add(r++,userOutliers_[j],t,0); 548 } 520 549 } 521 550 } … … 532 561 { 533 562 #ifdef TRACE_LEVEL 534 BText fun = BText(" B Aia::SearchNextMultOutlier");563 BText fun = BText(" BMultAia::SearchNextMultOutlier"); 535 564 #endif 536 565 BComparingInfo minimum; … … 717 746 { 718 747 #ifdef TRACE_LEVEL 719 BText fun = BText(" B Aia::Input");748 BText fun = BText(" BMultAia::Input"); 720 749 #endif 721 750 if(!input_) -
tol/btol/bmodel/tol_bmaia.h
re4cfd8b r75c47a9 88 88 return(*this); 89 89 } 90 bool IsDisjoint(const BMultOutlier& a); 91 BText GetExpression(); 90 bool HasInput(BOutlier* outlier, int t) const; 91 bool IsDisjoint(const BMultOutlier& a) const; 92 BText GetExpression() const; 92 93 void Add(int index, BOutlier* outlier, int t, BDat w); 93 94 void Add(const BMultOutlier& mo);
Note: See TracChangeset
for help on using the changeset viewer.
