From 3943287ad0879774856136c8ae417c5ad8519585 Mon Sep 17 00:00:00 2001 From: stevemadere Date: Wed, 11 Feb 2004 23:03:23 +0000 Subject: [PATCH] Made mlp::net::operator() a virtual function to allow for subclassing with networks that transform their input or output. --- eo/app/gprop/mlp.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/eo/app/gprop/mlp.h b/eo/app/gprop/mlp.h index 779e53e8..e0e706a3 100644 --- a/eo/app/gprop/mlp.h +++ b/eo/app/gprop/mlp.h @@ -7,6 +7,7 @@ //----------------------------------------------------------------------------- +using namespace std; #include // MAXFLOAT MINFLOAT #include // exp #include // invalid_argument @@ -258,15 +259,7 @@ namespace mlp { l->reset(); } - vector operator()(const vector& input) const - { - vector tmp = input; - - for(const_iterator l = begin(); l != end(); ++l) - tmp = (*l)(tmp); - - return tmp; - } + virtual vector operator()(const vector& input) const ; unsigned winner(const vector& input) const { @@ -315,6 +308,18 @@ namespace mlp { } }; +#ifndef NO_MLP_VIRTUALS + vector net::operator()(const vector& input) const + { + vector tmp = input; + + for(const_iterator l = begin(); l != end(); ++l) + tmp = (*l)(tmp); + + return tmp; + } +#endif + //--------------------------------------------------------------------------- // sample