13 #ifndef MLPACK_METHODS_KERNEL_PCA_NYSTROEM_METHOD_HPP    14 #define MLPACK_METHODS_KERNEL_PCA_NYSTROEM_METHOD_HPP    25   typename PointSelectionPolicy = kernel::KMeansSelection<>
    41                                 arma::mat& transformedData,
    45                                 KernelType kernel = KernelType())
    51     transformedData = G.t() * G;
    61     arma::colvec colMean = arma::sum(G, 1) / G.n_rows;
    62     G.each_row() -= arma::sum(G, 0) / G.n_rows;
    63     G.each_col() -= colMean;
    64     G += arma::sum(colMean) / G.n_rows;
    67     transformedData = arma::symmatu(transformedData);
    68     if (!arma::eig_sym(eigval, eigvec, transformedData))
    70       Log::Fatal << 
"Failed to construct the kernel matrix." << std::endl;
    75     for (
size_t i = 0; i < floor(eigval.n_elem / 2.0); ++i)
    76       eigval.swap_rows(i, (eigval.n_elem - 1) - i);
    79     eigvec = arma::fliplr(eigvec);
    81     transformedData = eigvec.t() * G.t();
 
Linear algebra utility functions, generally performed on matrices or vectors. 
The core includes that mlpack expects; standard C++ includes and Armadillo. 
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program. 
static void ApplyKernelMatrix(const arma::mat &data, arma::mat &transformedData, arma::vec &eigval, arma::mat &eigvec, const size_t rank, KernelType kernel=KernelType())
Construct the kernel matrix approximation using the nystroem method. 
void Apply(arma::mat &output)
Apply the low-rank factorization to obtain an output matrix G such that K' = G * G^T. 
void Center(const arma::mat &x, arma::mat &xCentered)
Creates a centered matrix, where centering is done by subtracting the sum over the columns (a column ...