1 #ifndef __FPA__BASE__FUNCTORS__GAUSSIANCOST__HXX__
2 #define __FPA__BASE__FUNCTORS__GAUSSIANCOST__HXX__
4 // -------------------------------------------------------------------------
5 template< class _TResult >
6 _TResult fpa::Base::Functors::GaussianCost< _TResult >::
7 Evaluate( const _TResult& x ) const
9 _TResult r = _TResult( 0 );
10 if( this->m_Model->GetNumberOfSamples( ) > this->m_SupportSize )
12 r = this->m_Model->SquaredMahalanobis( x );
13 if( r <= _TResult( 1 ) )
14 this->m_Model->AddSample( x );
18 this->m_Model->AddSample( x );
19 if( this->m_Model->GetNumberOfSamples( ) > 2 )
20 r = this->m_Model->SquaredMahalanobis( x );
23 if( r < this->m_MinimumCost )
24 return( this->m_MinimumCost );
29 // -------------------------------------------------------------------------
30 template< class _TResult >
31 fpa::Base::Functors::GaussianCost< _TResult >::
35 m_MinimumCost( _TResult( 1e-10 ) )
37 this->m_Model = TModel::New( );
40 // -------------------------------------------------------------------------
41 template< class _TResult >
42 fpa::Base::Functors::GaussianCost< _TResult >::
47 #endif // __FPA__BASE__FUNCTORS__GAUSSIANCOST__HXX__