55 sampleMean_(x_, xMean_);
58 MatrixTools::pow<double>(covar_, -0.5, invSqrtCovar_);
61 h_ = std::pow(4. / ((2 *
static_cast<double>(r_) + 1.) *
static_cast<double>(n_)), 1. / (
static_cast<double>(r_) + 4.));
63 c1_ = 1. / (std::sqrt(
MatrixTools::det(covar_)) *
static_cast<double>(n_) * std::pow(h_,
static_cast<int>(r_)));
67 vector<double> xi(r_);
70 for (
unsigned int i = 0; i < n_; i++)
73 for (
unsigned int k = 0; k < r_; k++)
80 for (
unsigned int j = 0; j < n_; j++)
82 for (
unsigned int k = 0; k < r_; k++)
84 diff_xi(k, 0) = xi[k] - x_(k, j);
88 sum += kernel_(std_xi);
90 pilot_[i] = c1_ * sum;
95 for (
unsigned int i = 0; i < n_; i++)
97 g += std::log(pilot_[i]);
99 g = std::exp(g /
static_cast<double>(n_));
100 for (
unsigned int i = 0; i < n_; i++)
102 lambda_[i] = std::pow(g / pilot_[i], gamma_);
106 for (
unsigned int i = 0; i < n_; i++)
108 c2_[i] = std::pow(lambda_[i], -
static_cast<double>(r_));
117 for (
size_t i = 0; i < nr; i++)
120 for (
size_t j = 0; j < nc; j++)
124 mean[i] /=
static_cast<double>(nc);
133 for (
size_t i = 0; i < r_; i++)
135 scalar += std::pow(x(i, 0), 2.);
138 return std::pow(2. *
NumConstants::PI(), -
static_cast<double>(r_) / 2.) * std::exp(-0.5 * scalar);
147 for (
unsigned int j = 0; j < n_; j++)
149 for (
unsigned int k = 0; k < r_; k++)
151 diff_xi(k, 0) = x[k] - x_(k, j);
155 sum += kernel_(std_xi) * c2_[j];
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)
Matrix storage in one vector.
The matrix template interface.
virtual size_t getNumberOfColumns() const =0
virtual size_t getNumberOfRows() const =0