18 sampleMean_(x_, xMean_);
21 MatrixTools::pow<double>(covar_, -0.5, invSqrtCovar_);
24 h_ = std::pow(4. / ((2 * static_cast<double>(r_) + 1.) * static_cast<double>(n_)), 1. / (static_cast<double>(r_) + 4.));
26 c1_ = 1. / (std::sqrt(
MatrixTools::det(covar_)) *
static_cast<double>(n_) * std::pow(h_, static_cast<int>(r_)));
30 vector<double> xi(r_);
33 for (
unsigned int i = 0; i < n_; i++)
36 for (
unsigned int k = 0; k < r_; k++)
43 for (
unsigned int j = 0; j < n_; j++)
45 for (
unsigned int k = 0; k < r_; k++)
47 diff_xi(k, 0) = xi[k] - x_(k, j);
51 sum += kernel_(std_xi);
53 pilot_[i] = c1_ * sum;
58 for (
unsigned int i = 0; i < n_; i++)
60 g += std::log(pilot_[i]);
62 g = std::exp(g / static_cast<double>(n_));
63 for (
unsigned int i = 0; i < n_; i++)
65 lambda_[i] = std::pow(g / pilot_[i], gamma_);
69 for (
unsigned int i = 0; i < n_; i++)
71 c2_[i] = std::pow(lambda_[i], -static_cast<double>(r_));
80 for (
size_t i = 0; i < nr; i++)
83 for (
size_t j = 0; j < nc; j++)
87 mean[i] /=
static_cast<double>(nc);
96 for (
size_t i = 0; i < r_; i++)
98 scalar += std::pow(x(i, 0), 2.);
101 return std::pow(2. *
NumConstants::PI(), -static_cast<double>(r_) / 2.) * std::exp(-0.5 * scalar);
110 for (
unsigned int j = 0; j < n_; j++)
112 for (
unsigned int k = 0; k < r_; k++)
114 diff_xi(k, 0) = x[k] - x_(k, j);
118 sum += kernel_(std_xi) * c2_[j];
The matrix template interface.
Matrix storage in one vector.
virtual size_t getNumberOfColumns() const =0
void sampleMean_(const Matrix< double > &x, std::vector< double > &mean)
double kernel_(const Matrix< double > &x)
The kernel function.
double kDensity(const std::vector< double > &x)
virtual size_t getNumberOfRows() const =0