MinusFunc Class Reference

A wrapper class to multiply a function with -1. More...

#include <func.h>

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

List of all members.

Public Member Functions

 MinusFunc (Pointer< Func > f_, Pointer< ostream > out_func_p_=out_out_p, Pointer< ostream > out_func_log_p_=out_log_p)
 Constructor for a normal func.
virtual bool sparsity_available () const
 To check, whether the sparsity information is set.
virtual const SparsityInfoget_sparsity () const
 Gives the sparsity information with read-permissions.
virtual bool compute_sparsity_pattern (const vector< dvector > &sample_set)
double eval (const UserVector< double > &x) const
 Evaluates the function for a UserVector<double>.
void grad (UserVector< double > &g, const UserVector< double > &x) const
 Evaluates the gradient for a UserVector<double>.
dvector grad (const dvector &x) const
 Computes the (sub)gradient for a UserVector<double>.
void HessMult (UserVector< double > &y, const UserVector< double > &x, const UserVector< double > &z) const
 Computes the product of the Hessian in one point and a UserVector<double>.
dvector HessMult (const dvector &x, const dvector &z) const
 Evaluates the product of the Hessian and a dvector.
virtual void set_curvature (CurvatureType ct)
virtual CurvatureType get_curvature () const
void print (ostream &out) const
 Print's the shift-value and the shifted function.

Protected Member Functions

SparsityInfoget_sparsity ()

Protected Attributes

Pointer< Funcf
 The function to wrap.

Detailed Description

A wrapper class to multiply a function with -1.

this == - *f .

Definition at line 505 of file func.h.


Constructor & Destructor Documentation

MinusFunc::MinusFunc ( Pointer< Func f_,
Pointer< ostream >  out_func_p_ = out_out_p,
Pointer< ostream >  out_func_log_p_ = out_log_p 
) [inline]

Constructor for a normal func.

Parameters:
f_ The function to wrap.
out_func_p_ An ostream to print function-related output to, default is out_out_p.
out_func_log_p_ An ostream to print function-related logging-output to, default is out_func_p.

Definition at line 519 of file func.h.


Member Function Documentation

SparsityInfo& MinusFunc::get_sparsity (  )  [inline, protected, virtual]

Reimplemented from Func.

Definition at line 511 of file func.h.

virtual bool MinusFunc::sparsity_available (  )  const [inline, virtual]

To check, whether the sparsity information is set.

Returns:
True, if sparsity information is available. False, else.

Reimplemented from Func.

Definition at line 524 of file func.h.

virtual const SparsityInfo& MinusFunc::get_sparsity (  )  const [inline, virtual]

Gives the sparsity information with read-permissions.

Reimplemented from Func.

Definition at line 526 of file func.h.

virtual bool MinusFunc::compute_sparsity_pattern ( const vector< dvector > &  sample_set  )  [virtual]

Reimplemented from Func.

double MinusFunc::eval ( const UserVector< double > &  x  )  const [inline, virtual]

Evaluates the function for a UserVector<double>.

Parameters:
x The UserVector<double> to evaluate.
Returns:
The value: -f(x)

Implements Func.

Definition at line 534 of file func.h.

void MinusFunc::grad ( UserVector< double > &  g,
const UserVector< double > &  x 
) const [inline, virtual]

Evaluates the gradient for a UserVector<double>.

Parameters:
g The UserVector<double> to store the result in: g = - f'(x).
x The UserVector<double> to evaluate.

Implements Func.

Definition at line 542 of file func.h.

dvector MinusFunc::grad ( const dvector x  )  const [inline, virtual]

Computes the (sub)gradient for a UserVector<double>.

Parameters:
x The UserVector<double> to compute.
Returns:
The gradient as dvector.
See also:
grad(UserVector<double>&, UserVector<double>&)
add_grad(UserVector<double>&, const UserVector<double>&)
add_valgrad(UserVector<double>&, UserVector<double>&, const UserVector<double>&)

Reimplemented from Func.

Definition at line 547 of file func.h.

void MinusFunc::HessMult ( UserVector< double > &  y,
const UserVector< double > &  x,
const UserVector< double > &  z 
) const [inline, virtual]

Computes the product of the Hessian in one point and a UserVector<double>.

Parameters:
y The UserVector<double> to store the result in.
x The UserVector<double> to compute the Hessian for.
z The UserVector<double> to multiply the Hession with.

Implements Func.

Definition at line 556 of file func.h.

dvector MinusFunc::HessMult ( const dvector x,
const dvector z 
) const [inline, virtual]

Evaluates the product of the Hessian and a dvector.

Parameters:
x The dvector to evaluate the Hessian for.
z The dvector to multiply with the Hessian.
Returns:
The result as a dvector: $ \nabla^2 f(x) \cdot z $.
See also:
HessMult(UserVector<double>&, const UserVector<double>&, const UserVector<double>&)

Reimplemented from Func.

Definition at line 561 of file func.h.

virtual void MinusFunc::set_curvature ( CurvatureType  ct  )  [inline, virtual]

Implements Func.

Definition at line 588 of file func.h.

virtual CurvatureType MinusFunc::get_curvature (  )  const [inline, virtual]

Implements Func.

Definition at line 596 of file func.h.

void MinusFunc::print ( ostream &  out  )  const [inline, virtual]

Print's the shift-value and the shifted function.

Parameters:
out The ostream to print to.

Reimplemented from Func.

Definition at line 608 of file func.h.


Member Data Documentation

Pointer<Func> MinusFunc::f [protected]

The function to wrap.

Definition at line 509 of file func.h.


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

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1