ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::root::fsolver Class Reference

Workspace for root finding without a derivative. More...

#include <roots.hpp>

Collaboration diagram for gsl::root::fsolver:
Collaboration graph

Public Types

typedef gsl_root_fsolver_type type
 Typedef. More...
 

Public Member Functions

 fsolver ()
 The default constructor is only really useful for assigning to. More...
 
 fsolver (type const *T)
 The default constructor creates a new fsolver of type fsolver::type. More...
 
 fsolver (gsl_root_fsolver *v)
 Could construct from a gsl_root_fsolver. More...
 
 fsolver (fsolver const &v)
 The copy constructor. More...
 
fsolveroperator= (fsolver const &v)
 The assignment operator. More...
 
 ~fsolver ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 fsolver (fsolver &&v)
 Move constructor. More...
 
fsolveroperator= (fsolver &&v)
 Move operator. More...
 
bool operator== (fsolver const &v) const
 Two fsolver are identically equal if their elements are identical. More...
 
bool operator!= (fsolver const &v) const
 Two fsolver are different if their elements are not identical. More...
 
bool operator< (fsolver const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (fsolver const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (fsolver const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (fsolver const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the fsolver is empty. More...
 
void swap (fsolver &v)
 Swap two fsolver. More...
 
gsl_root_fsolver * get () const
 Get the gsl_root_fsolver. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_root_fsolver. More...
 
size_t use_count () const
 Find how many fsolver objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int set (function_scl &f, double x_lower, double x_upper)
 C++ version of gsl_root_fsolver_set(). More...
 
int iterate ()
 C++ version of gsl_root_fsolver_iterate(). More...
 
char const * name () const
 C++ version of gsl_root_fsolver_name(). More...
 
double root () const
 C++ version of gsl_root_fsolver_root(). More...
 
double x_lower () const
 C++ version of gsl_root_fsolver_x_lower(). More...
 
double x_upper () const
 C++ version of gsl_root_fsolver_x_upper(). More...
 

Static Public Member Functions

static int set (fsolver &s, function_scl &f, double x_lower, double x_upper)
 C++ version of gsl_root_fsolver_set(). More...
 
static int iterate (fsolver &s)
 C++ version of gsl_root_fsolver_iterate(). More...
 
static std::string name (fsolver const &s)
 C++ version of gsl_root_fsolver_name(). More...
 
static double root (fsolver const &s)
 C++ version of gsl_root_fsolver_root(). More...
 
static double x_lower (fsolver const &s)
 C++ version of gsl_root_fsolver_x_lower(). More...
 
static double x_upper (fsolver const &s)
 C++ version of gsl_root_fsolver_x_upper(). More...
 
static type const * bisection ()
 Static type. More...
 
static type const * brent ()
 Static type. More...
 
static type const * falsepos ()
 Static type. More...
 

Private Attributes

gsl_root_fsolver * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Workspace for root finding without a derivative.

Also functions as a namespace for fsolver functions. This also allows for functions to be called on fsolver as an object.

Definition at line 38 of file roots.hpp.

Member Typedef Documentation

◆ type

typedef gsl_root_fsolver_type gsl::root::fsolver::type

Typedef.

Definition at line 43 of file roots.hpp.

Constructor & Destructor Documentation

◆ fsolver() [1/5]

gsl::root::fsolver::fsolver ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 47 of file roots.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ fsolver() [2/5]

gsl::root::fsolver::fsolver ( type const *  T)
inlineexplicit

The default constructor creates a new fsolver of type fsolver::type.

Parameters
TThe type of the fsolver

Definition at line 57 of file roots.hpp.

References ccgsl_pointer, and count.

◆ fsolver() [3/5]

gsl::root::fsolver::fsolver ( gsl_root_fsolver *  v)
inlineexplicit

Could construct from a gsl_root_fsolver.

This is not usually a good idea. In this case you should not use gsl_root_fsolver_free() to deallocate the memory.

Parameters
vThe fsolver

Definition at line 73 of file roots.hpp.

References ccgsl_pointer, and count.

◆ fsolver() [4/5]

gsl::root::fsolver::fsolver ( fsolver const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe fsolver to copy.

Definition at line 84 of file roots.hpp.

References ccgsl_pointer, and count.

◆ ~fsolver()

gsl::root::fsolver::~fsolver ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 103 of file roots.hpp.

References ccgsl_pointer, and count.

◆ fsolver() [5/5]

gsl::root::fsolver::fsolver ( fsolver &&  v)
inline

Move constructor.

Parameters
vThe fsolver to move.

Definition at line 115 of file roots.hpp.

References count.

Member Function Documentation

◆ bisection()

static type const * gsl::root::fsolver::bisection ( )
inlinestatic

Static type.

Returns
the named fsolver type

Definition at line 358 of file roots.hpp.

◆ brent()

static type const * gsl::root::fsolver::brent ( )
inlinestatic

Static type.

Returns
the named fsolver type

Definition at line 363 of file roots.hpp.

◆ empty()

bool gsl::root::fsolver::empty ( ) const
inline

Find if the fsolver is empty.

Returns
true if has size zero; otherwise false

Definition at line 192 of file roots.hpp.

References ccgsl_pointer.

◆ falsepos()

static type const * gsl::root::fsolver::falsepos ( )
inlinestatic

Static type.

Returns
the named fsolver type

Definition at line 368 of file roots.hpp.

◆ get()

gsl_root_fsolver * gsl::root::fsolver::get ( ) const
inline

Get the gsl_root_fsolver.

Returns
the gsl_root_fsolver

Definition at line 218 of file roots.hpp.

References ccgsl_pointer.

Referenced by iterate(), name(), root(), set(), x_lower(), and x_upper().

◆ iterate() [1/2]

int gsl::root::fsolver::iterate ( )
inline

C++ version of gsl_root_fsolver_iterate().

Returns
Error code on failure.

Definition at line 328 of file roots.hpp.

References get().

◆ iterate() [2/2]

static int gsl::root::fsolver::iterate ( fsolver s)
inlinestatic

C++ version of gsl_root_fsolver_iterate().

Parameters
sThe fsolver.
Returns
Error code on failure.

Definition at line 268 of file roots.hpp.

References get().

◆ name() [1/2]

char const * gsl::root::fsolver::name ( ) const
inline

C++ version of gsl_root_fsolver_name().

Returns
The name of the solver.

Definition at line 334 of file roots.hpp.

References get().

◆ name() [2/2]

static std::string gsl::root::fsolver::name ( fsolver const &  s)
inlinestatic

C++ version of gsl_root_fsolver_name().

Parameters
sThe fsolver.
Returns
The name of the solver.

Definition at line 276 of file roots.hpp.

References get().

◆ operator bool()

gsl::root::fsolver::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_root_fsolver.

Definition at line 238 of file roots.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::root::fsolver::operator!= ( fsolver const &  v) const
inline

Two fsolver are different if their elements are not identical.

Parameters
vThe fsolver to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 145 of file roots.hpp.

References operator==().

◆ operator<()

bool gsl::root::fsolver::operator< ( fsolver const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a fsolver is nonnegative.

Parameters
vThe fsolver to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 157 of file roots.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::root::fsolver::operator<= ( fsolver const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a fsolver is nonnegative.

Parameters
vThe fsolver to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 177 of file roots.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

fsolver & gsl::root::fsolver::operator= ( fsolver &&  v)
inline

Move operator.

Parameters
vThe fsolver to move.
Returns
A reference to this.

Definition at line 124 of file roots.hpp.

References fsolver().

◆ operator=() [2/2]

fsolver & gsl::root::fsolver::operator= ( fsolver const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe fsolver to copy

Definition at line 91 of file roots.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::root::fsolver::operator== ( fsolver const &  v) const
inline

Two fsolver are identically equal if their elements are identical.

Parameters
vThe fsolver to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 137 of file roots.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::root::fsolver::operator> ( fsolver const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a fsolver is nonnegative.

Parameters
vThe fsolver to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 167 of file roots.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::root::fsolver::operator>= ( fsolver const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a fsolver is nonnegative.

Parameters
vThe fsolver to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 187 of file roots.hpp.

References ccgsl_pointer.

◆ root() [1/2]

double gsl::root::fsolver::root ( ) const
inline

C++ version of gsl_root_fsolver_root().

Returns
The current estimate of the root of f.

Definition at line 340 of file roots.hpp.

References get().

◆ root() [2/2]

static double gsl::root::fsolver::root ( fsolver const &  s)
inlinestatic

C++ version of gsl_root_fsolver_root().

Parameters
sThe fsolver.
Returns
The current estimate of the root of f.

Definition at line 284 of file roots.hpp.

References get().

◆ set() [1/2]

static int gsl::root::fsolver::set ( fsolver s,
function_scl f,
double  x_lower,
double  x_upper 
)
inlinestatic

C++ version of gsl_root_fsolver_set().

Parameters
sThe fsolver.
fThe function to find a root of.
x_lowerThe lower bound of the initial search interval.
x_upperThe upper bound of the initial search interval.
Returns
Error code on failure.

Definition at line 248 of file roots.hpp.

References get(), x_lower(), and x_upper().

◆ set() [2/2]

int gsl::root::fsolver::set ( function_scl f,
double  x_lower,
double  x_upper 
)
inline

C++ version of gsl_root_fsolver_set().

Parameters
fThe function to find a root of.
x_lowerThe lower bound of the initial search interval.
x_upperThe upper bound of the initial search interval.
Returns
Error code on failure.

Definition at line 310 of file roots.hpp.

References get(), x_lower(), and x_upper().

◆ swap()

void gsl::root::fsolver::swap ( fsolver v)
inline

Swap two fsolver.

This works even if the fsolver have different sizes because it swaps pointers.

Parameters
vThe fsolver to swap with this.

Definition at line 199 of file roots.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::root::fsolver::unique ( ) const
inline

Find if this is the only object sharing the gsl_root_fsolver.

Returns
true or falses according as this is the only workspace object sharing the gsl_root_fsolver.

Definition at line 224 of file roots.hpp.

References count.

◆ use_count()

size_t gsl::root::fsolver::use_count ( ) const
inline

Find how many fsolver objects share this pointer.

Returns
the number of workspace objects that share this pointer.

Definition at line 229 of file roots.hpp.

References count.

◆ x_lower() [1/2]

double gsl::root::fsolver::x_lower ( ) const
inline

C++ version of gsl_root_fsolver_x_lower().

Returns
The current lower bound for the search interval.

Definition at line 346 of file roots.hpp.

References get().

Referenced by set().

◆ x_lower() [2/2]

static double gsl::root::fsolver::x_lower ( fsolver const &  s)
inlinestatic

C++ version of gsl_root_fsolver_x_lower().

Parameters
sThe fsolver.
Returns
The current lower bound for the search interval.

Definition at line 292 of file roots.hpp.

References get().

◆ x_upper() [1/2]

double gsl::root::fsolver::x_upper ( ) const
inline

C++ version of gsl_root_fsolver_x_upper().

Returns
The current upper bound for the search interval.

Definition at line 352 of file roots.hpp.

References get().

Referenced by set().

◆ x_upper() [2/2]

static double gsl::root::fsolver::x_upper ( fsolver const &  s)
inlinestatic

C++ version of gsl_root_fsolver_x_upper().

Parameters
sThe fsolver.
Returns
The current upper bound for the search interval.

Definition at line 300 of file roots.hpp.

References get().

Member Data Documentation

◆ ccgsl_pointer

gsl_root_fsolver* gsl::root::fsolver::ccgsl_pointer
private

The shared pointer.

Definition at line 207 of file roots.hpp.

Referenced by empty(), fsolver(), get(), operator bool(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), swap(), and ~fsolver().

◆ count

size_t* gsl::root::fsolver::count
private

The shared reference count.

Definition at line 211 of file roots.hpp.

Referenced by fsolver(), operator=(), swap(), unique(), use_count(), and ~fsolver().


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