IsoSpec  1.95
operators.cpp
1 /*
2  * Copyright (C) 2015-2018 Mateusz Łącki and Michał Startek.
3  *
4  * This file is part of IsoSpec.
5  *
6  * IsoSpec is free software: you can redistribute it and/or modify
7  * it under the terms of the Simplified ("2-clause") BSD licence.
8  *
9  * IsoSpec is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * You should have received a copy of the Simplified BSD Licence
14  * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15  */
16 
17 #include "operators.h"
18 #include "marginalTrek++.h"
19 
20 namespace IsoSpec
21 {
22 
23 KeyHasher::KeyHasher(int _dim)
24 : dim(_dim)
25 {}
26 
27 ConfEqual::ConfEqual(int dim)
28 : size( dim*sizeof(int) )
29 {}
30 
31 ConfOrderMarginal::ConfOrderMarginal(const double* _logProbs, int _dim)
32 : logProbs(_logProbs), dim(_dim)
33 {}
34 
35 ConfOrderMarginalDescending::ConfOrderMarginalDescending(const double* _logProbs, int _dim)
36 : logProbs(_logProbs), dim(_dim)
37 {}
38 
39 
40 OrderMarginalsBySizeDecresing::OrderMarginalsBySizeDecresing(PrecalculatedMarginal const* const * const _T) : T(_T) {}
41 
42 bool OrderMarginalsBySizeDecresing::operator()(int m1, int m2)
43 {
44  return T[m1]->get_no_confs() > T[m2]->get_no_confs();
45 }
46 
47 
48 } // namespace IsoSpec
49 
unsigned int get_no_confs() const
Get the number of precomputed subisotopologues.