MADNESS 0.10.1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Fred Class Reference

Wrapper around vector demonstrating interface necessary. More...

Inheritance diagram for Fred:
Inheritance graph
[legend]
Collaboration diagram for Fred:
Collaboration graph
[legend]

Public Member Functions

 Fred (const Fred &f)
 
 Fred (const Tensor< double > f, const Tensor< double > x, const Tensor< double > w, const double mu, const double p)
 
 Fred (double a, double b, double c)
 
string a (const string &input) const
 
string b (const string &input) const
 
double get (int i) const
 
Tensor< double > gradient (const Tensor< double > &expnt)
 Should return the derivative of the function.
 
Fred operator* (const double &d) const
 
Fredoperator+= (const Fred &f)
 
Fredoperator= (const Fred &f)
 
bool provides_gradient () const
 Override this to return true if the derivative is implemented.
 
void set (int i, double a)
 
double value (const Tensor< double > &expnt)
 Should return the value of the objective function.
 
void value_and_gradient (const Tensor< double > &expnt, double &value, Tensor< double > &gradient)
 Reimplement if more efficient to evaluate both value and gradient in one call.
 
- Public Member Functions inherited from madness::OptimizationTargetInterface
virtual ~OptimizationTargetInterface ()
 
double test_gradient (Tensor< double > &x, double value_precision, bool doprint=true)
 Numerical test of the derivative ... optionally prints to stdout, returns max abs error.
 

Private Member Functions

 Fred ()
 
double dpenalty (double expnt) const
 
Tensor< double > make_g (const Tensor< double > &expnt)
 Makes the matrix of Gaussians g(i,j) = myexp(-expnt[j]*x[i]x[i])
 
double penalty (double expnt) const
 

Private Attributes

const double alpha
 
const Tensor< double > f
 
const double mu
 
const long nx
 
const double p
 
std::vector< double > v
 
const Tensor< double > w
 
const Tensor< double > x
 

Detailed Description

Wrapper around vector demonstrating interface necessary.

Constructor & Destructor Documentation

◆ Fred() [1/4]

Fred::Fred ( )
private

◆ Fred() [2/4]

Fred::Fred ( double  a,
double  b,
double  c 
)
inline

References a, b, c, and v.

◆ Fred() [3/4]

Fred::Fred ( const Fred f)
inline

◆ Fred() [4/4]

Fred::Fred ( const Tensor< double >  f,
const Tensor< double >  x,
const Tensor< double >  w,
const double  mu,
const double  p 
)
inline

Member Function Documentation

◆ a()

string Fred::a ( const string &  input) const
inline

Referenced by main().

◆ b()

string Fred::b ( const string &  input) const
inline

Referenced by main().

◆ dpenalty()

double Fred::dpenalty ( double  expnt) const
inlineprivate

References alpha.

Referenced by value_and_gradient().

◆ get()

double Fred::get ( int  i) const
inline

References v.

Referenced by test1().

◆ gradient()

Tensor< double > Fred::gradient ( const Tensor< double > &  x)
inlinevirtual

Should return the derivative of the function.

Reimplemented from madness::OptimizationTargetInterface.

References errsq(), madness::g, and value_and_gradient().

Referenced by value(), and value_and_gradient().

◆ make_g()

Tensor< double > Fred::make_g ( const Tensor< double > &  expnt)
inlineprivate

Makes the matrix of Gaussians g(i,j) = myexp(-expnt[j]*x[i]x[i])

References madness::g, myexp(), nx, madness::BaseTensor::size(), and x.

Referenced by value_and_gradient().

◆ operator*()

Fred Fred::operator* ( const double &  d) const
inline

References d, and f.

◆ operator+=()

Fred & Fred::operator+= ( const Fred f)
inline

References f, and v.

◆ operator=()

Fred & Fred::operator= ( const Fred f)
inline

References f, and v.

◆ penalty()

double Fred::penalty ( double  expnt) const
inlineprivate

References alpha.

Referenced by value_and_gradient().

◆ provides_gradient()

bool Fred::provides_gradient ( ) const
inlinevirtual

Override this to return true if the derivative is implemented.

Reimplemented from madness::OptimizationTargetInterface.

◆ set()

void Fred::set ( int  i,
double  a 
)
inline

References a, and v.

Referenced by expL(), and N().

◆ value()

double Fred::value ( const Tensor< double > &  x)
inlinevirtual

Should return the value of the objective function.

Implements madness::OptimizationTargetInterface.

References errsq(), gradient(), and value_and_gradient().

Referenced by value_and_gradient().

◆ value_and_gradient()

void Fred::value_and_gradient ( const Tensor< double > &  x,
double &  value,
Tensor< double > &  gradient 
)
inlinevirtual

Reimplement if more efficient to evaluate both value and gradient in one call.

Reimplemented from madness::OptimizationTargetInterface.

References c, dpenalty(), e(), errsq(), f, madness::g, gradient(), make_g(), mu, nx, optimize_coeffs(), p, penalty(), pow(), madness::BaseTensor::size(), v, value(), w, and x.

Referenced by gradient(), and value().

Member Data Documentation

◆ alpha

const double Fred::alpha
private

Referenced by dpenalty(), and penalty().

◆ f

const Tensor<double> Fred::f
private

◆ mu

const double Fred::mu
private

Referenced by value_and_gradient().

◆ nx

const long Fred::nx
private

Referenced by make_g(), and value_and_gradient().

◆ p

const double Fred::p
private

Referenced by value_and_gradient().

◆ v

std::vector<double> Fred::v
private

◆ w

const Tensor<double> Fred::w
private

Referenced by value_and_gradient().

◆ x

const Tensor<double> Fred::x
private

Referenced by make_g(), and value_and_gradient().


The documentation for this class was generated from the following files: