bpp-phyl3  3.0.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 (std::shared_ptr< const AlphabetIndex1 > alphIndex)
 
 AbstractReward (const AbstractReward &ar)
 
AbstractRewardoperator= (const AbstractReward &ar)
 
virtual ~AbstractReward ()
 
bool hasAlphabetIndex () const
 
void setAlphabetIndex (std::shared_ptr< const AlphabetIndex1 > alphIndex)
 attribution of an AlphabetIndex1 More...
 
std::shared_ptr< const AlphabetIndex1getAlphabetIndex () const
 
const AlphabetIndex1alphabetIndex () const
 
virtual Rewardclone () const =0
 
virtual std::shared_ptr< const AlphabetgetAlphabet () 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 storeAllRewards (double length, Eigen::MatrixXd &mat) const =0
 Store the rewards on a branch, for each initial and final states, and given the branch length. More...
 
virtual void setSubstitutionModel (std::shared_ptr< const SubstitutionModelInterface > model)=0
 Set the substitution model associated with this reward, if relevant. More...
 

Protected Member Functions

virtual void alphabetIndexHasChanged ()=0
 

Protected Attributes

std::shared_ptr< const AlphabetIndex1alphIndex_
 

Detailed Description

Basic implementation of the the Reward interface.

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

Definition at line 122 of file Reward.h.

Constructor & Destructor Documentation

◆ AbstractReward() [1/2]

bpp::AbstractReward::AbstractReward ( std::shared_ptr< const AlphabetIndex1 alphIndex)
inline

Definition at line 129 of file Reward.h.

◆ AbstractReward() [2/2]

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

Definition at line 133 of file Reward.h.

◆ ~AbstractReward()

virtual bpp::AbstractReward::~AbstractReward ( )
inlinevirtual

Definition at line 143 of file Reward.h.

Member Function Documentation

◆ alphabetIndex()

const AlphabetIndex1& bpp::AbstractReward::alphabetIndex ( ) const
inline

Definition at line 161 of file Reward.h.

References alphIndex_.

◆ alphabetIndexHasChanged()

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

Implemented in bpp::DecompositionReward.

Referenced by setAlphabetIndex().

◆ clone()

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

◆ 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 std::shared_ptr<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 65 of file Reward.h.

References bpp::Reward::getAlphabetIndex().

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

◆ getAlphabetIndex()

std::shared_ptr<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 159 of file Reward.h.

References alphIndex_.

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

◆ 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 75 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 146 of file Reward.h.

References alphIndex_.

◆ operator=()

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

Definition at line 137 of file Reward.h.

References alphIndex_.

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

◆ setAlphabetIndex()

void bpp::AbstractReward::setAlphabetIndex ( std::shared_ptr< const AlphabetIndex1 alphIndex)
inlinevirtual

attribution of an AlphabetIndex1

Parameters
alphIndexpointer to a AlphabetIndex1

Implements bpp::Reward.

Definition at line 153 of file Reward.h.

References alphabetIndexHasChanged(), and alphIndex_.

◆ setSubstitutionModel()

virtual void bpp::Reward::setSubstitutionModel ( std::shared_ptr< const SubstitutionModelInterface 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.

◆ storeAllRewards()

virtual void bpp::Reward::storeAllRewards ( double  length,
Eigen::MatrixXd &  mat 
) const
pure virtualinherited

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

Parameters
lengthThe length of the branch.
matA matrix to store all rewards for each initial and final states.

Implemented in bpp::DecompositionReward.

Member Data Documentation

◆ alphIndex_


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