bpp-core  2.1.0
bpp::RTransformedParameter Class Reference

Parameter transformation from ] b, +inf [ or ] -inf, b [ to ]-inf, + inf [. More...

#include <Bpp/Numeric/TransformedParameter.h>

+ Inheritance diagram for bpp::RTransformedParameter:
+ Collaboration diagram for bpp::RTransformedParameter:

List of all members.

Public Member Functions

 RTransformedParameter (const std::string &name, double value, double bound=0, bool positive=true, double scale=1)
 Build a new RTransformedParameter, with given bound and scale.
RTransformedParameterclone () const
 Create a copy of this object and send a pointer to it.
void setOriginalValue (double value) throw (ConstraintException)
 Set the value of the parameter using the orignal coordinate system.
double getOriginalValue () const
double getFirstOrderDerivative () const throw (NotImplementedException)
double getSecondOrderDerivative () const throw (NotImplementedException)
virtual void setName (const std::string &name)
 Set the name of this parameter.
virtual void setValue (double value) throw (ConstraintException)
 Set the value of this parameter.
void setPrecision (double precision)
 Set the precision of this parameter.
virtual const std::string & getName () const
 Get the name of this parameter.
virtual double getValue () const
 Get the value of this parameter.
virtual double getPrecision () const
 Get the precision of this parameter.
virtual const ConstraintgetConstraint () const
 Return the constraint associated to this parameter if there is one.
virtual ConstraintgetConstraint ()
 Return the constraint associated to this parameter if there is one.
virtual bool hasConstraint () const
 Tells if this parameter has a constraint.
virtual const ConstraintremoveConstraint ()
 Remove the constraint associated to this parameter.
virtual void setConstraint (Constraint *constraint, bool attach=false)
 Set a constraint to this parameter.
virtual void addParameterListener (ParameterListener *listener, bool attachListener=true)
 Add a new listener to this parameter.
virtual void removeParameterListener (const std::string &listenerId)
 Remove all listeners with a given id from this parameter.
virtual bool hasParameterListener (const std::string &listenerId)
 Tell is there is a listener with a given id from this parameter.

Static Public Attributes

static const IntervalConstraint R_PLUS
static const IntervalConstraint R_PLUS_STAR
static const IntervalConstraint R_MINUS
static const IntervalConstraint R_MINUS_STAR
static const IntervalConstraint PROP_CONSTRAINT_IN
static const IntervalConstraint PROP_CONSTRAINT_EX

Protected Member Functions

void fireParameterNameChanged (ParameterEvent &event)
void fireParameterValueChanged (ParameterEvent &event)

Protected Attributes

std::string name_
double value_
double precision_
Constraintconstraint_
bool attach_
std::vector< ParameterListener * > listeners_
std::vector< bool > listenerAttach_

Private Attributes

double scale_
double bound_
bool positive_

Detailed Description

Parameter transformation from ] b, +inf [ or ] -inf, b [ to ]-inf, + inf [.

The equation of the tranformation is

\[ x' = \begin{cases} \log(a\cdot(x-b)) & \text{if $x < b+1$},\\ a(x-1-b) & \text{if $a \geq b+1$}. \end{cases} \]

for a transformation from ] b, +inf [ to ]-inf, + inf [. The 'b' parameter is the lower bound and 'a' is a scaling factor set to 1 by default. For a transformation from ] -inf, b [, the transformation is then

\[ x' = \begin{cases} -\log(-a\cdot(x-b)) & \text{if $x < b-1$},\\ -a(x-1-b) & \text{if $a \geq b-1$}. \end{cases} \]

Definition at line 117 of file TransformedParameter.h.


Constructor & Destructor Documentation

bpp::RTransformedParameter::RTransformedParameter ( const std::string &  name,
double  value,
double  bound = 0,
bool  positive = true,
double  scale = 1 
) [inline]

Build a new RTransformedParameter, with given bound and scale.

Parameters:
namethe name of the parameter.
valuethe value of th eparameter, in orginal coordinates.
boundthe inerval bound to use.
positivetell if the original interval is positive or negative.
scalethe scaling factor.

Definition at line 135 of file TransformedParameter.h.

References bpp::TransformedParameter::setOriginalValue().


Member Function Documentation

virtual void bpp::Parameter::addParameterListener ( ParameterListener listener,
bool  attachListener = true 
) [inline, virtual, inherited]

Add a new listener to this parameter.

Parameters:
listenerThe listener to add.
attachListenerTell if the parameter will own this listener. If so, deep copies will be made when cloning the parameter, and the listener will be destroyed upon destruction of the parameter or upon removal. Alternatively, only superficial copies will be made, and the listener will persist if the parameter is destroyed.

Definition at line 299 of file Parameter.h.

References bpp::Parameter::listenerAttach_, and bpp::Parameter::listeners_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters().

Create a copy of this object and send a pointer to it.

Returns:
A pointer toward the copy object.

Implements bpp::TransformedParameter.

Definition at line 144 of file TransformedParameter.h.

void bpp::Parameter::fireParameterNameChanged ( ParameterEvent event) [inline, protected, inherited]

Definition at line 321 of file Parameter.h.

References bpp::Parameter::listeners_.

Referenced by bpp::Parameter::setName().

void bpp::Parameter::fireParameterValueChanged ( ParameterEvent event) [inline, protected, inherited]

Definition at line 326 of file Parameter.h.

References bpp::Parameter::listeners_.

virtual const Constraint* bpp::Parameter::getConstraint ( ) const [inline, virtual, inherited]

Return the constraint associated to this parameter if there is one.

Returns:
A pointer toward the constraint, or NULL if there is no constraint.

Definition at line 255 of file Parameter.h.

References bpp::Parameter::constraint_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::ReparametrizationFunctionWrapper::init_(), bpp::ParameterList::matchParametersValues(), bpp::ParameterList::setParametersValues(), and bpp::ParameterList::testParametersValues().

virtual Constraint* bpp::Parameter::getConstraint ( ) [inline, virtual, inherited]

Return the constraint associated to this parameter if there is one.

Returns:
A pointer toward the constraint, or NULL if there is no constraint.

Definition at line 262 of file Parameter.h.

References bpp::Parameter::constraint_.

Returns:
The first order derivative of the transformation at the original point.
Exceptions:
NotImplementedExceptionif the transformation does not support derivation or if the derivation was not implemented.

Implements bpp::TransformedParameter.

Definition at line 167 of file TransformedParameter.h.

References bpp::Parameter::getValue().

double bpp::RTransformedParameter::getOriginalValue ( ) const [inline, virtual]
Returns:
The current value of the parameter in orignal coordinates.

Implements bpp::TransformedParameter.

Definition at line 156 of file TransformedParameter.h.

References bpp::Parameter::getValue().

virtual double bpp::Parameter::getPrecision ( ) const [inline, virtual, inherited]

Get the precision of this parameter.

Returns:
The precision value.

Definition at line 248 of file Parameter.h.

References bpp::Parameter::precision_.

Returns:
The second order derivative of the transformation at the original point.
Exceptions:
NotImplementedExceptionif the transformation does not support derivation or if the derivation was not implemented.

Implements bpp::TransformedParameter.

Definition at line 178 of file TransformedParameter.h.

References bpp::Parameter::getValue().

virtual bool bpp::Parameter::hasConstraint ( ) const [inline, virtual, inherited]

Tells if this parameter has a constraint.

Returns:
True if this parameter has a contraint.

Definition at line 269 of file Parameter.h.

References bpp::Parameter::constraint_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::ParameterList::matchParametersValues(), bpp::ParameterList::setParametersValues(), and bpp::ParameterList::testParametersValues().

bool Parameter::hasParameterListener ( const std::string &  listenerId) [virtual, inherited]

Tell is there is a listener with a given id from this parameter.

Parameters:
listenerIdThe id of listener to remove.
Returns:
True if at list one listener with the given id was found.

Definition at line 187 of file Parameter.cpp.

References bpp::Parameter::listeners_.

const Constraint * Parameter::removeConstraint ( ) [virtual, inherited]

Remove the constraint associated to this parameter.

Warning! The contraint objet is not deleted.

Returns:
A pointer toward the formerly used contraint.

Definition at line 163 of file Parameter.cpp.

References bpp::Parameter::constraint_.

Referenced by bpp::SimpleDiscreteDistribution::restrictToConstraint().

void Parameter::removeParameterListener ( const std::string &  listenerId) [virtual, inherited]

Remove all listeners with a given id from this parameter.

Parameters:
listenerIdThe id of listener to remove.

Definition at line 172 of file Parameter.cpp.

References bpp::Parameter::listenerAttach_, and bpp::Parameter::listeners_.

void Parameter::setConstraint ( Constraint constraint,
bool  attach = false 
) [virtual, inherited]

Set a constraint to this parameter.

Parameters:
constrainta pointer to the constraint (may be null)
attachsays if the constraint is attached to the Parameter (default: false).
Returns:
A pointer toward the formerly used contraint.

Constraint:

Definition at line 143 of file Parameter.cpp.

References bpp::Parameter::attach_, bpp::Parameter::constraint_, bpp::Constraint::isCorrect(), and bpp::Parameter::value_.

Referenced by bpp::ConstantDistribution::restrictToConstraint(), bpp::TruncatedExponentialDiscreteDistribution::restrictToConstraint(), and bpp::SimpleDiscreteDistribution::restrictToConstraint().

virtual void bpp::Parameter::setName ( const std::string &  name) [inline, virtual, inherited]

Set the name of this parameter.

Parameters:
namethe new parameter name.

Definition at line 208 of file Parameter.h.

References bpp::Parameter::fireParameterNameChanged(), and bpp::Parameter::name_.

void bpp::RTransformedParameter::setOriginalValue ( double  value) throw (ConstraintException) [inline, virtual]

Set the value of the parameter using the orignal coordinate system.

Parameters:
valueParameter value in original coordinates.
Exceptions:
ConstraintExceptionif the value is not correct.

Implements bpp::TransformedParameter.

Definition at line 147 of file TransformedParameter.h.

References bpp::Parameter::setValue().

void Parameter::setPrecision ( double  precision) [inherited]

Set the precision of this parameter.

Parameters:
precisionthe new parameter precision.

Precision:

Definition at line 136 of file Parameter.cpp.

References bpp::Parameter::precision_.


Member Data Documentation

Definition at line 122 of file TransformedParameter.h.

std::string bpp::Parameter::name_ [protected, inherited]

Definition at line 123 of file TransformedParameter.h.

double bpp::Parameter::precision_ [protected, inherited]

Definition at line 338 of file Parameter.h.

const IntervalConstraint Parameter::R_MINUS [static, inherited]

Definition at line 335 of file Parameter.h.

const IntervalConstraint Parameter::R_MINUS_STAR [static, inherited]

Definition at line 336 of file Parameter.h.

Definition at line 121 of file TransformedParameter.h.

double bpp::Parameter::value_ [protected, inherited]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends