keyword
stringclasses
7 values
repo_name
stringlengths
8
98
file_path
stringlengths
4
244
file_extension
stringclasses
29 values
file_size
int64
0
84.1M
line_count
int64
0
1.6M
content
stringlengths
1
84.1M
language
stringclasses
14 values
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Convolution/fft_convolve.hpp
.hpp
3,854
117
#ifndef _FFT_CONVOLVE_HPP #define _FFT_CONVOLVE_HPP #include "naive_convolve.hpp" #include "../FFT/FFT.hpp" inline unsigned char log2_ceiling(unsigned long len){ return (unsigned char)ceil(log2(len)); }; inline unsigned long power_of_2_ceiling(unsigned long len){ return 1ul<<log2_ceiling(len); }; inline Tensor<...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/BitReversal.hpp
.hpp
6,822
132
#ifndef _BITREVERSAL_HPP #define _BITREVERSAL_HPP template <unsigned char LOG_N> class BitReversal { protected: static const unsigned char reversed_byte_table[256]; inline static int fast_log2(unsigned int i) { // Note: This is left in for reference, but it can be performed // more generally (i.e., LOG_N>...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/StockhamShuffle.hpp
.hpp
1,068
36
#ifndef _STOCKHAMSHUFFLE_HPP #define _STOCKHAMSHUFFLE_HPP #include <algorithm> #include "BitReversal.hpp" #include "RecursiveShuffle.hpp" #include "../Tensor/Tensor.hpp" template<typename T, unsigned char LOG_N> class StockhamShuffle { public: inline static void apply_with_existing_buffer(T* __restrict const v, T* ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/LocalPairwiseShuffle.hpp
.hpp
1,645
50
#ifndef _LOCALPAIRWISESHUFFLE_HPP #define _LOCALPAIRWISESHUFFLE_HPP #include <algorithm> // From Jośe M. Ṕerez-Jord́a1 1997 template<typename T, unsigned char LOG_N, unsigned char LOG_SUB_N> class LocalPairwiseShuffleHelper { public: inline static void apply(T* __restrict const v) { constexpr unsigned long SU...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/RecursiveShuffle.hpp
.hpp
5,457
192
#ifndef _RECURSIVESHUFFLE_HPP #define _RECURSIVESHUFFLE_HPP #include "UnrolledShuffle.hpp" #include "../Tensor/Tensor.hpp" template <typename T, unsigned char LOG_WIDTH, unsigned char LOG_SUB_WIDTH, unsigned long R, unsigned long C> class LogSquareTranspose { public: static void apply(T* __restrict x) { constex...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/TableShuffle.hpp
.hpp
561
25
#ifndef _TABLESHUFFLE_HPP #define _TABLESHUFFLE_HPP #include <algorithm> #include "BitReversal.hpp" template<typename T, unsigned char LOG_N> class TableShuffle { public: inline static void apply(T* __restrict const v) { constexpr unsigned long N = 1ul << LOG_N; for (unsigned long index=1; index<(N-1); ++i...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/UnrolledShuffle.hpp
.hpp
5,072
144
#ifndef _UNROLLEDSHUFFLE_HPP #define _UNROLLEDSHUFFLE_HPP #include <algorithm> // Tools for performing compile-time-optimized bit // reversal. Substantially faster than other methods, but it requires // much larger compilation times for large problems (10 bits <--> // N=2^10 requires roughly 2s to compile). // Note ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/NaiveShuffle.hpp
.hpp
564
25
#ifndef _NAIVESHUFFLE_HPP #define _NAIVESHUFFLE_HPP #include <algorithm> #include "BitReversal.hpp" template<typename T, unsigned char LOG_N> class NaiveShuffle { public: inline static void apply(T* __restrict const v) { constexpr unsigned long int N = 1ul << LOG_N; for (unsigned long index=1; index<(N-1);...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/XORShuffle.hpp
.hpp
574
25
#ifndef _XORSHUFFLE_HPP #define _XORSHUFFLE_HPP #include <algorithm> #include "BitReversal.hpp" template<typename T, unsigned char LOG_N> class XORShuffle { public: inline static void apply(T* __restrict const v) { constexpr unsigned long N = 1ul << LOG_N; unsigned long reversed = 0; for (unsigned long...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/SemiRecursiveShuffle.hpp
.hpp
5,227
205
#ifndef _SEMIRECURSIVESHUFFLE_HPP #define _SEMIRECURSIVESHUFFLE_HPP #include "RecursiveShuffle.hpp" // Identical to RecursiveShuffle but limits the number of recursions // to 1. Therefore, it will compile longer, but can be slightly faster // (empirically tested, reason unclear). template <typename T, unsigned char N...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/BitReversedShuffle/COBRAShuffle.hpp
.hpp
4,055
104
#ifndef _COBRASHUFFLE_HPP #define _COBRASHUFFLE_HPP #include <algorithm> #include "BitReversal.hpp" #include "../Tensor/Tensor.hpp" // From Carter and Gatlin 1998 template<typename T, unsigned char LOG_N, unsigned char LOG_BLOCK_WIDTH> class COBRAShuffle { public: inline static void apply(T* __restrict const v) { ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/VectorArithmetic.hpp
.hpp
6,673
185
#ifndef _VECTORARITHMETIC_HPP #define _VECTORARITHMETIC_HPP #include "VectorTRIOT.hpp" template <typename T> class Vector; template <typename T> class VectorView; // +=, -=, ... with & lhs: template <typename S, typename T, template <typename> class VECTOR_A, template <typename> class VECTOR_B> const WritableVector...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/TemplateSearch.hpp
.hpp
1,612
44
#ifndef _TEMPLATESEARCH_HPP #define _TEMPLATESEARCH_HPP #include <assert.h> #include <utility> typedef unsigned char TEMPLATE_SEARCH_INT_TYPE; // For dynamically looking up a class and calling the static // function apply(...). This can be preferred to LogSearch when you // are amortizing the cost of lookoup. For in...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/TensorLike.hpp
.hpp
4,028
115
#ifndef _TENSORLIKE_HPP #define _TENSORLIKE_HPP template <typename T> class TensorView; template <typename T> class WritableTensorView; // Never instantiate these; always pass by reference & or &&: template <typename T, template <typename> class TENSOR > class TensorLike { public: unsigned char dimension() const ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/product.hpp
.hpp
415
19
#ifndef _PRODUCT_HPP #define _PRODUCT_HPP template <typename T> inline unsigned long product(const T* __restrict const v, unsigned long length) { T res = 1ul; for (unsigned long k=0; k<length; ++k) res *= v[k]; return res; } template <typename T, template <typename> class VECTOR> inline T product(const Vect...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/any_all.hpp
.hpp
437
21
#ifndef _ANY_ALL_HPP #define _ANY_ALL_HPP template <template <typename> class VECTOR> bool any(const VectorLike<bool, VECTOR> & rhs) { for (unsigned long k=0; k<rhs.size(); ++k) if (rhs[k]) return true; return false; } template <template <typename> class VECTOR> bool all(const VectorLike<bool, VECTOR> &...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/embed.hpp
.hpp
713
26
#ifndef _EMBED_HPP #define _EMBED_HPP template <typename T> class Tensor; template <typename S, typename T, template <typename> class TENSOR_A, template <typename> class TENSOR_B> void embed(WritableTensorLike<S, TENSOR_A> & dest, const TensorLike<T, TENSOR_B> & source) { #ifdef SHAPE_CHECK assert( dest.view_shap...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/alloc.hpp
.hpp
1,329
52
#ifndef _ALLOC_HPP #define _ALLOC_HPP //#include <stdlib.h> //#include <stdio.h> #include <string.h> #include <assert.h> #ifdef _MSC_VER #include <malloc.h> #define alloca _alloca #else #include <alloca.h> #endif // Note: benefits from being tuned for specific architecture. Could do this with #ifdef...s for AVX512...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/min_max.hpp
.hpp
610
31
#ifndef _MIN_MAX_HPP #define _MIN_MAX_HPP template <typename T, template <typename> class VECTOR> T min(const VectorLike<T, VECTOR> & rhs) { #ifdef SHAPE_CHECK assert(rhs.size() > 0); #endif T res = rhs[0]; for (unsigned long k=1; k<rhs.size(); ++k) if (res > rhs[k]) res = rhs[k]; return res; ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/Vector.hpp
.hpp
6,471
248
#ifndef _VECTOR_HPP #define _VECTOR_HPP #include <iostream> #include <vector> #include "alloc.hpp" #include "VectorLike.hpp" #include "VectorView.hpp" #include "VectorArithmetic.hpp" #include "VectorComparison.hpp" #include "min_max.hpp" #include "p_norm.hpp" #include "any_all.hpp" // Note: Vector<T> is for simple ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/VectorComparison.hpp
.hpp
3,818
116
#ifndef _VECTORCOMPARISON_HPP #define _VECTORCOMPARISON_HPP // Note: Vector comparison is currently performed overall rather than // element-wise. This could be changed by having every function return // a Vector<bool>, which could be used with any(...) and all(...) // functions, which would aggregate. The downside of...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/TensorView.hpp
.hpp
8,144
236
#ifndef _TENSORVIEW_HPP #define _TENSORVIEW_HPP template <typename T> class Tensor; // Note: TensorView types are for local, temporary use only (e.g., // to allow TRIOT expressions that do not start at the same tuple // indices). But they should not be stored long term; the tensor // pointer may change, so long-term ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/Tensor.hpp
.hpp
11,030
302
#ifndef _TENSOR_HPP #define _TENSOR_HPP // #include this file to import Vector, Tensor, TRIOT, and everything // else from this subdirectory. #include <cmath> #include "Vector.hpp" #include "TensorUtils.hpp" #include "TensorLike.hpp" #include "TensorView.hpp" #include "TRIOT.hpp" #include "transpose.hpp" #include "em...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/p_norm.hpp
.hpp
394
20
#ifndef _P_NORM_HPP #define _P_NORM_HPP template <typename T, template <typename> class VECTOR> T p_norm(const VectorLike<T, VECTOR> & rhs, T p) { #ifdef SHAPE_CHECK assert(rhs.size() > 0); #endif T max_val = max(rhs); T res = pow((rhs[0]/max_val), p); for (unsigned long k=1; k<rhs.size(); ++k) res ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/VectorLike.hpp
.hpp
2,682
86
#ifndef _VECTORLIKE_HPP #define _VECTORLIKE_HPP template <typename T> class VectorView; template <typename T> class WritableVectorView; // Never instantiate these; always pass by reference & or &&: template <typename T, template <typename> class VECTOR > class VectorLike { public: unsigned long size() const { ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/transpose.hpp
.hpp
6,102
168
#ifndef _TRANSPOSE_HPP #define _TRANSPOSE_HPP #include "MatrixTranspose.hpp" template <typename T> class Tensor; // Empirically chosen: const unsigned long SIZE_WHERE_NAIVE_TRANSPOSE_BECOMES_SLOWER = 8; template <typename T> inline Tensor<T> naive_transposed(const Tensor<T> & ten, const Vector<unsigned char> & new_...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/TRIOT.hpp
.hpp
9,718
231
#ifndef _TRIOT_HPP #define _TRIOT_HPP #include "TemplateSearch.hpp" #include "TensorUtils.hpp" // TODO: Can a namespace casing like this improve compilation time // by restricting lookup of template classes within this // namespace? // TODO: Would explicit template arguments enable faster compilation? namespace TRIO...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/MatrixTranspose.hpp
.hpp
4,391
115
#ifndef _MATRIXTRANSPOSE_HPP #define _MATRIXTRANSPOSE_HPP #include <algorithm> // Note: This code is a good candidate to perform on a GPU. // Implements cache-oblivious strategy for transposition. In cases // where recursion can simply be unrolled into a loop (e.g., tall, // thin matrix or short, wide matrix) it is ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/ArrayShape.hpp
.hpp
624
23
#ifndef _ARRAYSHAPE_HPP #define _ARRAYSHAPE_HPP // Used to expand the shape of an array into a variadic template pack // at compile time. This particular version puts the shape into a // Vector. template <typename T, typename ARR, unsigned long ...SHAPE> struct ArrayShape { static Vector<unsigned long> eval(ARR arg...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/VectorTRIOT.hpp
.hpp
1,643
50
#ifndef _VECTORTRIOT_HPP #define _VECTORTRIOT_HPP template <typename ...VECTORS> #ifndef SHAPE_CHECK void check_vector_pack_lengths(const VECTORS&... /*args*/, unsigned long /*length*/) {} #else void check_vector_pack_lengths(const VECTORS&... args, unsigned long length) { unsigned long sizes[] = { args.size()... };...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/TensorUtils.hpp
.hpp
3,469
116
#ifndef _TENSOR_UTILS_HPP #define _TENSOR_UTILS_HPP #include <vector> #include "product.hpp" #include "sum.hpp" #include "Vector.hpp" #ifndef MAX_TENSOR_DIMENSION #define MAX_TENSOR_DIMENSION 12 #endif // Tuple types: typedef unsigned long* __restrict const tup_t; typedef const unsigned long* __restrict const const...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/VectorView.hpp
.hpp
3,346
131
#ifndef _VECTORVIEW_HPP #define _VECTORVIEW_HPP template <typename T> class Vector; template <typename T> class VectorView : public VectorLike<T, VectorView> { protected: const Vector<T> & _vec_ref; const unsigned long _start; const unsigned long _length; public: explicit VectorView(const Vector<T> & vec, un...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Tensor/sum.hpp
.hpp
381
19
#ifndef _SUM_HPP #define _SUM_HPP template <typename T> inline T sum(const T* __restrict const v, unsigned long length) { T res = 0; for (unsigned long k=0; k<length; ++k) res += v[k]; return res; } template <typename T, template <typename> class VECTOR> inline T sum(const VectorLike<T, VECTOR> & v) { ret...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/1-convolution/numpy_benchmark.py
.py
397
23
import numpy as np from scipy.signal import fftconvolve from time import time import sys def main(argv): if len(argv) != 1: print 'Usage: numpy_benchmark.py <LOG_N>' return; log_n = int(argv[0]) n = 2**log_n x=np.arange(n)*(1+1j) y=np.arange(n)*(-1-1j) t1=time() z = fftcon...
Python
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/1-convolution/fft_benchmark.cpp
.cpp
660
31
#include <iostream> #include <cstring> #include "../../Utility/Clock.hpp" #include "../../Convolution/p_convolve.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: fft_conv_benchmark <LOG_N>" << std::endl; return 1; } int log_n = atoi(argv[1]); unsigned long n = 1ul<<log_n; ...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/1-convolution/naive_benchmark.cpp
.cpp
658
31
#include <iostream> #include <cstring> #include "../../Utility/Clock.hpp" #include "../../Convolution/p_convolve.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: conv_benchmark <LOG_N>" << std::endl; return 1; } int log_n = atoi(argv[1]); unsigned long n = 1ul<<log_n; // A...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/1-convolution/fftw_benchmark.cpp
.cpp
2,701
120
#include <iostream> #include <cstring> #include "fftw3.h" #include "../../Utility/Clock.hpp" fftw_complex* convolve(fftw_complex*x, fftw_complex*y, int n) { // Buffers: fftw_complex *input = (fftw_complex*)fftw_malloc(2*n*sizeof(fftw_complex)); fftw_complex *output = (fftw_complex*)fftw_malloc(2*n*sizeof(fftw_co...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/fft/numpy_benchmark.py
.py
347
23
import numpy as np from time import time import sys def main(argv): if len(argv) != 1: print 'Usage: numpy_benchmark.py <LOG_N>' return; logN = int(argv[0]) N = 2**logN x=np.arange(N)*(1+1j) t1=time() y=np.fft.fftn(x) t2=time() print N, t2-t1 if __name__ == '__main__...
Python
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/fft/fftw_estimate_benchmark.cpp
.cpp
1,032
41
#include <iostream> #include <cstring> #include "fftw3.h" #include "../../Utility/Clock.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: fftw_benchmark <LOG_N>" << std::endl; return 1; } int log_n = atoi(argv[1]); int n = 1<<log_n; // To avoid allocating buffers, use exist...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/fft/fft_benchmark.cpp
.cpp
713
29
#include <iostream> #include "../../FFT/FFT.hpp" #include "../../Utility/Clock.hpp" Clock c; int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: fft_benchmark <LOG_N>" << std::endl; return 1; } int log_n = atoi(argv[1]); unsigned long n = 1ul<<log_n; Tensor<cpx> x({n}); for (un...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/fft/fftw_measure_benchmark.cpp
.cpp
1,374
60
#include <iostream> #include <cstring> #include "fftw3.h" #include "../../Utility/Clock.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: fftw_benchmark <LOG_N>" << std::endl; return 1; } int log_n = atoi(argv[1]); int n = 1<<log_n; // Actual inputs: fftw_complex*x = new ...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/binary-additive/main.cpp
.cpp
1,340
40
#include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cerr << "Usage: binary_tree <LOG_N>" << std::endl; exit(1); } int log_n = atoi(argv[1]); const double p=std::numeric_limits<double>::infinity(); BetheInfe...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/PeptideSolver.hpp
.hpp
4,806
116
#ifndef _PEPTIESOLVER_HPP #define _PEPTIESOLVER_HPP #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" #include "../../Utility/Clock.hpp" #include "Peptide.hpp" #include "../../Utility/graph_to_dot.hpp" class PeptideSolver { private: Scheduler<std::string> & _sched; Infer...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/Peptide.hpp
.hpp
3,175
105
#ifndef _Peptide_HPP #define _Peptide_HPP #include <string> #include <set> #include <iostream> #include <vector> #include <map> #include <assert.h> class Peptide { protected: std::string _amino_acids; double _mass; double _hydrophobicity; void verify_valid_characters() { std::set<char> amino_set(_amino_...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/estimate_amino_acids_hydro.cpp
.cpp
646
22
#include "HydrophobicityPeptideSolver.hpp" int main(int argc, char**argv) { if (argc != 5) { std::cout << "Usage: hydro_pep_solver <observed hydrophobicity> <hydrophobicity discretization> <maximum peptide length> <p>" << std::endl; exit(1); } double hydrophobicity = atof(argv[1]); double hydrophobi...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/estimate_amino_acids.cpp
.cpp
755
25
#include "PeptideSolver.hpp" int main(int argc, char**argv) { if (argc != 7) { std::cout << "Usage: pep_solver <observed mass> <observed hydrophobicity> <mass discretization> <hydrophobicity discretization> <maximum peptide length> <p>" << std::endl; exit(1); } double mass = atof(argv[1]); double hy...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/peptide_to_mass_and_hydrophibicity.cpp
.cpp
290
15
#include "Peptide.hpp" int main(int argc, char**argv) { if (argc != 2) { std::cout << "Usage: <peptide sequence>" << std::endl; exit(1); } std::string seq = argv[1]; Peptide pep(seq); std::cout << pep.mass() << " " << pep.hydrophobicity() << std::endl; return 0; }
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/estimate_amino_acids_mass.cpp
.cpp
565
22
#include "MassPeptideSolver.hpp" int main(int argc, char**argv) { if (argc != 5) { std::cout << "Usage: mass_pep_solver <observed mass> <mass discretization> <maximum peptide length> <p>" << std::endl; exit(1); } double mass = atof(argv[1]); double mass_discretization = atof(argv[2]); unsigned lo...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/MassPeptideSolver.hpp
.hpp
3,289
97
#ifndef _MASSPEPTIDESOLVER_HPP #define _MASSPEPTIDESOLVER_HPP #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" #include "../../Utility/Clock.hpp" #include "Peptide.hpp" #include "../../Utility/graph_to_dot.hpp" class MassPeptideSolver { private: Scheduler<std::string> & _...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/peptide-decomposition/HydrophobicityPeptideSolver.hpp
.hpp
3,472
96
#ifndef _HYDROPHOBICITYPEPTIDESOLVER_HPP #define _HYDROPHOBICITYPEPTIDESOLVER_HPP #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" #include "../../Utility/Clock.hpp" #include "Peptide.hpp" #include "../../Utility/graph_to_dot.hpp" class HydrophobicityPeptideSolver { private...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/gc-rich-hmm/HMMScheduler.hpp
.hpp
1,234
38
#ifndef _HMMSCHEDULER_HPP #define _HMMSCHEDULER_HPP // A small, custom-made scheduler for HMMs. HMM should be constructed // manually (without hyperedge types that would be produced by // BetheGraphBuilder). #include "../../Evergreen/evergreen.hpp" template <typename VARIABLE_KEY> class HMMScheduler : public FIFOSch...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/gc-rich-hmm/HMM.hpp
.hpp
4,188
132
#ifndef _ISOTOPESOLVER_HPP #define _ISOTOPESOLVER_HPP #include "../../Evergreen/evergreen.hpp" #include "../../Utility/Clock.hpp" class HMM { private: PMF _prior; PMF _transition; PMF _emission; // std::vector<unsigned long> _hidden_variables; // std::vector<unsigned long> _observed_variables; std::vect...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/gc-rich-hmm/main.cpp
.cpp
1,842
53
#include <fstream> #include <iostream> #include "../../Evergreen/evergreen.hpp" #include "HMM.hpp" #include "HMMScheduler.hpp" const double p = std::numeric_limits<double>::infinity(); // constant for p-norm approximation std::string load_sequence(std::string file) { std::ifstream myfile(file); assert(myfile.i...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/brute-force-vs-loopy/main.cpp
.cpp
1,568
41
#include <string> #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" const double p = 16.0; void brute_force(const std::vector<TableDependency<std::string> > & deps, const std::vector<std::vector<std::string> > & vars) { BruteForceInferenceEngine<std::string> bf(deps,p); est...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/isotope-quantification/IsotopeQuantifier.hpp
.hpp
12,230
293
#ifndef _ISOTOPEQUANTIFIER_HPP #define _ISOTOPEQUANTIFIER_HPP #include <string> #include <sstream> #include <fstream> #include <iostream> #include "../../Evergreen/evergreen.hpp" #include "Elements.hpp" #include "../../Utility/inference_utilities.hpp" #include "../../Utility/to_string.hpp" #include "../../Utility/Cl...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/isotope-quantification/isotope_quantifier.cpp
.cpp
1,611
45
#include "IsotopeQuantifier.hpp" const Elements elements("element_isotope_list.txt"); void print_usage() { std::cerr << "Usage: isotope_quant <peak tsv filename> <intensity discretization> <intensity Gaussian std. dev> <maximum number copies for element> {missing, no_missing} <p> [maximum number of unique elements]...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/isotope-quantification/Elements.hpp
.hpp
2,069
85
#ifndef _Elements_HPP #define _Elements_HPP struct Isotope { std::string name; double mass; double abundance; }; // To enable std::set<Isotope> bool operator <(const Isotope & lhs, const Isotope & rhs) { return lhs.name < rhs.name || (lhs.name == rhs.name && lhs.mass < rhs.mass); } std::ostream & operator<<(...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/isotope-quantification/formula_to_spectrum.cpp
.cpp
1,943
80
#include "IsotopeQuantifier.hpp" const Elements elements("element_isotope_list.txt"); void print_usage() { std::cerr << "Usage:\n"; std::cerr << "\tformula2spectrum discretize_mass=15 Ca=10 [Ar=2 ...]" << std::endl; exit(1); } int main(int argc, char**argv) { if (argc <= 1) print_usage(); double discr...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/p-convolution/create_data_for_max_convolution.py
.py
720
25
import numpy as np from scipy.signal import fftconvolve import pylab as P norm = lambda a : a / float(max(a)) N=4096 padded_N = N+9 i=np.arange(padded_N) x= fftconvolve(np.random.uniform(0.5,1.0,N+9) * ( np.exp( -((i-400)/2500.0)**2 ) + 0.3*np.exp( -((i-padded_N/2.0)/100.0)**2 ) + 0.7*np.exp( -((i-padded_N)/400.0)**2...
Python
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/p-convolution/max_convolution.cpp
.cpp
768
37
#include <iostream> #include <fstream> #include "../../Convolution/p_convolve.hpp" #include "../../Utility/Clock.hpp" Clock c; int main(int argc, char**argv) { if (argc != 2) { std::cerr << "usage: max_conv <filename with n and x and y>" << std::endl; exit(1); } std::cout.precision(100); std::ifstre...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/p-convolution/naive_vs_numeric_max_convolution_benchmark.cpp
.cpp
979
42
#include <iostream> #include "../../Convolution/p_convolve.hpp" #include "../../Utility/Clock.hpp" Clock c; void init_data(Tensor<double> & x, Tensor<double> & y) { unsigned long k; for (k=0; k<x.flat_size(); ++k) x[k] = exp( - (k - 128.0)*(k - 128.0) / (100.0*100.0) ); for (k=0; k<y.flat_size(); ++k) y...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/restaurant-bill/disable_trimming.cpp
.cpp
49
5
#define DISABLE_TRIM #include "big_dipper.cpp"
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/restaurant-bill/big_dipper.cpp
.cpp
4,002
123
#include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" #include <fstream> class BigDipperIceCream { private: static std::set<double> load_prices(const std::string & menu_filename) { std::set<double> result; std::ifstream fin(menu_filename); std::string item_name; ...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/brute-force/prisoners_dilemma.cpp
.cpp
1,338
40
#include <string> #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" // A simple demo of brute force inference // Problem explained in // https://en.wikipedia.org/wiki/Prisoner's_dilemma int main() { const double p = 2.0; ////////////////////////////////// ///// Construct...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/demos/simple-additive-2d/main.cpp
.cpp
5,093
114
#include <fstream> #include "../../Evergreen/evergreen.hpp" #include "../../Utility/inference_utilities.hpp" #include "../../Utility/graph_to_dot.hpp" const double p=16; void solve_1d_bethe(const std::vector<LabeledPMF<std::string> > & inputs, const LabeledPMF<std::string> & output, const std::vector<std::vector<std...
C++
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/TensorLang.hpp
.hpp
106
5
typedef struct TensorLangT { std::vector<double> flat_vector; std::vector<long> shape; } TensorLang;
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/PrintBlock.hpp
.hpp
90
4
typedef struct PrintBlockT { std::vector<std::vector<std::string> > vars; } PrintBlock;
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/LangDigraph.hpp
.hpp
1,842
55
#ifndef _LANGGRAPH_HPP #define _LANGGRAPH_HPP #include <unordered_map> #include <map> #include "FrozenSet.hpp" template <typename NODE> class LangGraph { private: std::unordered_map<NODE, FrozenSet<NODE> > node_to_edges; public: void insert_edge(const NODE & u, const std::set<NODE> & v) { FrozenSet<std::str...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/LoopyLangEngine.hpp
.hpp
1,338
39
#ifndef _LOOPYLANGENGINE_HPP #define _LOOPYLANGENGINE_HPP #include "LangEngine.hpp" typedef struct LoopyLangEngineT : public LangEngineT { void build(std::vector<std::vector<Dependency<std::string>* > > dependencies_of_subgraphs, double dampening, double epsilon, long max_iter) { for(InferenceGraph<std::string>...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/InferenceEnginesBuilder.hpp
.hpp
3,610
101
#ifndef _INFERENCEENGINESBUILDER_HPP #define _INFERENCEENGINESBUILDER_HPP #include <string> #include "../Evergreen/evergreen.hpp" class InferenceEnginesBuilder { public: virtual std::vector<InferenceEngine<std::string>* > build_engines(const std::vector<std::vector<Dependency<std::string>*> > & deps) = 0; virtual...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/IntTuple.hpp
.hpp
65
4
typedef struct IntTupleT { std::vector<long> ints; } IntTuple;
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/BruteForceLangEngine.hpp
.hpp
2,109
53
#ifndef _BRUTEFORCELANGENGINE_HPP #define _BRUTEFORCELANGENGINE_HPP #include "LangEngine.hpp" typedef struct BruteForceLangEngineT : public LangEngineT { void build(const std::vector<std::vector<Dependency<std::string>* > > & dependencies_of_subgraphs, double dampening, double epsilon, long max_iter) { fo...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/VarTuple.hpp
.hpp
72
4
typedef struct VarTupleT { std::vector<std::string> vars; } VarTuple;
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/LangEngine.hpp
.hpp
8,396
187
#ifndef _LANGENGINE_HPP #define _LANGENGINE_HPP #include "InferenceEnginesBuilder.hpp" #include "LangDigraph.hpp" #include <unordered_map> #include <fstream> #include "../Utility/graph_to_dot.hpp" typedef struct LangEngineT { LangGraph<std::string> graph; InferenceEnginesBuilder*ieb_ptr; std::unordered_map<...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/Additive.hpp
.hpp
142
5
typedef struct AdditiveT { std::vector<std::vector<std::string>> plus_vars; std::vector<std::vector<std::string>> minus_vars; } Additive;
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/FrozenSet.hpp
.hpp
1,322
57
#ifndef _FROZENSET_HPP #define _FROZENSET_HPP // From Python's frozenset class: // See: https://stackoverflow.com/questions/20832279/python-frozenset-hashing-algorithm-implementation template <typename K> struct SetFrozenHash { std::size_t operator() (const std::set<K> & s) const { std::hash<K> single_hash; ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Language/from_string.hpp
.hpp
223
15
#ifndef _FROM_STRING_HPP #define _FROM_STRING_HPP #include <sstream> #include <string> double from_string(const std::string & s) { std::istringstream ist(s); double result; ist >> result; return result; } #endif
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/squared.hpp
.hpp
101
9
#ifndef _SQUARED_HPP #define _SQUARED_HPP inline double squared(double x) { return x*x; } #endif
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/LabeledPMF.hpp
.hpp
16,412
437
#ifndef _LABELEDPMF_H #define _LABELEDPMF_H #include <unordered_map> #include <vector> #include "PMF.hpp" #include "semi_outer_product_and_quotient.hpp" #include "divergence.hpp" #include "dampen.hpp" template <typename VARIABLE_KEY> class LabeledPMF { protected: std::vector<VARIABLE_KEY> _ordered_variables; std...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/scaled_pmf.hpp
.hpp
2,235
60
#ifndef _SCALED_PMF_HPP #define _SCALED_PMF_HPP #include "squared.hpp" // Note: could be sped up to not make local Vector objects and to not // use tuple indexing (using integer offset): inline void add_scaled_outcome(Tensor<double> & ten, const Vector<long> & new_first_support, const Vector<double> & scaled_tup, dou...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/nonzero_bounding_box.hpp
.hpp
1,172
30
#ifndef _NONZERO_BOUNDING_BOX_HPP #define _NONZERO_BOUNDING_BOX_HPP inline std::array<Vector<unsigned long>, 2> nonzero_bounding_box(const Tensor<double> & rhs, const double relative_mass_threshold_for_bounding_box) { // Initialize min with value greater than maximum possible, and // initialize max with minimum po...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/dampen.hpp
.hpp
2,180
60
#ifndef _DAMPEN_HPP #define _DAMPEN_HPP // For computing a convex combination of two LabeledPMFs (using only the // intersecting support): template <typename VARIABLE_KEY> LabeledPMF<VARIABLE_KEY> dampen(const LabeledPMF<VARIABLE_KEY> & lhs, const LabeledPMF<VARIABLE_KEY> & rhs, double lambda) { #ifdef SHAPE_CHECK ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/scaled_pmf_dither.hpp
.hpp
3,762
92
#ifndef _SCALED_PMF_DITHER_HPP #define _SCALED_PMF_DITHER_HPP #include "squared.hpp" // Note: For performance, it may be beneficial to manually add the // offset and use the Tensor[unsigned long] operator instead; // constructing a tensor view for each function call will construct // a Vector, which may not get optim...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/scaled_pmf_interpolate.hpp
.hpp
3,158
77
#ifndef _SCALED_PMF_INTERPOLATE_HPP #define _SCALED_PMF_INTERPOLATE_HPP #include "squared.hpp" // Note: could be sped up to not make local Vector objects and to not // use tuple indexing (using integer offset): inline void add_scaled_outcome_interpolate(Tensor<double> & ten, const Vector<long> & new_first_support, co...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/scaled_pmf_dither_interpolate.hpp
.hpp
560
16
#ifndef _SCALED_PMF_DITHER_INTERPOLATE_HPP #define _SCALED_PMF_DITHER_INTERPOLATE_HPP #include "scaled_pmf_dither.hpp" inline PMF scaled_pmf_dither_interpolate(const PMF & pmf, const Vector<double> & factor, double sigma_squared) { // TODO: implement more general form that simultaneously dithers and // interpolat...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/marginal.hpp
.hpp
6,055
155
#ifndef _MARGINAL_HPP #define _MARGINAL_HPP // Note: it may be possible to optimize these marginal routines for // rvalue references, directly writing the results to the first // element in each collapsed group, then collapsing values down, and // then shrinking the tensor: // Empirically chosen: const unsigned long...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/divergence.hpp
.hpp
2,268
74
#ifndef _DIVERGENCE_HPP #define _DIVERGENCE_HPP #include "squared.hpp" template <template <typename> class TENSOR_LHS, template <typename> class TENSOR_RHS> double se(const TensorLike<double, TENSOR_LHS> & lhs, const TensorLike<double, TENSOR_RHS> & rhs) { #ifdef SHAPE_CHECK assert( lhs.view_shape() == rhs.view_s...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/PMF.hpp
.hpp
9,881
314
#ifndef _PMF_HPP #define _PMF_HPP #include "../Utility/Clock.hpp" #include "../Convolution/p_convolve.hpp" #include "marginal.hpp" #include "nonzero_bounding_box.hpp" // Forward declarations to allow ostream << PMF in this file. class PMF; std::ostream & operator <<(std::ostream & os, const PMF & rhs); class PMF { p...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/PMF/semi_outer_product_and_quotient.hpp
.hpp
3,713
82
#ifndef _SEMI_OUTER_PRODUCT_AND_QUOTIENT_HPP #define _SEMI_OUTER_PRODUCT_AND_QUOTIENT_HPP // For performing semi_outer_... functions: template <typename FUNCTION, template <typename> class TENSOR> Tensor<double> semi_outer_apply(const TensorLike<double, TENSOR> & lhs, const TensorLike<double, TENSOR> & rhs, const unsi...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/RandomSubtreeScheduler.hpp
.hpp
3,275
91
#ifndef _RANDOMSUBTREESCHEDULER_HPP #define _RANDOMSUBTREESCHEDULER_HPP #include "Scheduler.hpp" #include "random_tree_subgraph.hpp" template <typename VARIABLE_KEY> class RandomSubtreeScheduler : public Scheduler<VARIABLE_KEY> { private: std::list<MessagePasser<VARIABLE_KEY>* > _mp_ordering_1, _mp_ordering_2; st...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/MessagePasser.hpp
.hpp
7,743
207
#ifndef _MESSAGEPASSER_HPP #define _MESSAGEPASSER_HPP #include "Edge.hpp" #include <unordered_set> template <typename VARIABLE_KEY> class ContextFreeMessagePasser; // Interface for message passers in the engine: template <typename VARIABLE_KEY> class MessagePasser { protected: // Note: _edges_in[i] must be the rev...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/ConvolutionTree.hpp
.hpp
14,858
424
#ifndef _CONVOLUTIONTREE_HPP #define _CONVOLUTIONTREE_HPP #include "../PMF/PMF.hpp" #include <limits> // A convolution tree optimized for online processing. Note that the // messages received through a given channel should never grow in // support (otherwise, the cache of possible supports can become // corrupted). T...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/ListQueue.hpp
.hpp
954
46
#ifndef _LISTQUEUE_HPP #define _LISTQUEUE_HPP #include <list> template <typename VARIABLE_KEY> class ListQueue { protected: std::list<Edge<VARIABLE_KEY>* > _next_edges; public: bool is_empty() const { return _next_edges.size() == 0; } std::size_t size() const { return _next_edges.size(); } void p...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/KikuchiGraph.hpp
.hpp
1,300
45
#ifndef _KIKUCHIGRAPH_HPP #define _KIKUCHIGRAPH_HPP template <typename VARIABLE_KEY> class KikuchiGraph { public: // Permits modification of MessagePasser types via pointer, but not // modification of the pointers themselves: const std::vector<MessagePasser<VARIABLE_KEY>* > _message_passers; KikuchiGraph(std:...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/Queueable.hpp
.hpp
328
18
#ifndef _QUEUEABLE_HPP #define _QUEUEABLE_HPP // Mixin to allow pointers of objects to be inserted into queues: struct Queueable { // A member is faster than storing a map to which messages are in // queue in code: double priority; bool in_queue; Queueable(): priority(0.0), in_queue(false) { } }; ...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/Hyperedge.hpp
.hpp
3,799
110
#ifndef _HYPEREDGE_HPP #define _HYPEREDGE_HPP #include "HUGINMessagePasser.hpp" // Like a HUGINMessagePasser, but it is elligible to pass once every // variable along an edge has been received. template <typename VARIABLE_KEY> class Hyperedge : public HUGINMessagePasser<VARIABLE_KEY> { private: std::unordered_set<V...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/FIFOScheduler.hpp
.hpp
2,849
88
#ifndef _FIFOSCHEDULER_HPP #define _FIFOSCHEDULER_HPP #include "ListQueue.hpp" template <typename VARIABLE_KEY> std::ostream & operator <<(std::ostream & os, const std::vector<VARIABLE_KEY> & rhs) { os << "[ "; for (const VARIABLE_KEY & var : rhs) os << var << " "; os << "]"; return os; } template <typen...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/PriorityScheduler.hpp
.hpp
6,113
160
#ifndef _PRIORITYSCHEDULER_HPP #define _PRIORITYSCHEDULER_HPP #include "Scheduler.hpp" #include "SetQueue.hpp" // Note: for some graphs (e.g., trees and HMM-like graphs), the // runtime may be in O(n log(n)) instead of O(n), because of // SetQueue. These graphs will be solved in O(n) with // FIFOScheduler. template <...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/InferenceGraph.hpp
.hpp
6,979
201
#ifndef _INFERENCEGRAPH_HPP #define _INFERENCEGRAPH_HPP #include <unordered_set> #include <list> #include "MessagePasser.hpp" #include "HUGINMessagePasser.hpp" #include "../Utility/shuffled_sequence.hpp" template <typename VARIABLE_KEY> class InferenceGraph { protected: void verify_all_connected_message_passers_inc...
Unknown
3D
OpenMS/OpenMS
src/openms/extern/evergreen/src/Engine/Edge.hpp
.hpp
2,320
93
#ifndef _EDGE_HPP #define _EDGE_HPP #include "Queueable.hpp" #include "../PMF/LabeledPMF.hpp" template <typename VARIABLE_KEY> class MessagePasser; // Note: this is currently hard coded to use MSE-based divergence; it // could be made more general later. template <typename VARIABLE_KEY> class Edge : public Queueable...
Unknown