QuadricsStatistic.cpp

Go to the documentation of this file.
00001 //
00002 // C++ Implementation: QuadricsStatistic
00003 //
00004 // Description: 
00005 //
00006 //
00007 // Author: Jakob Kroeker <kroeker@uni-math.gdgw.de>, (C) 2009
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 
00013 
00014 
00015 #include "QuadricsStatistic.h"
00016 namespace nCenterFocus
00017 {
00026 BaseQuadricsStatistic::BaseQuadricsStatistic(   std::string name, 
00027                                                         int _permittedMinSuccessiveVanishedFocalValuesNum, 
00028                                                         int _maxPermittedVanishedFocalValuesNum,
00029                                                         int _maxPermittedJacobianRank 
00030                                                 ):
00031                                                 name_m( name ), 
00032                                                 maxJacobianRank_m( _maxPermittedJacobianRank ),
00033                                                 maxFocalValuesToCompute_m( _maxPermittedVanishedFocalValuesNum ),
00034                                                 minSuccessiveVanishedFocalValues_m( _permittedMinSuccessiveVanishedFocalValuesNum )
00035                                                                                 
00036                                                                                 
00037 {
00038         
00039         maxQuadricRank_m = (  maxJacobianRank_m*( maxJacobianRank_m+1 )  )/2;
00040 
00041         assert( maxQuadricRank_m>0 );
00042 
00043         rankStatistics_m.resize( maxQuadricRank_m + 1 );
00044 
00045         expSum_m.clear();
00046         expSum_m.resize(maxQuadricRank_m + 1, 0);
00047 
00048         for (int i=0;i<=maxQuadricRank_m;i++)
00049         {
00050                 rankStatistics_m[i] = new BaseRankStatistic(    "rankStatistik", 
00051                                                                                 minSuccessiveVanishedFocalValues_m ,
00052                                                                                 maxFocalValuesToCompute_m, 
00053                                                                                 maxJacobianRank_m 
00054                                                                         );
00055         }
00056  
00057 };
00058 
00059 
00060 
00061 void BaseQuadricsStatistic::clear()
00062 {
00063         for (int i=0;i<=maxQuadricRank_m;i++)
00064         {
00065                 delete rankStatistics_m[i];
00066 
00067                 rankStatistics_m[i] = new BaseRankStatistic(    "rankStatistik", 
00068                                                                                 minSuccessiveVanishedFocalValues_m ,
00069                                                                                 maxFocalValuesToCompute_m, 
00070                                                                                 maxJacobianRank_m 
00071                                                                         );
00072         }
00073 
00074         expSum_m.clear();
00075         expSum_m.resize(maxQuadricRank_m + 1, 0);
00076 
00077 }
00078 
00079 
00080 BaseQuadricsStatistic::BaseQuadricsStatistic(
00081                                                                 const BaseQuadricsStatistic& ref
00082                                                         ):
00083                                                                 name_m(ref.name_m), 
00084                                                                 maxJacobianRank_m(ref.maxJacobianRank_m),
00085                                                                 maxFocalValuesToCompute_m(ref.maxFocalValuesToCompute_m),
00086                                                                 minSuccessiveVanishedFocalValues_m(ref.minSuccessiveVanishedFocalValues_m)
00087 {
00088         maxQuadricRank_m = (  maxJacobianRank_m*( maxJacobianRank_m+1 )  )/2;
00089 
00090         assert( maxQuadricRank_m>0 );
00091 
00092         rankStatistics_m.resize( maxQuadricRank_m + 1 );
00093         expSum_m.resize(maxQuadricRank_m + 1);
00094 
00095         for (int i=0;i<= maxQuadricRank_m;i++)
00096         {
00097                 rankStatistics_m[i]= new BaseRankStatistic(*(ref.rankStatistics_m[i]) ) ;
00098                 //*(rankStatistics_m[i])=*(ref.rankStatistics_m[i]);
00099         }
00100         
00101 
00102 }
00103 
00104 
00105 
00106 int     BaseQuadricsStatistic::getHighestLoggedQuadricsRank( ) const
00107 {
00108         for (int currQuadricsRank = maxQuadricRank_m; currQuadricsRank>=0; currQuadricsRank--)
00109         {
00110                 if( expSum_m[currQuadricsRank] != 0 )
00111                         return currQuadricsRank;
00112         }
00113         return 0;
00114 }
00115 
00117 void BaseQuadricsStatistic::printValue(std::ostream &os  ) const
00118 {
00119         bool firstLine=true;
00120         os <<  "   { ";
00121         for (int currQuadricsRank=0; currQuadricsRank<= getHighestLoggedQuadricsRank(); currQuadricsRank++)
00122         {
00123                 if (firstLine)
00124                 {
00125                         firstLine=false;
00126                 }
00127                 else
00128                 {
00129                         os << ", ";
00130                 }
00131                 os << "\n ";
00132                 {
00133                         os << "{ " << currQuadricsRank << ",  " << rankStatistics_m[currQuadricsRank]->getValueAsString();
00134                         os << ", " << expSum_m[currQuadricsRank];
00135                         os << "} ";
00136                 }
00137         }
00138         os << "\n} ";
00139 }
00140 
00145 void BaseQuadricsStatistic::print(std::ostream &os ) const
00146 {
00147         os << name_m  << " = ";
00148         printValue(os);
00149         os << "; --Format: TODO" ;
00150 }
00151 
00152 
00153 
00154 BaseQuadricsStatistic::~BaseQuadricsStatistic()
00155 {
00156         for (int i=0; i<= maxQuadricRank_m;i++)
00157         {
00158                 delete rankStatistics_m[i];
00159         }
00160 
00161 }
00162 
00163 
00164 
00165 
00170 //-----------------------------------------------------------------
00171 QuadricsStatistic::QuadricsStatistic(   std::string name, 
00172                                                         int _permittedMinSuccessiveVanishedFocalValuesNum, 
00173                                                         int _maxPermittedVanishedFocalValuesNum,
00174                                                         int _maxPermittedJacobianRank 
00175                                                 ):
00176                                                 name_m(name),
00177                                                 quadricStatisticPair_m( BaseQuadricsStatistic(  name+"_passedLiftTest", 
00178                                                                                                                 _permittedMinSuccessiveVanishedFocalValuesNum,
00179                                                                                                                 _maxPermittedVanishedFocalValuesNum,
00180                                                                                                                 _maxPermittedJacobianRank 
00181                                                                                                                 ),
00182                                                                                 BaseQuadricsStatistic(  name+"_failedLiftTest", 
00183                                                                                                                 _permittedMinSuccessiveVanishedFocalValuesNum,
00184                                                                                                                 _maxPermittedVanishedFocalValuesNum,
00185                                                                                                                 _maxPermittedJacobianRank 
00186                                                                                                                 )
00187                                                                                 )
00188 {}
00189 
00190 
00193 void QuadricsStatistic::print(std::ostream &os) const
00194 {
00195         
00196         os << name_m << " = { ";
00197 
00198         quadricStatisticPair_m.first.printValue(os);
00199         os <<  " ,\n  ";
00200         quadricStatisticPair_m.second.printValue(os);
00201         
00202         os << "\n}; --Format: TODO" ;
00203         os << std::endl;
00204 }
00205 
00206 void QuadricsStatistic::clear()
00207 {
00208         quadricStatisticPair_m.first.clear();
00209         quadricStatisticPair_m.second.clear();
00210 }
00211 
00212 QuadricsStatistic::~QuadricsStatistic()
00213 {
00214         
00215 }
00216 
00217 //-------------------------------------------
00218 
00226 LiftAndQuadricsStatistic::LiftAndQuadricsStatistic(     std::string name,
00227                                                                         int     _minPermittedVanishedFocalValuesNum, 
00228                                                                         int     _maxPermittedFocalValuesNum, 
00229                                                                         int     _maxPermittedJacobianRank, 
00230                                                                         int     exhaustiveMaxLift, 
00231                                                                         int     exhaustiveLiftTrials
00232                                                                 ):
00233                                                         name_m(name),
00234                                                         exhaustiveMaxLift_m( exhaustiveMaxLift ),
00235                                                         exhaustiveLiftTrials_m( exhaustiveLiftTrials ),
00236                                                         quadricStatisticPair_m( BaseQuadricsStatistic(  name+"_passedLiftTest", 
00237                                                                                                                 _minPermittedVanishedFocalValuesNum,
00238                                                                                                                 _maxPermittedFocalValuesNum,
00239                                                                                                                 _maxPermittedJacobianRank 
00240                                                                                                                 ),
00241                                                                                         BaseQuadricsStatistic(name+"_failedLiftTest", 
00242                                                                                                                 _minPermittedVanishedFocalValuesNum,
00243                                                                                                                 _maxPermittedFocalValuesNum,
00244                                                                                                                 _maxPermittedJacobianRank 
00245                                                                                                                 )
00246                                                                                         )
00247 {
00248 }
00249 
00250 
00251 
00252 void LiftAndQuadricsStatistic::clear()
00253 {
00254         quadricStatisticPair_m.first.clear();
00255         quadricStatisticPair_m.second.clear();
00256 
00257         failedQuadricStatistic_m.clear();
00258 
00259 }
00260 
00261 void    LiftAndQuadricsStatistic::printValue(std::ostream &os) const
00262 {
00263         os << "  { ";
00264 
00265         quadricStatisticPair_m.first.printValue(os);
00266         os <<  " ,\n  ";
00267         quadricStatisticPair_m.second.printValue(os);
00268         os <<  " ,\n  { \n";
00269         os << "-- MinLiftStatistics: " << std::endl;
00270         os << " -- exhaustiveMaxLift =  " << exhaustiveMaxLift_m  << std::endl;
00271         os << " -- exhaustiveLiftTrials =  " << exhaustiveLiftTrials_m << std::endl;
00272 
00273         BaseQuadricsStatisticMapType::const_iterator it;
00274 
00275         int i=1;
00276         for (it= failedQuadricStatistic_m.begin(); it != failedQuadricStatistic_m.end(); it++, i++)
00277         {
00278                 if (i>1)
00279                         os << ", \n ";
00280 
00281                 os << "{" << (*it).first << ",  -- minFailedLift \n --correspontingQuadricStatistics \n" ;
00282                 (*it).second->printValue(os);
00283                 os << "\n} ";
00284         }
00285         os << "} -- EndMinLiftStatistics \n";
00286         os << "} ";
00287 }
00288 
00293 void    LiftAndQuadricsStatistic::print(std::ostream &os) const
00294 {
00295         os << name_m << " =  ";
00296         printValue(os);
00297         os << "  ; --EndLiftAndQuadricsStatistic. Format: TODO" ;
00298         os << std::endl;
00299 }
00300 
00301 
00302 LiftAndQuadricsStatistic::~LiftAndQuadricsStatistic()
00303 {
00304         BaseQuadricsStatisticMapType::const_iterator it;
00305 
00306         for (it= failedQuadricStatistic_m.begin(); it != failedQuadricStatistic_m.end(); it++)
00307         {
00308                 delete (*it).second;
00309         }
00310 }
00311 
00312 };
00313 
00314 
Generated on Tue Nov 23 13:10:52 2010 for centerfocus by  doxygen 1.6.3