ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::function_fdf Class Reference

Class that extends gsl_function_fdf so that it can be constructed from arbitrary function objects. More...

#include <function_fdf.hpp>

Inheritance diagram for gsl::function_fdf:
Inheritance graph
Collaboration diagram for gsl::function_fdf:
Collaboration graph

Classes

struct  Concept
 This is an empty abstract base class. More...
 

Public Member Functions

 function_fdf ()
 The default constructor is only really useful for assigning to. More...
 
 function_fdf (gsl_function_fdf &v)
 Could construct from a gsl_function_fdf. More...
 
template<typename T >
 function_fdf (T &t)
 Construct from an object that implements gsl::function_fdf::Concept. More...
 
 function_fdf (function_scl &function, function_scl &dfunction)
 Construct from function_scl objects for function and derivative. More...
 
 function_fdf (function_fdf const &v)
 The copy constructor. More...
 
function_fdfoperator= (function_fdf const &v)
 The assignment operator. More...
 
 function_fdf (function_fdf &&v)
 Move constructor. More...
 
function_fdfoperator= (function_fdf &&v)
 Move operator. More...
 
 ~function_fdf ()
 The destructor unshares any shared resource. More...
 

Public Attributes

base_F * function
 This gives something for params to point to. More...
 
size_t * count
 The shared reference count: used for copying this. More...
 

Friends

template<typename T >
void function_fdf_constructor (function_fdf &fdf, T &t)
 

Detailed Description

Class that extends gsl_function_fdf so that it can be constructed from arbitrary function objects.

Since gsl::function_fdf is a subclass of gsl_function_fdf, a pointer to an object of this class can be used whenever a pointer to a gsl_function_fdf object is required. Thus, pointers to objects of this class can be used directly with the GNU Scientific Library.

There are several ways to construct a gsl::function_fdf object from arbitrary function objects. If the function object is not already implemented, implementing it as a subclass T of gsl::function_fdf::Concept will make it easy to construct using gsl::function_fdf<T>(). If the function object uses a single class T that cannot readily be modified, try something like

class FDF : public gsl::function_fdf::Concept {
public:
FDF( T& t ) : t( t );
double f( double x ){ ... }
double df( double x ){ ... }
std::pair<double,double> fdf( double x ){ ... }
private:
T& t;
};
...
FDF fdf( t );
Class that extends gsl_function_fdf so that it can be constructed from arbitrary function objects.
int df(double const h, gsl_multifit_nlinear_fdtype const fdtype, vector const &x, vector const &wts, gsl::multifit::nlinear::function_fdf &fdf, vector const &f, matrix &J, vector &work)
C++ version of gsl_multifit_nlinear_df().
gsl_multilarge_nlinear_fdf fdf
Typedef for shorthand.
This is an empty abstract base class.

You can use similar constructions if f, df and fdf are defined in different classes.

Another way to construct a gsl::function_fdf object is to start with gsl::function_scl objects f and df for the function and derivative. Then

will construct a suitable object. In general, this is less efficient than constructing from a class that implements Concept. However, the overhead of using this method is only high if there is significant benefit in calculating the values of f and df at the same time and the function objects do not take advantage of this benefit.

This class is designed for flexibility rather than efficient copying. So if objects are to be copied frequently, consider using shared pointers or the like. Moving is defined for C++11.

Definition at line 80 of file function_fdf.hpp.

Constructor & Destructor Documentation

◆ function_fdf() [1/6]

gsl::function_fdf::function_fdf ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 243 of file function_fdf.hpp.

References count, gsl::multifit::nlinear::df(), and function.

◆ function_fdf() [2/6]

gsl::function_fdf::function_fdf ( gsl_function_fdf &  v)
inlineexplicit

Could construct from a gsl_function_fdf.

This constuctor is not actually visible, but gsl::function_fdf::function_fdf<T>() will construct the object correctly.

Parameters
vThe gsl_function_fdf.

Definition at line 258 of file function_fdf.hpp.

References count, gsl::multifit::nlinear::df(), and function.

◆ function_fdf() [3/6]

template<typename T >
gsl::function_fdf::function_fdf ( T &  t)
inline

Construct from an object that implements gsl::function_fdf::Concept.

Parameters
tAn object that implements gsl::function_fdf::Concept.

Definition at line 275 of file function_fdf.hpp.

◆ function_fdf() [4/6]

gsl::function_fdf::function_fdf ( function_scl function,
function_scl dfunction 
)
inline

Construct from function_scl objects for function and derivative.

This method is not generally as efficient as constructing from a single function object.

Parameters
functionA function object for the function.
dfunctionA function object for the derivative.

Definition at line 284 of file function_fdf.hpp.

References count, gsl::multifit::nlinear::df(), and function.

◆ function_fdf() [5/6]

gsl::function_fdf::function_fdf ( function_fdf const &  v)
inline

The copy constructor.

This shares f. This constuctor is not actually visible, but gsl::function_fdf::function_fdf<T>() will construct the object correctly.

Parameters
vThe function_fdf to copy.

Definition at line 305 of file function_fdf.hpp.

References count, and gsl::multifit::nlinear::df().

◆ function_fdf() [6/6]

gsl::function_fdf::function_fdf ( function_fdf &&  v)
inline

Move constructor.

Parameters
vThe function_fdf to move.

Definition at line 338 of file function_fdf.hpp.

References count, and gsl::multifit::nlinear::df().

◆ ~function_fdf()

gsl::function_fdf::~function_fdf ( )
inline

The destructor unshares any shared resource.

Definition at line 364 of file function_fdf.hpp.

References count, and function.

Member Function Documentation

◆ operator=() [1/2]

function_fdf & gsl::function_fdf::operator= ( function_fdf &&  v)
inline

Move operator.

Parameters
vThe function_fdf to move.
Returns
A reference to f in this.

Definition at line 351 of file function_fdf.hpp.

References count, gsl::multifit::nlinear::df(), and function.

◆ operator=() [2/2]

function_fdf & gsl::function_fdf::operator= ( function_fdf const &  v)
inline

The assignment operator.

This makes a shared copy.

Parameters
vThe function_fdf to copy

Definition at line 317 of file function_fdf.hpp.

References count, gsl::multifit::nlinear::df(), and function.

Friends And Related Function Documentation

◆ function_fdf_constructor

template<typename T >
void function_fdf_constructor ( function_fdf fdf,
T &  t 
)
friend

Member Data Documentation

◆ count

size_t* gsl::function_fdf::count

The shared reference count: used for copying this.

Definition at line 238 of file function_fdf.hpp.

Referenced by function_fdf(), operator=(), and ~function_fdf().

◆ function

base_F* gsl::function_fdf::function

This gives something for params to point to.

Definition at line 234 of file function_fdf.hpp.

Referenced by function_fdf(), operator=(), and ~function_fdf().


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