SumFunc Class Reference
A function to represent the sum of two functions with optional multiplicators.
More...
#include <func.h>
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 SparsityInfo & | get_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 |
SparsityInfo & | get_sparsity () |
Private Attributes |
Pointer< Func > | f |
| First function in sum.
|
Pointer< Func > | g |
| 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
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] |
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] |
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.
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.
Computes the product of the Hessian and a UserVector.
- Parameters:
-
Implements Func.
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
First function in sum.
Definition at line 624 of file func.h.
Second function in sum.
Definition at line 627 of file func.h.
Multiplicators for the functions.
Definition at line 630 of file func.h.
The documentation for this class was generated from the following file: