forked from magnusolavhelland/CSD-Software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
54 lines (27 loc) · 1.63 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "myStructs.h"
using namespace std;
void allocateMemory(double ***matrix, const int& dim1, const int& dim2, const int& dim3);
// The function allocates memory for a 3D-matrix
void allocateMemory(double **matrix, const int& dim1, const int& dim2);
// The function allocates memory for a 2D-matrix
void freeMemory(double ***matrix, const int& dim1, const int& dim2);
// The function frees the memory used by a 3D-matrix
void freeMemory(double **matrix, const int& dim1);
// The function frees the memory used by a 2D-matrix
bool geneLessThan(const Gene& a, const Gene& b);
bool geneCompare(const Gene& a, const Gene& b);
// The function is used by the built in sort-function in the "algorithms"-library to compare
// data-structures of type "Gene" by their "geneID" member variable.
bool indexCompare(const Gene& g1, const Gene& g2);
// The function is used by the built in sort-function in the "algorithms"-library to compare
// data-structures of type "Gene" by their "index" member variable.
bool sortedPosCompare(const Gene& a, const Gene& b);
int numberOfCombinations(const int& numberOfFiles);
// The function returns the number of different ways to combine a group of n objects into
// pairs, where draw order is not taken into account.
int invNumberOfCombinations(int m);
// The function takes in the number of different ways of pairing an integer number of objects,
// and returns the number of objects.
void quickSortGenes(vector<Gene>& A, int p, int r, bool (*compare)(const Gene&, const Gene&));
int partitionGenes(vector<Gene>& A, int p, int r, bool (*compare)(const Gene&, const Gene&));
void geneSwap(Gene& a, Gene& b);