Skip to content

Commit cdaffcb

Browse files
author
deseilligny
committed
Merge branch 'mpd'
2 parents 7595e2c + 0ceb9d7 commit cdaffcb

File tree

11 files changed

+428
-537
lines changed

11 files changed

+428
-537
lines changed

MMVII/include/MMVII_Bench.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class cAppliBenchAnswer
3535
class cParamExeBench
3636
{
3737
public :
38-
cParamExeBench(const std::string & aPattern,const std::string & aBugKey,int aLevInit,bool Show);
38+
cParamExeBench(const std::string & aPattern,const std::string & aPatRefut,const std::string & aBugKey,int aLevInit,bool Show);
3939

4040
bool NewBench(const std::string & aName,bool ExactMatch=false); ///< Memo the name, Indicate if the bench is executed,
4141
bool GenerateBug(const std::string & aKey);
@@ -62,6 +62,7 @@ class cParamExeBench
6262
int mNbExe;
6363
std::string mName; ///< Exact Name for exact select
6464
tNameSelector mPattern; ///< Pattern for select bench
65+
tNameSelector mPatternRefut; ///< Pattern for refutation of a bench
6566
std::string mBugKey;
6667
};
6768

MMVII/include/MMVII_Geom3D.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ class cPlane3D
487487
/// Return the indexes of the "best" plane
488488
static std::pair<cPt3di,tREAL8> IndexRansacEstimate(const std::vector<cPt3dr> & aP0,bool AvgOrMax,int aNbTest=-1,tREAL8 aRegulMinTri =1e-3);
489489

490+
/// Return a plane estimate by least-square
491+
static std::pair<cPlane3D,tREAL8> LSQEstimate(const std::vector<cPt3dr> & aP0,const std::vector<tREAL8>* =nullptr);
492+
490493
/// Avegrage distance
491494
tREAL8 AvgDist(const std::vector<cPt3dr> &) const;
492495
tREAL8 MaxDist(const std::vector<cPt3dr> &) const;

MMVII/include/MMVII_Matrix.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ template <class Type> class cDenseMatrix : public cUnOptDenseMatrix<Type>
564564
Type MulLineElem(int aX,const tDV &)const override;
565565
void Add_tAB(const tDV & aCol,const tDV & aLine) override;
566566
void Add_tAA(const tDV & aColLine,bool OnlySup=true) override;
567+
void WeightedAdd_tAA(const tDV & aColLine,const tVal& aW,bool OnlySup=true);
568+
567569
void Sub_tAA(const tDV & aColLine,bool OnlySup=true) override;
568570

569571
void Weighted_Add_tAA(Type aWeight,const tDV & aColLine,bool OnlySup=true) override;
@@ -734,6 +736,8 @@ template <class Type> class cStrStat2
734736
cStrStat2(int aSz);
735737
/// Add a vectors to stats
736738
void Add(const cDenseVect<Type> & );
739+
/// Add a vectors to stats
740+
void WeightedAdd(const cDenseVect<Type> &,const Type & aW );
737741
/// Make average (instead of sums) and centered (for cov)
738742
void Normalise(bool CenteredAlso=true);
739743
/// Compute eigen values

MMVII/include/MMVII_Ptxd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,9 @@ template <class tContPts> class cComputeCentroids
626626

627627
/// Median of dist to MedianCentroids
628628
static tREAL8 MedianSigma(const tContPts &);
629+
630+
static tPts LinearWeigtedCentroids(const tContPts &,const std::vector<tEl>* =nullptr);
631+
629632
};
630633

631634
/*

MMVII/include/MMVII_Tpl_Images.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ template<class T1,class T2,int Dim>
174174
aI1.GetRDL(aK) += aI2.GetRDL(aK) ;
175175
}
176176

177+
template<class T1,class T2,int Dim>
178+
void AddMulIn(cDataTypedIm<T1,Dim> & aI1,const cDataTypedIm<T2,Dim> & aI2,const T2 & aMul)
179+
{
180+
aI1.AssertSameArea(aI2);
181+
182+
for (int aK=0 ; aK<aI1.NbElem() ; aK++)
183+
aI1.GetRDL(aK) += aI2.GetRDL(aK) * aMul ;
184+
}
185+
177186
template<class T1,class T2,class T3>
178187
cIm2D<T1> AddImage(T1* /*Type specifier*/ ,const cIm2D<T2> & aI2,const cIm2D<T3> & aI3)
179188
{

MMVII/src/Bench/BenchGlob.cpp

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,24 @@ cAppliBenchAnswer::cAppliBenchAnswer(bool HasBench,double aTime) :
7171
/* */
7272
/* ================================================ */
7373

74-
cParamExeBench::cParamExeBench(const std::string & aPattern,const std::string &aBugKey,int aLevInit,bool Show) :
75-
mInsideFunc (false),
76-
mLevInit (aLevInit),
77-
mCurLev (mLevInit),
78-
mShow (Show),
79-
mDemoTest (false),
80-
mNbExe (0),
81-
mName (aPattern),
82-
mPattern (AllocRegex(aPattern)),
83-
mBugKey (aBugKey)
74+
cParamExeBench::cParamExeBench
75+
(
76+
const std::string & aPattern,
77+
const std::string & aPatRefut,
78+
const std::string &aBugKey,
79+
int aLevInit,
80+
bool Show
81+
) :
82+
mInsideFunc (false),
83+
mLevInit (aLevInit),
84+
mCurLev (mLevInit),
85+
mShow (Show),
86+
mDemoTest (false),
87+
mNbExe (0),
88+
mName (aPattern),
89+
mPattern (AllocRegex(aPattern)),
90+
mPatternRefut (AllocRegex(aPatRefut)),
91+
mBugKey (aBugKey)
8492
{
8593
}
8694

@@ -93,7 +101,9 @@ bool cParamExeBench::NewBench(const std::string & aName,bool ExactMatch)
93101
mVAllBugKeys.push_back(std::vector<std::string> ());
94102
}
95103
MMVII_INTERNAL_ASSERT_always(!mInsideFunc,"Bad NewBench/EndBench handling");
96-
if (ExactMatch ? (mName==aName) : mPattern.Match(aName))
104+
if ( (ExactMatch ? (mName==aName) : mPattern.Match(aName))
105+
&& (!mPatternRefut.Match(aName))
106+
)
97107
{
98108
mNbExe++;
99109
mInsideFunc = true;
@@ -337,6 +347,7 @@ class cAppli_MMVII_Bench : public cMMVII_Appli
337347
int mLevMin; // Min level of bench
338348
int mShow; // Do the bench show details
339349
std::string mPat; // Pattern for selected bench
350+
std::string mPatRefut; // Pattern for refutation of bench
340351
std::string mKeyBug; // Pattern for selected bench
341352
int mNumBugRecall; ///< Used if we want to force bug generation in recall process
342353
bool mDoBUSD; ///< Do we do BenchUnbiasedStdDev
@@ -356,6 +367,7 @@ cCollecSpecArg2007 & cAppli_MMVII_Bench::ArgOpt(cCollecSpecArg2007 & anArgOpt)
356367
anArgOpt
357368
<< AOpt2007(mLevMin,"LevMin","Min level of bench",{{eTA2007::HDV}})
358369
<< AOpt2007(mPat,"PatBench","Pattern filtering exec bench, use XXX to get existing ones",{{eTA2007::HDV}})
370+
<< AOpt2007(mPatRefut,"PatRefutBench","Pattern for refutation",{{eTA2007::HDV}})
359371
<< AOpt2007(mKeyBug,"KeyBug","Key for forcing bug")
360372
<< AOpt2007(mShow,"Show","Show mesg, Def=true if PatBench init")
361373
<< AOpt2007(mNumBugRecall,"NBR","Num to Generate a Bug in Recall,(4 manuel inspection of log file)")
@@ -369,6 +381,7 @@ cAppli_MMVII_Bench::cAppli_MMVII_Bench (const std::vector<std::string> & aVArgs,
369381
mLevMin (0),
370382
mShow (false),
371383
mPat (".*"),
384+
mPatRefut ("@@@"),
372385
mNumBugRecall (-1),
373386
mDoBUSD (false),
374387
mDemoTest (false)
@@ -405,7 +418,7 @@ int cAppli_MMVII_Bench::Exe()
405418
if (!IsInit(&mShow))
406419
mShow = IsInit(&mPat); // Becoz, if mPat init, few bench => we can display msg
407420

408-
cParamExeBench aParam(mPat,mKeyBug,mLevMin,mShow);
421+
cParamExeBench aParam(mPat,mPatRefut,mKeyBug,mLevMin,mShow);
409422
aParam.SetDemoTest(mDemoTest);
410423

411424
for (int aLev=mLevMin ; aLev<mLevelMax ; aLev++)

MMVII/src/Geom3D/GeomsBase3D.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ static const cPt3di NoTriplet(-1,-1,-1);
271271

272272
std::pair<cPt3di,tREAL8> cPlane3D::IndexRansacEstimate(const std::vector<cPt3dr> & aVPts,bool AvgOrMax,int aNbTest,tREAL8 aRegulMinTri)
273273
{
274+
//StdOut() << "cPlane3D::IndexRansacEstimatcPlane3D::IndexRansacEstimat\n";getchar();
275+
274276
cWhichMin<cPt3di,tREAL8> aWM(NoTriplet,1e30);
275277

276278
std::vector<cSetIExtension> aSet3I; // Set of triple of indexes

MMVII/src/Matrix/cDenseMatrix.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,16 @@ template <class Type> void cDenseMatrix<Type>::Add_tAB(const tDV & aCol,const tD
497497
}
498498
template <class Type> void cDenseMatrix<Type>::Add_tAA(const tDV & aCol,bool OnlySup)
499499
{
500-
TplAdd_tAA(*this,aCol,OnlySup);
500+
// StdOut() << "WeightedAdd_tAAWeightedAdd_tAAWeightedAdd_tAAWeightedAdd_tAAWeightedAdd_tAA\n";
501+
// TplAdd_tAA(*this,aCol,OnlySup);
502+
WeightedAdd_tAA(aCol,1.0,OnlySup);
501503
}
504+
505+
template <class Type> void cDenseMatrix<Type>::WeightedAdd_tAA(const tDV & aColLine,const tVal& aW,bool OnlySup)
506+
{
507+
TplWeightedAdd_tAA(*this,aW,aColLine,OnlySup);
508+
}
509+
502510
template <class Type> void cDenseMatrix<Type>::Sub_tAA(const tDV & aCol,bool OnlySup)
503511
{
504512
TplSub_tAA(*this,aCol,OnlySup);

0 commit comments

Comments
 (0)