nnfw/include/libperiodicfunctions.h

Go to the documentation of this file.
00001 /********************************************************************************
00002  *  Neural Network Framework.                                                   *
00003  *  Copyright (C) 2005-2011 Gianluca Massera <emmegian@yahoo.it>                *
00004  *                                                                              *
00005  *  This program is free software; you can redistribute it and/or modify        *
00006  *  it under the terms of the GNU General Public License as published by        *
00007  *  the Free Software Foundation; either version 2 of the License, or           *
00008  *  (at your option) any later version.                                         *
00009  *                                                                              *
00010  *  This program is distributed in the hope that it will be useful,             *
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of              *
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
00013  *  GNU General Public License for more details.                                *
00014  *                                                                              *
00015  *  You should have received a copy of the GNU General Public License           *
00016  *  along with this program; if not, write to the Free Software                 *
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  *
00018  ********************************************************************************/
00019 
00020 #ifndef LIBPERIODICFUNCTIONS_H
00021 #define LIBPERIODICFUNCTIONS_H
00022 
00023 #include "nnfwconfig.h"
00024 
00030 #include "outputfunction.h"
00031 
00032 namespace farsa {
00033 
00037 class FARSA_NNFW_API PeriodicFunction : public OutputFunction {
00038 public:
00040     PeriodicFunction( double phase = 0.0, double span = 1.0, double amplitude = 1.0 );
00042     virtual ~PeriodicFunction() { /* Nothing to do */ };
00044     virtual void apply( DoubleVector& inputs, DoubleVector& outputs ) = 0;
00057     virtual void configure(ConfigurationParameters& params, QString prefix);
00067     virtual void save(ConfigurationParameters& params, QString prefix);
00068     double phase;
00069     double span;
00070     double amplitude;
00071 };
00072 
00076 class FARSA_NNFW_API SawtoothFunction : public PeriodicFunction {
00077 public:
00079     SawtoothFunction( double phase = 0.0, double span = 1.0, double amplitude = 1.0 );
00081     virtual ~SawtoothFunction() { /* Nothing to do */ };
00083     virtual void apply( DoubleVector& inputs, DoubleVector& outputs );
00094     virtual void configure(ConfigurationParameters& params, QString prefix);
00102     virtual void save(ConfigurationParameters& params, QString prefix);
00103 };
00104 
00108 class FARSA_NNFW_API TriangleFunction : public PeriodicFunction {
00109 public:
00111     TriangleFunction( double phase = 0.0, double span = 1.0, double amplitude = 1.0 );
00113     virtual ~TriangleFunction() { /* Nothing to do */ };
00115     virtual void apply( DoubleVector& inputs, DoubleVector& outputs );
00126     virtual void configure(ConfigurationParameters& params, QString prefix);
00134     virtual void save(ConfigurationParameters& params, QString prefix);
00135 };
00136 
00140 class FARSA_NNFW_API SinFunction : public PeriodicFunction {
00141 public:
00143     SinFunction( double phase = 0.0, double span = 1.0, double amplitude = 1.0 );
00145     virtual ~SinFunction() { /* Nothing to do */ };
00149     double frequency();
00151     virtual void apply( DoubleVector& inputs, DoubleVector& outputs );
00162     virtual void configure(ConfigurationParameters& params, QString prefix);
00170     virtual void save(ConfigurationParameters& params, QString prefix);
00171 };
00172 
00176 class FARSA_NNFW_API PseudoGaussFunction : public PeriodicFunction {
00177 public:
00179     PseudoGaussFunction( double phase = 0.0, double span = 1.0, double amplitude = 1.0 );
00181     virtual ~PseudoGaussFunction() { /* Nothing to do */ };
00183     virtual void apply( DoubleVector& inputs, DoubleVector& outputs );
00194     virtual void configure(ConfigurationParameters& params, QString prefix);
00202     virtual void save(ConfigurationParameters& params, QString prefix);
00203 };
00204 
00205 }
00206 
00207 #endif
00208