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);
51 extern template double dotProd<std::vector<double>::const_iterator, std::vector<double>::const_iterator>(
52 std::vector<double>::const_iterator, std::vector<double>::const_iterator, std::vector<double>::const_iterator);
54 extern template double dotProd<std::vector<float>::const_iterator, std::vector<float>::const_iterator>(
55 std::vector<float>::const_iterator, std::vector<float>::const_iterator, std::vector<float>::const_iterator);
57 extern template double dotProd<std::vector<int>::const_iterator, std::vector<int>::const_iterator>(
58 std::vector<int>::const_iterator, std::vector<int>::const_iterator, std::vector<int>::const_iterator);
69 OPENSWATHALGO_DLLAPI
double dotprodScoring(std::vector<double> intExp, std::vector<double> theorint);
74 template <
typename Texp,
typename Ttheo>
78 for (; itExpBeg < itExpEnd; ++itExpBeg, ++itTheo)
80 sum += fabs(*itExpBeg - *itTheo);
92 OPENSWATHALGO_DLLAPI
double manhattanScoring(std::vector<double> intExp, std::vector<double> theorint);
98 template <
typename TInputIterator,
typename TInputIteratorY>
99 typename std::iterator_traits<TInputIterator>::value_type
cor_pearson(
105 typedef typename std::iterator_traits<TInputIterator>::value_type value_type;
109 m1 = m2 = s1 = s2 = 0.0;
111 ptrdiff_t n = std::distance(xBeg, xEnd);
112 value_type nd =
static_cast<value_type
>(n);
113 for (; xBeg != xEnd; ++xBeg, ++yBeg)
115 corr += *xBeg * *yBeg;
126 if (s1 < 1.0e-12 || s2 < 1.0e-12)
130 corr -= m1 * m2 * (double)n;
131 corr /= sqrt(s1 * s2);
146 m_(0.0), q_(0.0), c_(0u)
152 double const delta = sample - m_;
154 q_ += delta * (sample - m_);
159 return (c_ > 1u) ? (q_ / (c_ - 1)) : 0;
164 return (c_ > 1u) ? (q_ / c_) : 0;
169 return std::sqrt(sample_variance());
174 return std::sqrt(standard_variance());
189 return sample_variance();
194 return sample_stddev();
functor to compute the mean and stddev of sequence using the std::foreach algorithm
Definition: StatsHelpers.h:140
double result_type
Definition: StatsHelpers.h:144
mean_and_stddev()
Definition: StatsHelpers.h:145
double standard_stddev() const
Definition: StatsHelpers.h:172
unsigned long c_
Definition: StatsHelpers.h:142
double sample_stddev() const
Definition: StatsHelpers.h:167
double mean() const
Definition: StatsHelpers.h:177
double stddev() const
Definition: StatsHelpers.h:192
double argument_type
Definition: StatsHelpers.h:144
double variance() const
Definition: StatsHelpers.h:187
unsigned long count() const
Definition: StatsHelpers.h:182
double standard_variance() const
Definition: StatsHelpers.h:162
void operator()(double sample)
Definition: StatsHelpers.h:150
double m_
Definition: StatsHelpers.h:141
double operator()() const
Definition: StatsHelpers.h:197
double sample_variance() const
Definition: StatsHelpers.h:157
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:75
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
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:99