Skip to content

Commit

Permalink
std'ing vectors, pairs, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentnoe committed May 11, 2022
1 parent ab33424 commit 4aac196
Show file tree
Hide file tree
Showing 9 changed files with 420 additions and 421 deletions.
496 changes: 248 additions & 248 deletions src/automaton.hh

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/cost.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* and in the @f$ (\oplus = min, \otimes = plus) @f$ tropical semi-ring
*
*
* @see matrix, automaton
* @see matrix, automaton
*/

// @{
Expand Down Expand Up @@ -35,7 +35,7 @@ using namespace std;
* (C++ operators @f$+@f$ and @f$\times@f$) can be used in both cases : either on costs, otherwise on more
* traditional floating point values...
*
* @see matrix, automaton
* @see matrix, automaton
*/

template<typename C> class cost {
Expand Down
14 changes: 7 additions & 7 deletions src/macro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ int gv_subalignment_length = 0;
int gv_subalignment_function_index = 0;
char * gv_subalignment_functions_names[SUBALIGNMENT_FUNCTIONS_NUMBER] = {(char *)"min",(char *)"max",(char *)"avg", (char*)"med"};

template<typename T> double min_vector(vector<T> & v) {return (double)(*(std::min_element(v.begin(),v.end())));}
template<typename T> double max_vector(vector<T> & v) {return (double)(*(std::max_element(v.begin(),v.end())));}
template<typename T> double avg_vector(vector<T> & v) {return (double)(std::accumulate(v.begin(), v.end(), 0.0)) / v.size();}
template<typename T> double med_vector(vector<T> & v) {size_t n = v.size() / 2; nth_element(v.begin(), v.begin()+n, v.end()); return (double)v[n];}
template<typename T> double min_vector(std::vector<T> & v) {return (double)(*(std::min_element(v.begin(),v.end())));}
template<typename T> double max_vector(std::vector<T> & v) {return (double)(*(std::max_element(v.begin(),v.end())));}
template<typename T> double avg_vector(std::vector<T> & v) {return (double)(std::accumulate(v.begin(), v.end(), 0.0)) / v.size();}
template<typename T> double med_vector(std::vector<T> & v) {size_t n = v.size() / 2; nth_element(v.begin(), v.begin()+n, v.end()); return (double)v[n];}

subalignment_function_int gv_subalignment_functions_int[SUBALIGNMENT_FUNCTIONS_NUMBER] = {
(subalignment_function_int) &min_vector<int>,
Expand All @@ -40,16 +40,16 @@ subalignment_function_double gv_subalignment_functions_double[SUBALIGNMENT_FUNCT

int gv_align_alphabet_size = 2;
int gv_seed_alphabet_size = 2;
vector< double > gv_bsel_weight;
vector< int > gv_signature;
std::vector<double> gv_bsel_weight;
std::vector<int> gv_signature;
bool gv_signature_flag = false;
bool gv_signature_shuffle_from_m_pattern_flag = false;
double gv_bsel_minprob,gv_bsel_maxprob;
int gv_minspan = 1, gv_maxspan = 16;
double gv_minweight = -1e32, gv_maxweight = 1e32;
bool gv_weight_interval_flag = false;
bool gv_lossless_flag = false;
vector<int> gv_lossless_costs_vector;
std::vector<int> gv_lossless_costs_vector;
int gv_lossless_cost_threshold = 0;
char * gv_bsymbols_array = NULL;
bool gv_bsymbols_flag = false;
Expand Down
10 changes: 5 additions & 5 deletions src/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ extern int gv_subalignment_function_index;
/// number of functions proposed in the "subalignment" computation
#define SUBALIGNMENT_FUNCTIONS_NUMBER 4
/// type of the int functions proposed in the "subalignment" computation
typedef double (*subalignment_function_int)(vector<int> &);
typedef double (*subalignment_function_int)(std::vector<int> &);
/// vector of int functions proposed in the "subalignment" computation, see @ref gv_subalignment_functions_names for their names
extern subalignment_function_int gv_subalignment_functions_int[SUBALIGNMENT_FUNCTIONS_NUMBER];
/// type of the double functions proposed in the "subalignment" computation
typedef double (*subalignment_function_double)(vector<double> &);
typedef double (*subalignment_function_double)(std::vector<double> &);
/// vector of double functions proposed in the "subalignment" computation, see @ref gv_subalignment_functions_names for their names
extern subalignment_function_double gv_subalignment_functions_double[SUBALIGNMENT_FUNCTIONS_NUMBER];
/// names of the functions proposed in the "subalignment" computation, see @ref gv_subalignment_functions_int and @ref gv_subalignment_functions_double for their respective implementation
Expand Down Expand Up @@ -116,7 +116,7 @@ extern int gv_verbose;
/// number of seed runs (0 when full enumeration of all possible seeds)
extern int gv_nbruns;
/// signature vector (number of seed letters per seed)
extern vector<int> gv_signature;
extern std::vector<int> gv_signature;
/// signature flag that enable the signature selection @see gv_signature
extern bool gv_signature_flag;
/// signature shuffle flag that enable only shuffle from the -m pattern and is not compatible with signature @see gv_signature_flag
Expand Down Expand Up @@ -162,7 +162,7 @@ extern double gv_bsel_minprob;
/// max seed letter selectivity for the seed alphabet
extern double gv_bsel_maxprob;
/// weight as @f$\frac{ \log(\mathrm{seed\ letter\ selectivity})}{log (max (\mathrm{seed\ letter\ selectivity}))}@f$ for each seed letter
extern vector<double> gv_bsel_weight;
extern std::vector<double> gv_bsel_weight;
/// computer the weight (gv_bsel_weight) according to background probabilities (gv_bsel)
extern void computeWeight();
// @}
Expand All @@ -174,7 +174,7 @@ extern void computeWeight();
/// flag that activates lossless computation (default lossy computation)
extern bool gv_lossless_flag;
/// the lossless cost for A when lossless flag is activated @see gv_lossless_flag,gv_lossless_cost_threshold
extern vector<int> gv_lossless_costs_vector;
extern std::vector<int> gv_lossless_costs_vector;
/// lossless cost for an alignment (must be at most equal to this value) @see gv_lossless_costs_vector
extern int gv_lossless_cost_threshold;
// @}
Expand Down
Loading

0 comments on commit 4aac196

Please sign in to comment.