#include <iostream>
#include "TFormula.h"
#include "TString.h"
#include "TMath.h"
#include "TMVA/TActivationRadial.h"
static const Int_t UNINITIALIZED = -1;
ClassImp(TMVA::TActivationRadial)
TMVA::TActivationRadial::TActivationRadial()
{
fEqn = new TFormula( "Gaussian", "TMath::Exp(-x*x/2.0)" );
fEqnDerivative = new TFormula( "derivative", "-x*TMath::Exp(-x*x/2.0)" );
}
TMVA::TActivationRadial::~TActivationRadial()
{
if (fEqn != NULL) delete fEqn;
if (fEqnDerivative != NULL) delete fEqnDerivative;
}
Double_t TMVA::TActivationRadial::Eval( Double_t arg )
{
if (fEqn == NULL) return UNINITIALIZED;
return fEqn->Eval(arg);
}
Double_t TMVA::TActivationRadial::EvalDerivative( Double_t arg )
{
if (fEqnDerivative == NULL) return UNINITIALIZED;
return fEqnDerivative->Eval(arg);
}
TString TMVA::TActivationRadial::GetExpression()
{
TString expr = "";
if (fEqn == NULL) expr += "<null>";
else expr += fEqn->GetExpFormula();
expr += "\t\t";
if (fEqnDerivative == NULL) expr += "<null>";
else expr += fEqnDerivative->GetExpFormula();
return expr;
}
void TMVA::TActivationRadial::MakeFunction( std::ostream& fout, const TString& fncName )
{
fout << "double " << fncName << "(double x) const" << std::endl;
fout << "{" << std::endl;
fout << " // radial" << std::endl;
fout << " return exp(-x*x/2.0);" << std::endl;
fout << "}" << std::endl;
fout << " " << std::endl;
}
Last change: Wed Jun 25 08:48:50 2008
Last generated: 2008-06-25 08:48
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.