37 #include <OpenMS/OPENSWATHALGO/OpenSwathAlgoConfig.h>
51 OPENSWATHALGO_DLLAPI
void normalize(
const std::vector<double>& intensities,
double normalization_factor, std::vector<double>& normalized_intensities);
60 for (; beg != end; ++beg)
71 template <
typename Texp,
typename Ttheo>
72 double dotProd(Texp intExpBeg, Texp intExpEnd, Ttheo intTheo)
74 std::vector<double> res(std::distance(intExpBeg, intExpEnd));
75 std::transform(intExpBeg, intExpEnd, intTheo, res.begin(), std::multiplies<double>());
76 double sum = std::accumulate(res.begin(), res.end(), 0.);
87 OPENSWATHALGO_DLLAPI
double dotprodScoring(std::vector<double> intExp, std::vector<double> theorint);
92 template <
typename Texp,
typename Ttheo>
96 for (std::size_t i = 0; itExpBeg < itExpEnd; ++itExpBeg, ++itTheo, ++i)
98 double x = *itExpBeg - *itTheo;
112 OPENSWATHALGO_DLLAPI
double manhattanScoring(std::vector<double> intExp, std::vector<double> theorint);
118 template <
typename TInputIterator,
typename TInputIteratorY>
119 typename std::iterator_traits<TInputIterator>::value_type
cor_pearson(
125 typedef typename std::iterator_traits<TInputIterator>::value_type value_type;
129 m1 = m2 = s1 = s2 = 0.0;
131 ptrdiff_t n = std::distance(xBeg, xEnd);
132 value_type nd =
static_cast<value_type
>(n);
133 for (; xBeg != xEnd; ++xBeg, ++yBeg)
135 corr += *xBeg * *yBeg;
146 if (s1 < 1.0e-12 || s2 < 1.0e-12)
150 corr -= m1 * m2 * (double)n;
151 corr /= sqrt(s1 * s2);
166 m_(0.0), q_(0.0), c_(0u)
172 double const delta = sample - m_;
174 q_ += delta * (sample - m_);
179 return (c_ > 1u) ? (q_ / (c_ - 1)) : 0;
184 return (c_ > 1u) ? (q_ / c_) : 0;
189 return std::sqrt(sample_variance());
194 return std::sqrt(standard_variance());
209 return sample_variance();
214 return sample_stddev();
functor to compute the mean and stddev of sequence using the std::foreach algorithm
Definition: StatsHelpers.h:160
double result_type
Definition: StatsHelpers.h:164
mean_and_stddev()
Definition: StatsHelpers.h:165
double standard_stddev() const
Definition: StatsHelpers.h:192
unsigned long c_
Definition: StatsHelpers.h:162
double sample_stddev() const
Definition: StatsHelpers.h:187
double mean() const
Definition: StatsHelpers.h:197
double stddev() const
Definition: StatsHelpers.h:212
double argument_type
Definition: StatsHelpers.h:164
double variance() const
Definition: StatsHelpers.h:207
unsigned long count() const
Definition: StatsHelpers.h:202
double standard_variance() const
Definition: StatsHelpers.h:182
void operator()(double sample)
Definition: StatsHelpers.h:170
double m_
Definition: StatsHelpers.h:161
double operator()() const
Definition: StatsHelpers.h:217
double sample_variance() const
Definition: StatsHelpers.h:177
static double sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:120
Definition: MRMScoring.h:50
double manhattanDist(Texp itExpBeg, Texp itExpEnd, Ttheo itTheo)
compute manhattan distance between Exp and Theo
Definition: StatsHelpers.h:93
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:72
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:57
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:119