Commit 7f680534 authored by Miroslav Shaltev's avatar Miroslav Shaltev
Browse files

work on hybrid search partial volume

parent 96c46e23
......@@ -1879,6 +1879,28 @@ INT4 FStatNomad::compute_extends(gsl_vector *extends, INT4 ExType, INT4 SType, L
return 0;
}
INT4 FStatNomad::compute_min_extent(gsl_vector *minext, const gsl_matrix *g) {
INT4 maxdim = g->size1;
INT4 signum;
gsl_matrix* im = gsl_matrix_calloc(maxdim,maxdim);
gsl_matrix* m = gsl_matrix_calloc(maxdim,maxdim);
gsl_matrix_memcpy (m, g);
gsl_permutation * p = gsl_permutation_calloc (maxdim);
gsl_linalg_LU_decomp(m, p, &signum);
gsl_linalg_LU_invert(m, p, im);
for (INT4 i = 0; i < maxdim; i++) {
gsl_vector_set(minext,i,2*sqrt(fabs(gsl_matrix_get(im,i,i))));
}
for (INT4 i = 0; i < maxdim; i++) {
LogPrintf(LOG_LAST," %e ",gsl_vector_get(minext,i));
}
LogPrintf(LOG_NORMAL,"\n");
return 0;
}
......@@ -2976,7 +2998,10 @@ INT4 FStatNomad::DoSearch(Display out,vector<ExPoint> &epv,INT4 fstatsearchtype,
hybrid_search->Lattice(HybridSearchLattice());
hybrid_search->M(HybridSearchMismatch());
hybrid_search->G(Semicohmetric());
hybrid_search->MDim(DimMetric(SType(),USETYPE_SEARCH));
hybrid_search->MDim(DimMetric(SType(),USETYPE_SEARCH));
gsl_vector* minext = gsl_vector_alloc(DimMetric(SType(),USETYPE_SEARCH));
compute_min_extent(minext,Semicohmetric());
hybrid_search->MinExt(minext);
if (HybridSearchLatticeAtOnce()){
hybrid_search->PartialLattice(FALSE);
}
......@@ -3034,6 +3059,10 @@ INT4 FStatNomad::DoSearch(Display out,vector<ExPoint> &epv,INT4 fstatsearchtype,
hybrid_search->M(FinalHybridSearchMismatch());
hybrid_search->G(Cohmetric());
hybrid_search->MDim(DimMetric(SType(),USETYPE_SEARCH));
hybrid_search->MDim(DimMetric(SType(),USETYPE_SEARCH));
gsl_vector* minext = gsl_vector_alloc(DimMetric(SType(),USETYPE_SEARCH));
compute_min_extent(minext,Cohmetric());
hybrid_search->MinExt(minext);
if (FinalHybridSearchLatticeAtOnce()){
hybrid_search->PartialLattice(FALSE);
}
......@@ -3432,9 +3461,9 @@ void SCHybridSearch::search( Mads & mads, int &nb_search_pts, bool &stop, stop_t
for (INT4 i = 0; i < directions.size(); i++) {
pdirections.push_back(directions.at(i));
pdirections.at(i).min = (*x)[i].value()/directions.at(i).scale - 2. * np / gsl_matrix_get(g,i,i);
pdirections.at(i).max = (*x)[i].value()/directions.at(i).scale + 2. * np / gsl_matrix_get(g,i,i);
printf("size in direction %d:%.16e\n",i,pdirections.at(i).max-pdirections.at(i).min);
pdirections.at(i).min = (*x)[i].value()/directions.at(i).scale - gsl_vector_get(minext,i);
pdirections.at(i).max = (*x)[i].value()/directions.at(i).scale + gsl_vector_get(minext,i);
printf("size in direction %d:%.16e,%.16e\n",i,gsl_matrix_get(g,i,i),pdirections.at(i).max-pdirections.at(i).min);
}
for (INT4 i = 0; i < directions.size(); i++) {
......@@ -3610,9 +3639,9 @@ void FCHybridSearch::search ( Mads &mads, int &nb_search_pts, bool &stop, stop_t
for (INT4 i = 0; i < directions.size(); i++) {
pdirections.push_back(directions.at(i));
pdirections.at(i).min = (*x)[i].value()/directions.at(i).scale - 2. * np / gsl_matrix_get(g,i,i);
pdirections.at(i).max = (*x)[i].value()/directions.at(i).scale + 2. * np / gsl_matrix_get(g,i,i);
printf("size in direction %d:%.16e,%.16e\n",i,(*x)[i].value()/directions.at(i).scale,pdirections.at(i).max-pdirections.at(i).min);
pdirections.at(i).min = (*x)[i].value()/directions.at(i).scale - gsl_vector_get(minext,i);
pdirections.at(i).max = (*x)[i].value()/directions.at(i).scale + gsl_vector_get(minext,i);
printf("size in direction %d:%.16e,%.16e,%.16e\n",i,gsl_matrix_get(g,i,i),(*x)[i].value()/directions.at(i).scale,pdirections.at(i).max-pdirections.at(i).min);
}
for (INT4 i = 0; i < directions.size(); i++) {
......
......@@ -423,6 +423,9 @@ public:
g = v;
}
void MinExt(gsl_vector *v){
minext = v;
}
private:
LatticeTiling *tiling;
......@@ -433,6 +436,7 @@ private:
INT4 mdim;
REAL8 m;
gsl_matrix *g;
gsl_vector *minext;
};
class FCHybridSearch : public NOMAD::Search {
......@@ -472,6 +476,11 @@ public:
g = v;
}
void MinExt(gsl_vector *v){
minext = v;
}
private:
LatticeTiling *tiling;
INT4 np;
......@@ -481,6 +490,7 @@ private:
INT4 mdim;
REAL8 m;
gsl_matrix *g;
gsl_vector *minext;
};
class FStatNomad {
......@@ -2165,6 +2175,7 @@ public:
void HybridSearchCreateLattice(gsl_matrix *g, REAL4 m,CHAR *lattice);
INT4 compute_min_extent(gsl_vector *minext, const gsl_matrix *g);
MultiSFTVector *multiSFTs;
NOMAD::Cache *cache() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment