OpenMS
Loading...
Searching...
No Matches
KernelDensityEstimation.h
Go to the documentation of this file.
1// --------------------------------------------------------------------------
2// OpenMS -- Open-Source Mass Spectrometry
3// --------------------------------------------------------------------------
4// SPDX-License-Identifier: BSD-3-Clause
5//
6// --------------------------------------------------------------------------
7// $Maintainer: Justin Sing $
8// $Authors: Justin Sing $
9// --------------------------------------------------------------------------
10
11#pragma once
12
13#include <cstddef>
14#include <utility>
15#include <vector>
16
17#include <OpenMS/config.h>
18
19namespace OpenMS
20{
21 namespace Math
22 {
45 struct OPENMS_DLLAPI KernelDensityEstimation
46 {
70 static double bwNrd0(const std::vector<double>& x);
71
97 static std::vector<double> linBin(const std::vector<double>& x,
98 double xmin,
99 double xmax,
100 std::size_t nbins,
101 const std::vector<double>* weights);
102
104 static std::vector<double> linBin(const std::vector<double>& x,
105 double xmin,
106 double xmax,
107 std::size_t nbins);
108
133 static std::vector<double> forRt(const std::vector<double>& X, std::size_t M = 0);
134
157 static std::vector<double> revRt(const std::vector<double>& Xp, std::size_t M = 0);
158
183 static std::vector<double> silvermanKernelFFT(double bw, std::size_t M, double RANGE);
184
226 static std::pair<std::vector<double>, std::vector<double>> gridKdeFFT(const std::vector<double>& x,
227 double bw,
228 std::size_t gridsize = 512,
229 double cut = 3.0);
230
252 static std::vector<double> kdeFFTEval(const std::vector<double>& x,
253 double bw,
254 std::size_t gridsize = 512,
255 double cut = 3.0);
256 };
257
258 } // namespace Math
259} // namespace OpenMS
static double bwNrd0(const std::vector< double > &x)
Bandwidth selector using the "nrd0" rule-of-thumb for kernel density estimation.
static std::vector< double > kdeFFTEval(const std::vector< double > &x, double bw, std::size_t gridsize=512, double cut=3.0)
Evaluate kernel density estimates at the data points themselves.
static std::vector< double > linBin(const std::vector< double > &x, double xmin, double xmax, std::size_t nbins, const std::vector< double > *weights)
Linear binning of data onto an equally-spaced grid.
static std::vector< double > forRt(const std::vector< double > &X, std::size_t M=0)
Forward FFT of real-valued data using Munro-packed format.
static std::vector< double > silvermanKernelFFT(double bw, std::size_t M, double RANGE)
Compute the FFT of a Gaussian kernel in Munro-packed format.
static std::vector< double > revRt(const std::vector< double > &Xp, std::size_t M=0)
Inverse FFT of Munro-packed data to real-valued output.
static std::pair< std::vector< double >, std::vector< double > > gridKdeFFT(const std::vector< double > &x, double bw, std::size_t gridsize=512, double cut=3.0)
Fast kernel density estimation on a regular grid using FFT convolution.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Kernel Density Estimation utilities using FFT-based methods.
Definition KernelDensityEstimation.h:46
static std::vector< double > linBin(const std::vector< double > &x, double xmin, double xmax, std::size_t nbins)
Convenience overload that uses uniform weights.