From 88ced7a06eaf0fe2a0899e46225fa78e67f41840 Mon Sep 17 00:00:00 2001 From: Andru Liu <90433630+WallabyLester@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:59:37 -0700 Subject: [PATCH] Implemented gaussian. --- CPP_Implementation/rbf_model.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CPP_Implementation/rbf_model.cpp b/CPP_Implementation/rbf_model.cpp index 04d0549..9af2bad 100644 --- a/CPP_Implementation/rbf_model.cpp +++ b/CPP_Implementation/rbf_model.cpp @@ -41,3 +41,13 @@ RBFModel::~RBFModel() { delete[] weights; // Free memory for weights } +/** + * @brief Gaussian function used in RBF evaluation. + */ +double RBFModel::gaussian(const double* input, const double* center) { + double norm = 0.0; + for (int i = 0; i < inputDim; ++i) { + norm += pow(input[i] - center[i], 2); + } + return exp(-0.5 * norm / (sigma * sigma)); +}