bpp-core3  3.0.0
bpp::Simplex Class Reference

A Simplex object, used to define sets of probabilities that sum 1. More...

#include <Bpp/Numeric/Prob/Simplex.h>

+ Inheritance diagram for bpp::Simplex:
+ Collaboration diagram for bpp::Simplex:

Public Member Functions

 Simplex (size_t dim, unsigned short method=0, bool allowNull=false, const std::string &name="Simplex.")
 Builds a new Simplex object from a number of probabilities. They are initialized equal. More...
 
 Simplex (const std::vector< double > &probas, unsigned short method=0, bool allowNull=false, const std::string &name="Simplex.")
 Builds a new Simplex object from a vector of probabilities. More...
 
virtual ~Simplex ()
 
Simplexclone () const
 Create a copy of this object and send a pointer to it. More...
 
void fireParameterChanged (const ParameterList &parameters)
 Notify the class when one or several parameters have changed. More...
 
size_t dimension () const
 
void setFrequencies (const std::vector< double > &)
 
const std::vector< double > & getFrequencies () const
 
std::vector< double > & getFrequencies ()
 
double prob (size_t i) const
 
unsigned short getMethod () const
 
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names. More...
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 Get the minimal list of parameters to set the model. More...
 
size_t getNumberOfIndependentParameters () const
 Get the number of independent parameters. More...
 
void aliasParameters (const std::string &p1, const std::string &p2)
 alias the parameters. More...
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden. More...
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 Detach two parameters previously set as 'aliased'. More...
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list. More...
 
ParameterList getFromParameters (const ParameterList &pl) const
 Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not). More...
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 Tell if there is a parameter with specified name. More...
 
const ParameterListgetParameters () const override
 Get all parameters available. More...
 
const Parameterparameter (const std::string &name) const override
 Get the parameter with specified name. More...
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 Get the value for parameter of name 'name'. More...
 
void setAllParametersValues (const ParameterList &parameters) override
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value) override
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
void removeConstraint (const std::string &name) override
 Remove the constraint associated with one parameter, if any. More...
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 Set/Change the constraint associated with one parameter. More...
 
size_t getNumberOfParameters () const override
 Get the number of parameters. More...
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 Resolves a parameter name according to the current namespace. More...
 

Protected Member Functions

void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 Get all parameters available. More...
 

Private Attributes

size_t dim_
 The dimension+1 of the space simplex (ie the number of probabilities). More...
 
unsigned short method_
 the method of parametrization. More...
 
std::vector< double > vProb_
 
std::vector< double > valpha_
 just used with local ratio (method 2) More...
 

Detailed Description

A Simplex object, used to define sets of probabilities that sum 1.

The probabilities are denoted $p_i$ for $i \in <1,n>$.

If they are parametrized, the parameters are called "theta1", ..., "theta(n-1)".

Three ways of parametrization are available:

Global ratio:

$\forall i<n, \theta_i=\frac{p_i}{1-(p_1+...+p_{i-1})}$.

In the reverse, $\forall i<n, p_i= (1-\theta_1).(1-\theta_2)...\theta_{i}$ and $p_n=(1-\theta_1).(1-\theta_2)...(1-\theta_{n-1})$.

Local ratio:

$\theta_i = \frac{p_i}{p_i+p_{i+1}} \forall i \in 1..\textrm{n-1}$.

In the reverse if we denote $\alpha_i=\frac{1-\theta_i}{\theta_i}$, $p_i=\frac{\alpha_1...\alpha_{i-1}}{1+\sum_{k=1}^{n-1}\alpha_1...\alpha_k}$.

Binary:

This parametrization is based on the binary coding.

Given $a_b...a_1$ the writing of i in binary, we denote $i_k=a_k...a_1$.

Given $a_b...a_1$ the writing of i in binary where $a_b=1$, we denote $1_i=\sum_j\{p_{j+1} \text{ such that } j_b=1i_{b-1}\}$ and $0_i=\sum_j\{p_{j+1} \text{ such that } j_b=0i_{b-1}\}$, and then we define:

$\theta_i=\frac{1_i}{1_i+0_i}$

and on the reverse, we denote $\theta'_{0i_{b-1}}=1-\theta_i$ and $\theta'_{1i_{b-1}}=\theta_i$.

Then, if $c=ceil(log_2(n))$, for $i \in <0,n-1>$.

$p_{i+1}=\theta'_{i_c}....\theta'_{i_1} $

Definition at line 66 of file Simplex.h.

Constructor & Destructor Documentation

◆ Simplex() [1/2]

Simplex::Simplex ( size_t  dim,
unsigned short  method = 0,
bool  allowNull = false,
const std::string &  name = "Simplex." 
)

Builds a new Simplex object from a number of probabilities. They are initialized equal.

Parameters
dimThe number of probabilities.
methodtells the method of parametrization (default 0) 0: No parametrization 1: Global ratio 2: Local ratio 3: Binary
allowNullif null probabilites are allowed (default: false)
nameThe name passed to AbstractParameterAliasable constructor.

Definition at line 84 of file Simplex.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), dim_, method_, bpp::Parameter::PROP_CONSTRAINT_EX, bpp::Parameter::PROP_CONSTRAINT_IN, setFrequencies(), bpp::TextTools::toString(), valpha_, and vProb_.

Referenced by clone().

◆ Simplex() [2/2]

Simplex::Simplex ( const std::vector< double > &  probas,
unsigned short  method = 0,
bool  allowNull = false,
const std::string &  name = "Simplex." 
)

Builds a new Simplex object from a vector of probabilities.

Parameters
probasThe vector of probabilities.
methodtells the method of parametrization (default 0) 0: No parametrization 1: Global ratio 2: Local ratio 3: Binary
allowNullif null probabilites are allowed (default: false)
nameThe name passed to AbstractParameterAliasable constructor.

Definition at line 12 of file Simplex.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), dim_, method_, bpp::Parameter::PROP_CONSTRAINT_EX, bpp::Parameter::PROP_CONSTRAINT_IN, bpp::NumConstants::SMALL(), bpp::VectorTools::sum(), bpp::TextTools::toString(), valpha_, and vProb_.

◆ ~Simplex()

virtual bpp::Simplex::~Simplex ( )
inlinevirtual

Definition at line 125 of file Simplex.h.

Member Function Documentation

◆ addParameter_()

◆ addParameters_()

◆ aliasParameters() [1/2]

◆ aliasParameters() [2/2]

void AbstractParameterAliasable::aliasParameters ( std::map< std::string, std::string > &  unparsedParams,
bool  verbose 
)
virtualinherited

alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.

Parameters
unparsedParamsthe map of the links : <A,B> matches for A->B aliasing.
verboseverbosity

Implements bpp::ParameterAliasable.

Definition at line 120 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasParameters(), bpp::ParameterList::clone(), bpp::Parameter::clone(), bpp::ApplicationTools::displayResult(), bpp::AbstractParametrizable::getParameters(), bpp::Parameter::getValue(), bpp::ParameterList::hasParameter(), bpp::AbstractParametrizable::matchParametersValues(), bpp::ParameterList::parameter(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ clone()

Simplex* bpp::Simplex::clone ( ) const
inlinevirtual

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

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 127 of file Simplex.h.

References fireParameterChanged(), and Simplex().

◆ deleteParameter_() [1/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( size_t  index)
inlineprotectedvirtualinherited

◆ deleteParameter_() [2/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( std::string &  name)
inlineprotectedvirtualinherited

◆ deleteParameters_()

void bpp::AbstractParameterAliasable::deleteParameters_ ( const std::vector< std::string > &  names)
inlineprotectedvirtualinherited

Reimplemented from bpp::AbstractParametrizable.

Definition at line 252 of file AbstractParameterAliasable.h.

◆ dimension()

size_t bpp::Simplex::dimension ( ) const
inline

Definition at line 132 of file Simplex.h.

References dim_, and setFrequencies().

◆ fireParameterChanged()

void Simplex::fireParameterChanged ( const ParameterList parameters)
virtual

Notify the class when one or several parameters have changed.

Parameters
parametersA ParameterList object with parameters that changed.

Reimplemented from bpp::AbstractParametrizable.

Reimplemented in bpp::OrderedSimplex.

Definition at line 132 of file Simplex.cpp.

References dim_, bpp::AbstractParametrizable::getParameterValue(), method_, bpp::NumConstants::TINY(), bpp::TextTools::toString(), valpha_, and vProb_.

Referenced by clone(), bpp::OrderedSimplex::fireParameterChanged(), and bpp::OrderedSimplex::OrderedSimplex().

◆ getAlias()

vector< string > AbstractParameterAliasable::getAlias ( const std::string &  name) const
virtualinherited
Returns
The list of names of the parameters that are aliased with a given parameter. The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
Parameters
nameThe name of the parameter to look for.

Implements bpp::ParameterAliasable.

Definition at line 204 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, and bpp::VectorTools::append().

Referenced by bpp::AbstractParameterAliasable::getAliases(), and bpp::ParametrizableCollection< N >::removeObject().

◆ getAliasedParameters()

ParameterList AbstractParameterAliasable::getAliasedParameters ( const ParameterList pl) const
inherited

Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list.

Definition at line 244 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getAliases()

std::map< std::string, std::string > AbstractParameterAliasable::getAliases ( ) const
virtualinherited

◆ getFrequencies() [1/2]

const std::vector<double>& bpp::Simplex::getFrequencies ( ) const
inline

Definition at line 136 of file Simplex.h.

References vProb_.

Referenced by bpp::OrderedSimplex::fireParameterChanged(), and bpp::OrderedSimplex::OrderedSimplex().

◆ getFrequencies() [2/2]

std::vector<double>& bpp::Simplex::getFrequencies ( )
inline

Definition at line 138 of file Simplex.h.

References vProb_.

◆ getFrom()

string AbstractParameterAliasable::getFrom ( const std::string &  name) const
inherited
Returns
The name of the parameter from which a given parameter is aliased.
Parameters
nameThe name of the parameter to look for.

Definition at line 280 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_.

◆ getFromParameters()

ParameterList AbstractParameterAliasable::getFromParameters ( const ParameterList pl) const
inherited

Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not).

Definition at line 297 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getIndependentParameters()

const ParameterList& bpp::AbstractParameterAliasable::getIndependentParameters ( ) const
inlinevirtualinherited

Get the minimal list of parameters to set the model.

If no parameters are aliased, this is the same a getParameters().

Returns
A minimal set of parameters.

Implements bpp::ParameterAliasable.

Definition at line 135 of file AbstractParameterAliasable.h.

◆ getMethod()

unsigned short bpp::Simplex::getMethod ( ) const
inline

Definition at line 142 of file Simplex.h.

References method_.

◆ getNamespace()

std::string bpp::AbstractParametrizable::getNamespace ( ) const
inlineoverridevirtualinherited

◆ getNumberOfIndependentParameters()

size_t bpp::AbstractParameterAliasable::getNumberOfIndependentParameters ( ) const
inlinevirtualinherited

Get the number of independent parameters.

Returns
The number of independent parameters. If no parameters are aliased, this is equivalent to the getNumberOfParameters() method.

Implements bpp::ParameterAliasable.

Definition at line 137 of file AbstractParameterAliasable.h.

References bpp::AliasParameterListener::getAlias(), bpp::AliasParameterListener::getFrom(), and bpp::ParameterList::size().

◆ getNumberOfParameters()

◆ getParameter() [1/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( const std::string &  name) const
inlineinherited

◆ getParameter() [2/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i) const
inlineprotectedinherited
Returns
The shared_ptr parameter at a given position.
Warning
No check is performed on the validity of the index given as input!

Definition at line 211 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter() [3/3]

std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i)
inlineprotectedinherited

Definition at line 216 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter_() [1/3]

◆ getParameter_() [2/3]

Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index)
inlineprotectedinherited

Definition at line 190 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameter_() [3/3]

const Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index) const
inlineprotectedinherited

Definition at line 197 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameterNameWithoutNamespace()

std::string AbstractParametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const
overridevirtualinherited

Resolves a parameter name according to the current namespace.

Returns
The parameter name without the namespace prefix, if any.

Implements bpp::Parametrizable.

Definition at line 28 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParametrizable::getNamespace(), and bpp::AbstractParameterAliasable::operator=().

◆ getParameters()

const ParameterList& bpp::AbstractParametrizable::getParameters ( ) const
inlineoverridevirtualinherited

◆ getParameters_()

ParameterList& bpp::AbstractParametrizable::getParameters_ ( )
inlineoverrideprotectedvirtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 205 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::aliasParameters(), and bpp::AbstractParameterAliasable::operator=().

◆ getParameterValue()

◆ getParameterWithNamespace_() [1/2]

Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name)
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 176 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_().

◆ getParameterWithNamespace_() [2/2]

const Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) const
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 185 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameter().

◆ hasIndependentParameter()

bool bpp::AbstractParameterAliasable::hasIndependentParameter ( const std::string &  name) const
inlineinherited

Definition at line 133 of file AbstractParameterAliasable.h.

References bpp::ParameterList::hasParameter().

◆ hasParameter()

bool bpp::AbstractParametrizable::hasParameter ( const std::string &  name) const
inlineoverridevirtualinherited

Tell if there is a parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
y/n.

Implements bpp::Parametrizable.

Definition at line 39 of file AbstractParametrizable.h.

References bpp::ParameterList::hasParameter().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AbstractParametrizable::getParameter_(), and bpp::AbstractParameterAliasable::unaliasParameters().

◆ includeParameters_()

void bpp::AbstractParameterAliasable::includeParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

◆ matchParametersValues()

bool bpp::AbstractParametrizable::matchParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

Only common parameters with parameters will be updated.

Parameters
parametersA list of parameters.
Returns
True if at least one parameter value has been changed.
Exceptions
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 76 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::ParameterList::shareSubList().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().

◆ parameter()

const Parameter& bpp::AbstractParametrizable::parameter ( const std::string &  name) const
inlineoverridevirtualinherited

◆ prob()

double bpp::Simplex::prob ( size_t  i) const
inline

Definition at line 140 of file Simplex.h.

◆ removeConstraint()

void bpp::AbstractParametrizable::removeConstraint ( const std::string &  name)
inlineoverridevirtualinherited

Remove the constraint associated with one parameter, if any.

Parameters
nameThe name of the parameter to look for.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 85 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::removeConstraint().

◆ resetParameters_()

void bpp::AbstractParameterAliasable::resetParameters_ ( )
inlineprotectedinherited

◆ setAllParametersValues()

void bpp::AbstractParametrizable::setAllParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Set the parameters values to be equals to those of parameters.

The list must contain exactly the same parameters (ie same names) than the parameters available.

Parameters
parametersA list with all parameters.
Exceptions
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 58 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setAllParametersValues().

◆ setConstraint()

void bpp::AbstractParametrizable::setConstraint ( const std::string &  name,
std::shared_ptr< ConstraintInterface constraint 
)
inlineoverridevirtualinherited

Set/Change the constraint associated with one parameter.

Parameters
nameThe name of the parameter to look for.
constraintA pointer to the constraint (may be null)
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 90 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::setConstraint().

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

◆ setFrequencies()

◆ setNamespace()

void AbstractParameterAliasable::setNamespace ( const std::string &  prefix)
virtualinherited

Set the namespace for the parameter names.

Parameters
prefixThe 'namespace', that is a prefix to add to all parameter names. If parameter names are already prefixed, the new prefix will be used instead.

Implements bpp::Parametrizable.

Reimplemented in bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 186 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getNamespace(), bpp::AbstractParametrizable::setNamespace(), and bpp::TextTools::startsWith().

Referenced by bpp::InvariantMixedDiscreteDistribution::setNamespace(), and bpp::MixtureOfDiscreteDistributions::setNamespace().

◆ setParametersValues()

void bpp::AbstractParametrizable::setParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

parameters must be a subset of all parameters available.

Parameters
parametersA list containing all parameters to update.
Exceptions
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 70 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParametersValues().

Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), bpp::RescaledHmmLikelihood::setParameters(), and bpp::LogsumHmmLikelihood::setParameters().

◆ setParameterValue()

void bpp::AbstractParametrizable::setParameterValue ( const std::string &  name,
double  value 
)
inlineoverridevirtualinherited

Set the value of parameter with name name to be equal to value.

Parameters
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf value does not match the constraint associated to parameter name.

Implements bpp::Parametrizable.

Definition at line 64 of file AbstractParametrizable.h.

References bpp::ParameterList::createSubList(), bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParameterValue().

◆ shareParameter_()

void bpp::AbstractParameterAliasable::shareParameter_ ( const std::shared_ptr< Parameter > &  parameter)
inlineprotectedvirtualinherited

◆ shareParameters_()

void bpp::AbstractParameterAliasable::shareParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

◆ unaliasParameters()

void AbstractParameterAliasable::unaliasParameters ( const std::string &  p1,
const std::string &  p2 
)
virtualinherited

Detach two parameters previously set as 'aliased'.

The values of the two parameters will now be independent.

Parameters
p1Original parameter.
p2Aliased parameter.
Exceptions
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid dissociation.

Implements bpp::ParameterAliasable.

Definition at line 168 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getParameter(), bpp::AbstractParametrizable::getParameter_(), bpp::AbstractParametrizable::hasParameter(), bpp::AbstractParameterAliasable::independentParameters_, bpp::Parameter::removeParameterListener(), and bpp::ParameterList::shareParameter().

Referenced by bpp::ParametrizableCollection< N >::removeObject().

Member Data Documentation

◆ dim_

size_t bpp::Simplex::dim_
private

The dimension+1 of the space simplex (ie the number of probabilities).

Definition at line 74 of file Simplex.h.

Referenced by dimension(), fireParameterChanged(), setFrequencies(), and Simplex().

◆ method_

unsigned short bpp::Simplex::method_
private

the method of parametrization.

0: No parametrization 1: Global ratio 2: Local ratio 3: Binary

Definition at line 84 of file Simplex.h.

Referenced by fireParameterChanged(), getMethod(), setFrequencies(), and Simplex().

◆ valpha_

std::vector<double> bpp::Simplex::valpha_
private

just used with local ratio (method 2)

Definition at line 91 of file Simplex.h.

Referenced by fireParameterChanged(), setFrequencies(), and Simplex().

◆ vProb_

std::vector<double> bpp::Simplex::vProb_
private

Definition at line 86 of file Simplex.h.

Referenced by fireParameterChanged(), getFrequencies(), and Simplex().


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