53 sampleMean_(x_, xMean_);
56 MatrixTools::pow<double>(covar_, -0.5, invSqrtCovar_);
59 h_ = std::pow(4. / ((2 * static_cast<double>(r_) + 1.) * static_cast<double>(n_)), 1. / (static_cast<double>(r_) + 4.));
61 c1_ = 1. / (std::sqrt(
MatrixTools::det(covar_)) *
static_cast<double>(n_) * std::pow(h_, static_cast<int>(r_)));
65 vector<double> xi(r_);
68 for (
unsigned int i = 0; i < n_; i++)
71 for(
unsigned int k = 0; k < r_; k++)
76 for (
unsigned int j = 0; j < n_; j++)
78 for (
unsigned int k = 0; k < r_; k++)
79 diff_xi(k, 0) = xi[k] - x_(k, j);
82 sum += kernel_(std_xi);
84 pilot_[i] = c1_ * sum;
89 for (
unsigned int i = 0; i < n_; i++)
90 g += std::log(pilot_[i]);
91 g = std::exp(g / static_cast<double>(n_));
92 for (
unsigned int i = 0; i < n_; i++)
93 lambda_[i] = std::pow(g / pilot_[i], gamma_);
96 for (
unsigned int i = 0; i < n_; i++)
97 c2_[i] = std::pow(lambda_[i], - static_cast<double>(r_));
105 for (
size_t i = 0; i < nr; i++)
108 for (
size_t j = 0; j < nc; j++)
110 mean[i] /=
static_cast<double>(nc);
119 for (
size_t i = 0; i < r_; i++)
120 scalar += std::pow(x(i, 0), 2.);
122 return std::pow(2. *
NumConstants::PI(), -static_cast<double>(r_) / 2.) * std::exp(-0.5 * scalar);
131 for(
unsigned int j = 0; j < n_; j++)
133 for(
unsigned int k = 0; k < r_; k++)
134 diff_xi(k, 0) = x[k] - x_(k, j);
137 sum += kernel_(std_xi) * c2_[j];
The matrix template interface.
This class allows to perform a correspondence analysis.
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