SumFunc Class Reference

A function to represent the sum of two functions with optional multiplicators. More...

#include <func.h>

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

List of all members.

Public Member Functions

 SumFunc (Pointer< Func > f_, Pointer< Func > g_, double a_=1., double b_=1., Pointer< ostream > out_func_p_=out_out_p, Pointer< ostream > out_func_log_p_=out_log_p)
 Constructor for two functions and optional multiplicators.
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.
void grad (UserVector< double > &y, const UserVector< double > &x) const
 Computes the gradient.
int valgrad (double &val, UserVector< double > &y, const UserVector< double > &x) const
 Computes the value and the gradient.
void HessMult (UserVector< double > &y, const UserVector< double > &x, const UserVector< double > &z) const
 Computes the product of the Hessian and a UserVector.
Func::CurvatureType get_curvature () const
void set_curvature (Func::CurvatureType ct)
void print (ostream &out) const
 Prints some information.

Private Member Functions

SparsityInfoget_sparsity ()

Private Attributes

Pointer< Funcf
 First function in sum.
Pointer< Funcg
 Second function in sum.
double a
 Multiplicators for the functions.
double b
Func::CurvatureType curv_type

Detailed Description

A function to represent the sum of two functions with optional multiplicators.

this == a * f(x) + b * g(x), where a and b are double's and f and g are Func's. f or g can also be NULL, but not both.

Definition at line 620 of file func.h.


Constructor & Destructor Documentation

SumFunc::SumFunc ( Pointer< Func f_,
Pointer< Func g_,
double  a_ = 1.,
double  b_ = 1.,
Pointer< ostream >  out_func_p_ = out_out_p,
Pointer< ostream >  out_func_log_p_ = out_log_p 
) [inline]

Constructor for two functions and optional multiplicators.

Asserts, that f_ or g_ is not NULL.

Parameters:
f_ The first function.
g_ The second function.
a_ The multiplicator for the first function.
b_ The multiplicator for the second function.

Definition at line 648 of file func.h.


Member Function Documentation

SparsityInfo& SumFunc::get_sparsity (  )  [inline, private, virtual]

Reimplemented from Func.

Definition at line 634 of file func.h.

virtual bool SumFunc::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 657 of file func.h.

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

Gives the sparsity information with read-permissions.

Reimplemented from Func.

Definition at line 663 of file func.h.

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

Reimplemented from Func.

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

Evaluates the function.

Parameters:
x The vector to evaluate the function for.
Returns:
The value of the function a * f(x) + b * g(x).
See also:
valgrad(double&, UserVector<double>&, UserVector<double>&)

Implements Func.

Definition at line 676 of file func.h.

void SumFunc::grad ( UserVector< double > &  y,
const UserVector< double > &  x 
) const [virtual]

Computes the gradient.

Parameters:
y The vector to store the gradient in.
x The vector to compute the gradient for.
See also:
valgrad(double&, UserVector<double>&, UserVector<double>&)

Implements Func.

int SumFunc::valgrad ( double &  val,
UserVector< double > &  y,
const UserVector< double > &  x 
) const [virtual]

Computes the value and the gradient.

Parameters:
val A double to store the value in.
y A UserVector to store the gradient in.
x The UserVector to compute.
See also:
eval(UserVector<double>&)
grad(UserVector<double>&, UserVector<double>&)

Reimplemented from Func.

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

Computes the product of the Hessian and a UserVector.

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.

Func::CurvatureType SumFunc::get_curvature (  )  const [inline, virtual]

Implements Func.

Definition at line 719 of file func.h.

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

Implements Func.

Definition at line 720 of file func.h.

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

Prints some information.

Prints a, b, f and g.

Parameters:
out The ostream to print to.

Reimplemented from Func.

Definition at line 726 of file func.h.


Member Data Documentation

Pointer<Func> SumFunc::f [private]

First function in sum.

Definition at line 624 of file func.h.

Pointer<Func> SumFunc::g [private]

Second function in sum.

Definition at line 627 of file func.h.

double SumFunc::a [private]

Multiplicators for the functions.

Definition at line 630 of file func.h.

double SumFunc::b [private]

Definition at line 630 of file func.h.

Definition at line 632 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