Made mlp::net::operator() a virtual function to allow for subclassing

with networks that transform their input or output.
This commit is contained in:
stevemadere 2004-02-11 23:03:23 +00:00
commit 3943287ad0

View file

@ -7,6 +7,7 @@
//-----------------------------------------------------------------------------
using namespace std;
#include <values.h> // MAXFLOAT MINFLOAT
#include <math.h> // exp
#include <stdexcept> // 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