Loading...
Searching...
No Matches
BALL::PiecewiseFunction Class Reference

`#include <BALL/MATHS/piecewiseFunction.h>`

Inheritance diagram for BALL::PiecewiseFunction:

## Public Member Functions

Constructors and Destructors
| PiecewiseFunction ()
| PiecewiseFunction (const PiecewiseFunction &function)
| PiecewiseFunction (const std::vector< Interval > &intervals, const std::vector< Coefficients > &coeffs)
virtual | ~PiecewiseFunction ()
Assignment
PiecewiseFunction & | operator= (const PiecewiseFunction &function)
void | clear ()
Accessors
void | setIntervals (const std::vector< Interval > &intervals)
const std::vector< Interval > & | getIntervals () const
const Interval & | getInterval (double x) const
const Interval & | getInterval (Position index) const
Position | getIntervalIndex (double x) const
const Interval & | getRange () const
void | setCoefficients (const vector< Coefficients > &coefficients)
const std::vector< Coefficients > & | getCoefficients () const
const Coefficients & | getCoefficients (double x) const
const Coefficients & | getCoefficients (Position index) const
virtual double | operator() (double x) const
void | set (const std::vector< Interval > &intervals, const std::vector< Coefficients > &coeffs)
Predicates
bool | isInRange (double x) const
virtual bool | isValid () const
bool | operator== (const PiecewiseFunction &function) const

## Debugging and Diagnostics

std::vector< Interval > | intervals_
std::vector< Coefficients > | coefficients_
bool | valid_
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const

## Detailed Description

Piecewise function object. This class provides the interface for piecewise functions needed as representation of radial distribution functions (

See also
  RadialDistributionFunction). It implements the Function interface.

  Note that intervals must be disjunct and interval limits have to meet. We require the intervals to be sorted such that the lowest interval limit is the first interval of the vector.

Definition at line 34 of file piecewiseFunction.h.

## Constructor & Destructor Documentation

## PiecewiseFunction() [1/3]

BALL::PiecewiseFunction::PiecewiseFunction | ( |  | ) |

Default constructor

## PiecewiseFunction() [2/3]

BALL::PiecewiseFunction::PiecewiseFunction | ( | const PiecewiseFunction & | function | ) |

Copy constructor

## PiecewiseFunction() [3/3]

BALL::PiecewiseFunction::PiecewiseFunction | ( | const std::vector< Interval > & | intervals,
|  | const std::vector< Coefficients > & | coeffs )

Detailed constructor

## ~PiecewiseFunction()

virtual BALL::PiecewiseFunction::~PiecewiseFunction | ( |  | ) |

virtual

Destructor

## Member Function Documentation

## clear()

void BALL::PiecewiseFunction::clear | ( |  | ) |

Clear function

## dump()

virtual void BALL::PiecewiseFunction::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

virtual

Dumps the whole content of the object

Reimplemented in BALL::PiecewisePolynomial.

## getCoefficients() [1/3]

const std::vector< Coefficients > & BALL::PiecewiseFunction::getCoefficients | ( |  | ) | const

## getCoefficients() [2/3]

const Coefficients & BALL::PiecewiseFunction::getCoefficients | ( | double | x | ) | const

Get the coefficients for a given x

Exceptions

  Exception::OutOfRange | if x is out of range

## getCoefficients() [3/3]

const Coefficients & BALL::PiecewiseFunction::getCoefficients | ( | Position | index | ) | const

Get the coefficients from index

Exceptions

  Exception::IndexOverflow | if index >= intervals_.size()

## getInterval() [1/2]

const Interval & BALL::PiecewiseFunction::getInterval | ( | double | x | ) | const

Get the interval a given x belongs to

Exceptions

  Exception::OutOfRange | if x is out of range

## getInterval() [2/2]

const Interval & BALL::PiecewiseFunction::getInterval | ( | Position | index | ) | const

Get interval limits by index

Exceptions

  Exception::IndexOverflow | if index >= intervals_.size()

## getIntervalIndex()

Position BALL::PiecewiseFunction::getIntervalIndex | ( | double | x | ) | const

Get the interval index for a given x

Exceptions

  Exception::OutOfRange | if x is out of range

## getIntervals()

const std::vector< Interval > & BALL::PiecewiseFunction::getIntervals | ( |  | ) | const

Get all the intervals

## getRange()

const Interval & BALL::PiecewiseFunction::getRange | ( |  | ) | const

Return the range of the definition

## isInRange()

bool BALL::PiecewiseFunction::isInRange | ( | double | x | ) | const

Check whether a given x is in the range of definition

## isValid()

virtual bool BALL::PiecewiseFunction::isValid | ( |  | ) | const

virtual

check validity of the definition

## operator()()

virtual double BALL::PiecewiseFunction::operator() | ( | double | x | ) | const

virtual

compute the value of the piecewise function data for a given x

Reimplemented in BALL::PiecewisePolynomial.

## operator=()

PiecewiseFunction & BALL::PiecewiseFunction::operator= | ( | const PiecewiseFunction & | function | ) |

Assignemnt operator

## operator==()

bool BALL::PiecewiseFunction::operator== | ( | const PiecewiseFunction & | function | ) | const

Equality operator

## set()

void BALL::PiecewiseFunction::set | ( | const std::vector< Interval > & | intervals,
|  | const std::vector< Coefficients > & | coeffs )

## setCoefficients()

void BALL::PiecewiseFunction::setCoefficients | ( | const vector< Coefficients > & | coefficients | ) |

Set the coefficients. Note that this method does not check the vector of coefficients for sanity.

## setIntervals()

void BALL::PiecewiseFunction::setIntervals | ( | const std::vector< Interval > & | intervals | ) |

Set the intervals for the piecewise definition. Note that this method does not check the definition of the intervals for sanity.

## Member Data Documentation

## coefficients_

std::vector<Coefficients> BALL::PiecewiseFunction::coefficients_

protected

Definition at line 171 of file piecewiseFunction.h.

## intervals_

std::vector<Interval> BALL::PiecewiseFunction::intervals_

protected

Definition at line 167 of file piecewiseFunction.h.

## valid_

bool BALL::PiecewiseFunction::valid_

protected

Definition at line 173 of file piecewiseFunction.h.