From ef178339990d7b5efd72a9b90353bb9119a90098 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 12 Feb 2023 16:06:59 +0100 Subject: [PATCH] Register MLPPNumericalAnalysis into the ClassDB. --- mlpp/numerical_analysis/numerical_analysis.cpp | 5 +++-- mlpp/numerical_analysis/numerical_analysis.h | 9 +++++++-- register_types.cpp | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mlpp/numerical_analysis/numerical_analysis.cpp b/mlpp/numerical_analysis/numerical_analysis.cpp index 5ad8036..f6a1598 100644 --- a/mlpp/numerical_analysis/numerical_analysis.cpp +++ b/mlpp/numerical_analysis/numerical_analysis.cpp @@ -12,8 +12,6 @@ #include #include - - real_t MLPPNumericalAnalysis::numDiff(real_t (*function)(real_t), real_t x) { real_t eps = 1e-10; return (function(x + eps) - function(x)) / eps; // This is just the formal def. of the derivative. @@ -293,3 +291,6 @@ std::string MLPPNumericalAnalysis::secondPartialDerivativeTest(real_t (*function } } } + +void MLPPNumericalAnalysis::_bind_methods() { +} diff --git a/mlpp/numerical_analysis/numerical_analysis.h b/mlpp/numerical_analysis/numerical_analysis.h index 3768c28..54c12c2 100644 --- a/mlpp/numerical_analysis/numerical_analysis.h +++ b/mlpp/numerical_analysis/numerical_analysis.h @@ -9,11 +9,14 @@ #include "core/math/math_defs.h" +#include "core/object/reference.h" + #include #include +class MLPPNumericalAnalysis : public Reference { + GDCLASS(MLPPNumericalAnalysis, Reference); -class MLPPNumericalAnalysis { public: /* A numerical method for derivatives is used. This may be subject to change, as an analytical method for calculating derivatives will most likely be used in @@ -53,7 +56,9 @@ public: real_t laplacian(real_t (*function)(std::vector), std::vector x); // laplacian std::string secondPartialDerivativeTest(real_t (*function)(std::vector), std::vector x); + +protected: + static void _bind_methods(); }; - #endif /* NumericalAnalysis_hpp */ diff --git a/register_types.cpp b/register_types.cpp index e1f4603..c681cbf 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -33,6 +33,7 @@ SOFTWARE. #include "mlpp/transforms/transforms.h" #include "mlpp/utilities/utilities.h" #include "mlpp/stat/stat.h" +#include "mlpp/numerical_analysis/numerical_analysis.h" #include "mlpp/hidden_layer/hidden_layer.h" #include "mlpp/multi_output_layer/multi_output_layer.h" @@ -65,6 +66,7 @@ void register_pmlpp_types(ModuleRegistrationLevel p_level) { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class();