Register MLPPNumericalAnalysis into the ClassDB.

This commit is contained in:
Relintai 2023-02-12 16:06:59 +01:00
parent a9cc4fa0e0
commit ef17833999
3 changed files with 12 additions and 4 deletions

View File

@ -12,8 +12,6 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
real_t MLPPNumericalAnalysis::numDiff(real_t (*function)(real_t), real_t x) { real_t MLPPNumericalAnalysis::numDiff(real_t (*function)(real_t), real_t x) {
real_t eps = 1e-10; real_t eps = 1e-10;
return (function(x + eps) - function(x)) / eps; // This is just the formal def. of the derivative. 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() {
}

View File

@ -9,11 +9,14 @@
#include "core/math/math_defs.h" #include "core/math/math_defs.h"
#include "core/object/reference.h"
#include <string> #include <string>
#include <vector> #include <vector>
class MLPPNumericalAnalysis : public Reference {
GDCLASS(MLPPNumericalAnalysis, Reference);
class MLPPNumericalAnalysis {
public: public:
/* A numerical method for derivatives is used. This may be subject to change, /* 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 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<real_t>), std::vector<real_t> x); // laplacian real_t laplacian(real_t (*function)(std::vector<real_t>), std::vector<real_t> x); // laplacian
std::string secondPartialDerivativeTest(real_t (*function)(std::vector<real_t>), std::vector<real_t> x); std::string secondPartialDerivativeTest(real_t (*function)(std::vector<real_t>), std::vector<real_t> x);
protected:
static void _bind_methods();
}; };
#endif /* NumericalAnalysis_hpp */ #endif /* NumericalAnalysis_hpp */

View File

@ -33,6 +33,7 @@ SOFTWARE.
#include "mlpp/transforms/transforms.h" #include "mlpp/transforms/transforms.h"
#include "mlpp/utilities/utilities.h" #include "mlpp/utilities/utilities.h"
#include "mlpp/stat/stat.h" #include "mlpp/stat/stat.h"
#include "mlpp/numerical_analysis/numerical_analysis.h"
#include "mlpp/hidden_layer/hidden_layer.h" #include "mlpp/hidden_layer/hidden_layer.h"
#include "mlpp/multi_output_layer/multi_output_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<MLPPCost>(); ClassDB::register_class<MLPPCost>();
ClassDB::register_class<MLPPTransforms>(); ClassDB::register_class<MLPPTransforms>();
ClassDB::register_class<MLPPStat>(); ClassDB::register_class<MLPPStat>();
ClassDB::register_class<MLPPNumericalAnalysis>();
ClassDB::register_class<MLPPHiddenLayer>(); ClassDB::register_class<MLPPHiddenLayer>();
ClassDB::register_class<MLPPOutputLayer>(); ClassDB::register_class<MLPPOutputLayer>();