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. More...
 
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. More...
 
void set (int i, double a)
 
double value (const Tensor< double > &expnt)
 Should return the value of the objective function. More...
 
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. More...
 
- 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. More...
 

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]) More...
 
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.

◆ 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(), and madness::g.

◆ 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(), and madness::BaseTensor::size().

◆ operator*()

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

References d(), and madness::f.

◆ operator+=()

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

References madness::f, and v.

◆ operator=()

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

References madness::f, and v.

◆ penalty()

double Fred::penalty ( double  expnt) const
inlineprivate

References alpha.

◆ 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().

◆ 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, e(), errsq(), madness::f, madness::g, mu, optimize_coeffs(), p(), pow(), madness::BaseTensor::size(), v, and w().

Member Data Documentation

◆ alpha

const double Fred::alpha
private

◆ f

const Tensor<double> Fred::f
private

◆ mu

const double Fred::mu
private

◆ nx

const long Fred::nx
private

◆ p

const double Fred::p
private

◆ v

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

◆ w

const Tensor<double> Fred::w
private

◆ x

const Tensor<double> Fred::x
private

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