Skip to content
Snippets Groups Projects
Commit 7cc9ef3e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

trivial embelishments of libtrivia.

parent 7bf37839
No related branches found
No related tags found
No related merge requests found
......@@ -643,7 +643,7 @@ void NManip::ScaExch()
for ( int i=0; i<fin->VS(j)->size(); ++i )
xcommon.push_back( fin->VS(j)->x[i] );
sort( xcommon.begin(), xcommon.end() );
triv::unique(&xcommon, 1e-180, 1e-20);
triv::make_unique(&xcommon, 1e-180, 1e-20);
printf("group of spectra %u .. %u has %i different x\n",
ji, jf-1, (int)xcommon.size());
......
......@@ -20,9 +20,9 @@ using namespace std;
//* vector operations *//
//***************************************************************************//
//! Insert val into vector *V, presuming the latter is sorted.
//! Inserts val into vector *V, presuming the latter is sorted.
void triv::merge( vector<double> *V, double val )
void triv::insert_in_sorted( vector<double> *V, double val )
{
for (size_t i=0; i<V->size(); ++i) {
if (val>(*V)[i]) continue;
......@@ -33,9 +33,9 @@ void triv::merge( vector<double> *V, double val )
V->push_back(val);
}
//! Eliminate double entries from vector V.
//! Eliminates double entries from vector V.
void triv::unique( vector<double> *V, double tolabs, double tolrel )
void triv::make_unique( vector<double> *V, double tolabs, double tolrel )
{
// tolrel z.Zt. nicht benutzt
vector<double> aux;
......@@ -48,7 +48,7 @@ void triv::unique( vector<double> *V, double tolabs, double tolrel )
*V = aux;
}
//! True unless V[i]<=V[i-1] for some i.
//! Returns rue unless V[i]<=V[i-1] for some i.
bool triv::is_ascending( const vector<double>& V )
{
......@@ -58,7 +58,7 @@ bool triv::is_ascending( const vector<double>& V )
return true;
}
//! Detect equidistant grid, set *step.
//! Returns true if grid is equidistant, sets *step.
bool triv::is_equidist( double *step, const vector<double>& V )
{
......@@ -72,7 +72,7 @@ bool triv::is_equidist( double *step, const vector<double>& V )
return true;
}
//! Compute array of sorted indices.
//! Returns array of indices sorted according to V.
vector<size_t> triv::sorted_indices(vector<double> const& V)
{
......
......@@ -9,8 +9,8 @@ namespace triv {
using namespace std;
void merge( vector<double> *V, double val );
void unique( vector<double> *V,
void insert_in_sorted( vector<double> *V, double val );
void make_unique( vector<double> *V,
double tolabs=1e-100, double tolrel=1e-10 );
bool is_ascending( const vector<double>& V );
bool is_equidist( double *step, const vector<double>& V );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment