bpp-phyl  2.2.0
bpp::AbstractReward Class Referenceabstract

Basic implementation of the the Reward interface. More...

#include <Bpp/Phyl/Mapping/Reward.h>

+ Inheritance diagram for bpp::AbstractReward:
+ Collaboration diagram for bpp::AbstractReward:

Public Member Functions

 AbstractReward (AlphabetIndex1 *alphIndex)
 
 AbstractReward (const AbstractReward &ar)
 
AbstractRewardoperator= (const AbstractReward &ar)
 
 ~AbstractReward ()
 
bool hasAlphabetIndex () const
 
void setAlphabetIndex (AlphabetIndex1 *alphIndex)
 
const AlphabetIndex1 * getAlphabetIndex () const
 
AlphabetIndex1 * getAlphabetIndex ()
 
virtual Rewardclone () const =0
 
virtual const Alphabet * getAlphabet () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet(). More...
 
virtual size_t getNumberOfStates () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize(). More...
 
virtual double getReward (size_t initialState, size_t finalState, double length) const =0
 Get the reward of susbstitutions on a branch, given the initial and final states, and the branch length. More...
 
virtual Matrix< double > * getAllRewards (double length) const =0
 Get the rewards on a branch, for each initial and final states, and given the branch length. More...
 
virtual void setSubstitutionModel (const SubstitutionModel *model)=0
 Set the substitution model associated with this reward, if relevant. More...
 

Protected Member Functions

virtual void alphabetIndexHasChanged ()=0
 

Protected Attributes

AlphabetIndex1 * alphIndex_
 

Detailed Description

Basic implementation of the the Reward interface.

This partial implementation deals with the AlphabetIndex1 gestion, by maintaining a pointer.

Definition at line 151 of file Reward.h.

Constructor & Destructor Documentation

◆ AbstractReward() [1/2]

bpp::AbstractReward::AbstractReward ( AlphabetIndex1 *  alphIndex)
inline

Definition at line 158 of file Reward.h.

◆ AbstractReward() [2/2]

bpp::AbstractReward::AbstractReward ( const AbstractReward ar)
inline

Definition at line 162 of file Reward.h.

◆ ~AbstractReward()

bpp::AbstractReward::~AbstractReward ( )
inline

Definition at line 173 of file Reward.h.

Member Function Documentation

◆ alphabetIndexHasChanged()

virtual void bpp::AbstractReward::alphabetIndexHasChanged ( )
protectedpure virtual

Implemented in bpp::DecompositionReward.

Referenced by setAlphabetIndex().

◆ clone()

virtual Reward* bpp::Reward::clone ( ) const
pure virtualinherited

Implemented in bpp::DecompositionReward.

◆ getAllRewards()

virtual Matrix<double>* bpp::Reward::getAllRewards ( double  length) const
pure virtualinherited

Get the rewards on a branch, for each initial and final states, and given the branch length.

Parameters
lengthThe length of the branch.
Returns
A matrix with all rewards for each initial and final states.

Implemented in bpp::DecompositionReward.

◆ getAlphabet()

virtual const Alphabet* bpp::Reward::getAlphabet ( ) const
inlinevirtualinherited

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet().

Returns
The alphabet associated to this substitution count.

Definition at line 108 of file Reward.h.

References bpp::Reward::getAlphabetIndex().

Referenced by bpp::Reward::getNumberOfStates().

◆ getAlphabetIndex() [1/2]

const AlphabetIndex1* bpp::AbstractReward::getAlphabetIndex ( ) const
inlinevirtual
Returns
The AlphabetIndex1 object associated to this instance. The alphabet index contains the value associated to each state.

Implements bpp::Reward.

Definition at line 194 of file Reward.h.

References alphIndex_.

Referenced by bpp::DecompositionReward::computeBMatrice_().

◆ getAlphabetIndex() [2/2]

AlphabetIndex1* bpp::AbstractReward::getAlphabetIndex ( )
inlinevirtual
Returns
The AlphabetIndex1 object associated to this instance. The alphabet index contains the value associated to each state.

Implements bpp::Reward.

Definition at line 196 of file Reward.h.

References alphIndex_.

◆ getNumberOfStates()

virtual size_t bpp::Reward::getNumberOfStates ( ) const
inlinevirtualinherited

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize().

Returns
The number of states in the model/alphabet.

Definition at line 115 of file Reward.h.

References bpp::Reward::getAlphabet().

◆ getReward()

virtual double bpp::Reward::getReward ( size_t  initialState,
size_t  finalState,
double  length 
) const
pure virtualinherited

Get the reward of susbstitutions on a branch, given the initial and final states, and the branch length.

Parameters
initialStateThe initial state.
finalStateThe final state.
lengthThe length of the branch.
Returns
The reward of the function on a branch of specified length and according to initial and final states.

Implemented in bpp::DecompositionReward.

◆ hasAlphabetIndex()

bool bpp::AbstractReward::hasAlphabetIndex ( ) const
inlinevirtual
Returns
Tell if an alphabet index has been attached to this class.

Implements bpp::Reward.

Definition at line 179 of file Reward.h.

References alphIndex_.

◆ operator=()

AbstractReward& bpp::AbstractReward::operator= ( const AbstractReward ar)
inline

Definition at line 166 of file Reward.h.

References alphIndex_.

Referenced by bpp::DecompositionReward::operator=().

◆ setAlphabetIndex()

void bpp::AbstractReward::setAlphabetIndex ( AlphabetIndex1 *  alphind)
inlinevirtual
Parameters
alphindThe new AlphabetIndex1 object to be associated to this instance.

Implements bpp::Reward.

Definition at line 188 of file Reward.h.

References alphabetIndexHasChanged(), and alphIndex_.

◆ setSubstitutionModel()

virtual void bpp::Reward::setSubstitutionModel ( const SubstitutionModel model)
pure virtualinherited

Set the substitution model associated with this reward, if relevant.

Parameters
modelThe substitution model to use with this reward.

Implemented in bpp::DecompositionReward.

Member Data Documentation

◆ alphIndex_


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