2#ifndef NEUR_GAUSS_GAUSSIAN_H
3#define NEUR_GAUSS_GAUSSIAN_H
15 Gaussian(
unsigned ninputs,
bool samesigma =
true );
22 void init(
unsigned ninputs,
bool samesigma =
true );
28 const double *
center()
const {
return( _center ); }
29 double *
center() {
return( _center ); }
30 double centerCoord(
unsigned n )
const {
return( _center[n] ); }
32 template<
class InputIterator>
33 void setCenter(
const InputIterator & start );
34 const double *
sigmas()
const {
return( _sigma ); }
35 double *
sigmas() {
return( _sigma ); }
36 double sigma(
unsigned n = 0 )
const
37 {
if( _sameSigma )
return( _sigma[0] );
else return( _sigma[n] ); }
39 {
if( _sameSigma ) _sigma[0] = s;
else _sigma[n] = s; }
40 unsigned nInputs()
const {
return _ninputs; }
41 template<
class InputIterator>
42 double value(
const InputIterator & start )
const;
48 void randInit(
double cmin = -1,
double cmax = -1,
double smin = 0.3,
55 template<
class InputIterator>
56 double arg(
const InputIterator & start )
const;
73template<
class InputIterator>
77 double x =
arg( start );
78 return( exp( -( x < 700 ? x : 700 ) ) );
82template<
class InputIterator>
87 InputIterator it = start;
90 double *
sigma = _sigma;
95 for( i=0; i<_ninputs; ++i, ++it, ++
center )
97 tmp = (*center) - (*it);
103 std::cerr <<
"Gaussian : no std deviation\n";
107 for( i=0; i<_ninputs; ++i, ++it, ++
center, ++
sigma )
109 tmp = (*center) - (*it);
110 x += ( tmp * tmp ) / ( 2 * (*
sigma) * (*
sigma) );
117template<
class InputIterator>
120 InputIterator it = start;
124 for( i=0; i<_ninputs; ++i, ++it, ++c )
void setCenter(const InputIterator &start)
void setSigma(unsigned n, double s)
void randInitCenter(double cmin=-1, double cmax=1)
Initialise seulement les centres.
void init(unsigned ninputs, bool samesigma=true)
Gaussian(const Gaussian &g)
double centerCoord(unsigned n) const
const double * center() const
void randInitSigma(double smin=0.3, double smax=5)
Initialise seulement les écarts-types.
Gaussian & operator=(const Gaussian &g)
void setCenterCoord(unsigned n, double c)
void randInit(double cmin=-1, double cmax=-1, double smin=0.3, double smax=5)
Initialise avec des valeurs aléatoires.
const double * sigmas() const
double sigma(unsigned n=0) const
Gaussian(unsigned ninputs, bool samesigma=true)
double value(const InputIterator &start) const
double arg(const InputIterator &start) const
Calcule l'argument de l'exponentielle.