11 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
25 OPENSWATHALGO_DLLAPI
void normalize(
const std::vector<double>& intensities,
double normalization_factor, std::vector<double>& normalized_intensities);
34 for (; beg != end; ++beg)
45 template <
typename Texp,
typename Ttheo>
46 double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
48 std::vector<double> res(std::distance(intExpBeg, intExpEnd));
49 std::transform(intExpBeg, intExpEnd, intTheo, res.begin(), std::multiplies<double>());
50 double sum = std::accumulate(res.begin(), res.end(), 0.);
61 OPENSWATHALGO_DLLAPI
double dotprodScoring(std::vector<double> intExp, std::vector<double> theorint);
66 template <
typename Texp,
typename Ttheo>
70 for (std::size_t i = 0; itExpBeg < itExpEnd; ++itExpBeg, ++itTheo, ++i)
72 double x = *itExpBeg - *itTheo;
86 OPENSWATHALGO_DLLAPI
double manhattanScoring(std::vector<double> intExp, std::vector<double> theorint);
92 template <
typename TInputIterator,
typename TInputIteratorY>
93 typename std::iterator_traits<TInputIterator>::value_type
cor_pearson(
99 typedef typename std::iterator_traits<TInputIterator>::value_type value_type;
103 m1 = m2 = s1 = s2 = 0.0;
105 ptrdiff_t n = std::distance(xBeg, xEnd);
106 value_type nd =
static_cast<value_type
>(n);
107 for (; xBeg != xEnd; ++xBeg, ++yBeg)
109 corr += *xBeg * *yBeg;
120 if (s1 < 1.0e-12 || s2 < 1.0e-12)
124 corr -= m1 * m2 * (double)n;
125 corr /= sqrt(s1 * s2);
140 m_(0.0), q_(0.0), c_(0u)
146 double const delta = sample - m_;
148 q_ += delta * (sample - m_);
153 return (c_ > 1u) ? (q_ / (c_ - 1)) : 0;
158 return (c_ > 1u) ? (q_ / c_) : 0;
163 return std::sqrt(sample_variance());
168 return std::sqrt(standard_variance());
183 return sample_variance();
188 return sample_stddev();
functor to compute the mean and stddev of sequence using the std::foreach algorithm
Definition: StatsHelpers.h:134
double result_type
Definition: StatsHelpers.h:138
mean_and_stddev()
Definition: StatsHelpers.h:139
double standard_stddev() const
Definition: StatsHelpers.h:166
unsigned long c_
Definition: StatsHelpers.h:136
double sample_stddev() const
Definition: StatsHelpers.h:161
double mean() const
Definition: StatsHelpers.h:171
double stddev() const
Definition: StatsHelpers.h:186
double argument_type
Definition: StatsHelpers.h:138
double variance() const
Definition: StatsHelpers.h:181
unsigned long count() const
Definition: StatsHelpers.h:176
double standard_variance() const
Definition: StatsHelpers.h:156
void operator()(double sample)
Definition: StatsHelpers.h:144
double m_
Definition: StatsHelpers.h:135
double operator()() const
Definition: StatsHelpers.h:191
double sample_variance() const
Definition: StatsHelpers.h:151
static double sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:81
double manhattanDist(Texp itExpBeg, Texp itExpEnd, Ttheo itTheo)
compute manhattan distance between Exp and Theo
Definition: StatsHelpers.h:67
OPENSWATHALGO_DLLAPI double dotprodScoring(std::vector< double > intExp, std::vector< double > theorint)
the dot product scoring
OPENSWATHALGO_DLLAPI void normalize(const std::vector< double > &intensities, double normalization_factor, std::vector< double > &normalized_intensities)
Normalize intensities in vector by normalization_factor.
double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
compute dotprod of vectors
Definition: StatsHelpers.h:46
OPENSWATHALGO_DLLAPI double manhattanScoring(std::vector< double > intExp, std::vector< double > theorint)
manhattan scoring
double norm(T beg, T end)
compute the Euclidean norm of the vector
Definition: StatsHelpers.h:31
std::iterator_traits< TInputIterator >::value_type cor_pearson(TInputIterator xBeg, TInputIterator xEnd, TInputIteratorY yBeg)
compute pearson correlation of vector x and y
Definition: StatsHelpers.h:93