bpp-phyl3  3.0.0
DataFlowNumeric.h File Reference
#include <Bpp/Numeric/Matrix/Matrix.h>
#include <Bpp/Numeric/Parameter.h>
#include <Bpp/Numeric/VectorTools.h>
#include <Bpp/Phyl/Likelihood/DataFlow/ExtendedFloat.h>
#include <Bpp/Phyl/Likelihood/DataFlow/ExtendedFloatEigen.h>
#include <Eigen/Core>
#include <algorithm>
#include <cassert>
#include <string>
#include <tuple>
#include <type_traits>
#include "DataFlow.h"
#include "Definitions.h"
+ Include dependency graph for DataFlowNumeric.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  bpp::ConstantTransitionFunction
 
struct  bpp::NoDimension
 Empty type representing no dimensions. More...
 
struct  bpp::MatrixDimension
 Basic matrix dimension type. More...
 
struct  bpp::VectorDimension
 
struct  bpp::RowVectorDimension
 
struct  bpp::Dimension< double >
 Specialisation of Dimension<T> for floating point types. More...
 
struct  bpp::Dimension< uint >
 
struct  bpp::Dimension< char >
 
struct  bpp::Dimension< std::string >
 
struct  bpp::Dimension< size_t >
 
struct  bpp::Dimension< float >
 
struct  bpp::Dimension< ExtendedFloat >
 
struct  bpp::Dimension< Parameter >
 
struct  bpp::Dimension< Eigen::Matrix< T, Rows, Cols > >
 Specialisation of Dimension<T> for eigen matrix types. More...
 
struct  bpp::Dimension< ExtendedFloatEigen< R, C, EigenType > >
 
struct  bpp::Dimension< TransitionFunction >
 
struct  bpp::NumericalDependencyTransform< T >
 Template struct used to describe a dependency transformation before compute(). More...
 
struct  bpp::NumericalDependencyTransform< Transposed< T > >
 Implementation for a dependency transposition. More...
 
class  bpp::ConstantZero< T >
 r = 0 for each component. More...
 
class  bpp::ConstantOne< T >
 r = 1 for each component. More...
 
class  bpp::NumericConstant< T >
 r = constant_value. More...
 
class  bpp::NumericMutable< T >
 r = variable_value. More...
 
class  bpp::Convert< R, F >
 r = convert(f). More...
 
class  bpp::Identity< R >
 r = id(f) More...
 

Namespaces

 bpp
 Defines the basic types of data flow nodes.
 
 bpp::numeric
 

Typedefs

template<typename eVector , typename bVector >
using bpp::ForConvert = typename std::enable_if<((std::is_same< bVector, Vdouble >::value||std::is_same< bVector, std::vector< ExtendedFloat > >::value) &&(std::is_same< eVector, Eigen::RowVectorXd >::value||std::is_same< eVector, Eigen::VectorXd >::value)), bool >::type
 
template<typename eVector >
using bpp::EFVector = typename std::enable_if<(std::is_same< eVector, ExtendedFloatRowVectorXd >::value||std::is_same< eVector, ExtendedFloatVectorXd >::value), bool >::type
 
template<typename eVector >
using bpp::EFoutput = typename std::enable_if<(std::is_same< eVector, ExtendedFloatRowVectorXd >::value||std::is_same< eVector, ExtendedFloatVectorXd >::value), bool >::type
 
template<typename eVector , typename bVector >
using bpp::ForConvert2 = typename std::enable_if<((std::is_same< bVector, Vdouble >::value||std::is_same< bVector, std::vector< ExtendedFloat > >::value) &&(std::is_same< eVector, Eigen::RowVectorXd >::value||std::is_same< eVector, Eigen::VectorXd >::value||std::is_same< eVector, ExtendedFloatVectorXd >::value||std::is_same< eVector, ExtendedFloatRowVectorXd >::value)), bool >::type
 
using bpp::TransitionFunction = std::function< VectorLik(const VectorLik &)>
 

Functions

template<typename eVector , typename bVector , ForConvert< eVector, bVector > = true>
void bpp::copyBppToEigen (const bVector &bppVector, eVector &eigenVector)
 
template void bpp::copyBppToEigen (const std::vector< ExtendedFloat > &bppVector, Eigen::VectorXd &eigenVector)
 
template void bpp::copyBppToEigen (const std::vector< ExtendedFloat > &bppVector, Eigen::RowVectorXd &eigenVector)
 
template void bpp::copyBppToEigen (const bpp::Vdouble &bppVector, Eigen::RowVectorXd &eigenVector)
 
template void bpp::copyBppToEigen (const bpp::Vdouble &bppVector, Eigen::VectorXd &eigenVector)
 
template<typename eVector , EFVector< eVector > = true>
void bpp::copyBppToEigen (const std::vector< ExtendedFloat > &bppVector, eVector &eigenVector)
 
template void bpp::copyBppToEigen (const std::vector< ExtendedFloat > &bppVector, ExtendedFloatRowVectorXd &eigenVector)
 
template<typename eVector , EFoutput< eVector > = true>
void bpp::copyBppToEigen (const Vdouble &bppVector, eVector &eigenVector)
 
template void bpp::copyBppToEigen (const bpp::Vdouble &bppVector, ExtendedFloatRowVectorXd &eigenVector)
 
void bpp::copyBppToEigen (const bpp::Matrix< double > &bppMatrix, Eigen::MatrixXd &eigenMatrix)
 
void bpp::copyBppToEigen (const bpp::Matrix< double > &bppMatrix, ExtendedFloatMatrixXd &eigenMatrix)
 
void bpp::copyBppToEigen (const std::vector< Eigen::VectorXd > &bppVector, Eigen::MatrixXd &eigenMatrix)
 
void bpp::copyBppToEigen (const std::vector< ExtendedFloatVectorXd > &bppVector, ExtendedFloatMatrixXd &eigenVector)
 
template<typename eType , typename = typename std::enable_if<(std::is_same<eType, double>::value || std::is_same<eType, ExtendedFloat>::value)>::type>
void bpp::copyEigenToBpp (const ExtendedFloatMatrixXd &eigenMatrix, std::vector< std::vector< eType >> &bppMatrix)
 
template void bpp::copyEigenToBpp (const ExtendedFloatMatrixXd &eigenMatrix, std::vector< std::vector< double >> &bppMatrix)
 
template void bpp::copyEigenToBpp (const ExtendedFloatMatrixXd &eigenMatrix, std::vector< std::vector< bpp::ExtendedFloat >> &bppMatrix)
 
template<typename eType , typename = typename std::enable_if<(std::is_same<eType, double>::value || std::is_same<eType, ExtendedFloat>::value)>::type>
void bpp::copyEigenToBpp (const Eigen::MatrixXd &eigenMatrix, std::vector< std::vector< eType >> &bppMatrix)
 
template void bpp::copyEigenToBpp (const Eigen::MatrixXd &eigenMatrix, std::vector< std::vector< double >> &bppMatrix)
 
template void bpp::copyEigenToBpp (const Eigen::MatrixXd &eigenMatrix, std::vector< std::vector< bpp::ExtendedFloat >> &bppMatrix)
 
void bpp::copyEigenToBpp (const MatrixLik &eigenMatrix, bpp::Matrix< double > &bppMatrix)
 
template<typename eVector , typename bVector , ForConvert2< bVector, eVector > = true>
void bpp::copyEigenToBpp (const bVector &eigenVector, eVector &bppVector)
 
template void bpp::copyEigenToBpp (const RowLik &eigenVector, Vdouble &bppVector)
 
template void bpp::copyEigenToBpp (const RowLik &eigenVector, std::vector< ExtendedFloat > &bppVector)
 
std::string bpp::to_string (const NoDimension &)
 
std::size_t bpp::hash (const NoDimension &)
 
bool bpp::operator== (const NoDimension &, const NoDimension &)
 
bool bpp::operator!= (const NoDimension &, const NoDimension &)
 
std::string bpp::to_string (const MatrixDimension &dim)
 
std::size_t bpp::hash (const MatrixDimension &dim)
 
bool bpp::operator== (const MatrixDimension &lhs, const MatrixDimension &rhs)
 
bool bpp::operator!= (const MatrixDimension &lhs, const MatrixDimension &rhs)
 
void bpp::numeric::checkDimensionIsSquare (const MatrixDimension &dim)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
bpp::numeric::zero (const Dimension< T > &)
 
template<typename T = void>
char bpp::numeric::zero (const Dimension< char > &)
 
template<typename T = void>
std::string bpp::numeric::zero (const Dimension< std::string > &)
 
template<typename T = void>
Parameter & bpp::numeric::zero (const Dimension< Parameter > &)
 
template<typename T = void>
ExtendedFloat bpp::numeric::zero (const Dimension< ExtendedFloat > &)
 
template<typename T , int Rows, int Cols>
auto bpp::numeric::zero (const Dimension< Eigen::Matrix< T, Rows, Cols >> &dim) -> decltype(Eigen::Matrix< T, Rows, Cols >::Zero(dim.rows, dim.cols))
 
template<int R, int C, template< int R2=R, int C2=C > class MatType>
auto bpp::numeric::zero (const Dimension< ExtendedFloatEigen< R, C, MatType >> &dim) -> decltype(ExtendedFloatEigen< R, C, MatType >::Zero(dim.rows, dim.cols))
 
template<typename T = void>
TransitionFunction bpp::numeric::zero (const Dimension< TransitionFunction > &dim)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
bpp::numeric::one (const Dimension< T > &)
 
template<typename T = void>
char bpp::numeric::one (const Dimension< char > &)
 
template<typename T = void>
std::string bpp::numeric::one (const Dimension< std::string > &)
 
template<typename T = void>
Parameter & bpp::numeric::one (const Dimension< Parameter > &)
 
template<typename T = void>
ExtendedFloat bpp::numeric::one (const Dimension< ExtendedFloat > &)
 
template<typename T , int Rows, int Cols>
auto bpp::numeric::one (const Dimension< Eigen::Matrix< T, Rows, Cols >> &dim) -> decltype(Eigen::Matrix< T, Rows, Cols >::Ones(dim.rows, dim.cols))
 
template<int R, int C, template< int R2=2, int C2=C > class MatType>
auto bpp::numeric::one (const Dimension< ExtendedFloatEigen< R, C, MatType >> &dim) -> decltype(ExtendedFloatEigen< R, C, MatType >::Ones(dim.rows, dim.cols))
 
template<typename T = void>
TransitionFunction bpp::numeric::one (const Dimension< TransitionFunction > &dim)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value>::type>
bpp::numeric::identity (const Dimension< T > &)
 
template<typename T , typename = typename std::enable_if<std::is_same<T, ExtendedFloat>::value>::type>
bpp::numeric::identity (const Dimension< ExtendedFloat > &)
 
template<typename T , int Rows, int Cols>
auto bpp::numeric::identity (const Dimension< Eigen::Matrix< T, Rows, Cols >> &dim) -> decltype(Eigen::Matrix< T, Rows, Cols >::Identity(dim.rows, dim.cols))
 
template<int R, int C, template< int R2=R, int C2=C > class MatType>
auto bpp::numeric::identity (const Dimension< ExtendedFloatEigen< R, C, MatType >> &dim) -> decltype(ExtendedFloatEigen< R, C, MatType >::Identity(dim.rows))
 
bool bpp::numeric::isinf (const double &d)
 
bool bpp::numeric::isinf (const ExtendedFloat &d)
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value || std::is_same<T, ExtendedFloat>::value>::type>
bool bpp::numeric::isIdentity (const T &t)
 
template<typename T = void>
bool bpp::numeric::isIdentity (const std::string &t)
 
template<typename Derived >
bool bpp::numeric::isIdentity (const Eigen::MatrixBase< Derived > &m)
 
template<int R, int C, template< int R2=R, int C2=C > class MatType>
bool bpp::numeric::isIdentity (const ExtendedFloatEigen< R, C, MatType > &efm)
 
template<typename R , typename F , typename = typename std::enable_if<std::is_arithmetic<R>::value || std::is_same<R, ExtendedFloat>::value>::type>
bpp::numeric::convert (const F &from, const Dimension< R > &)
 
template<typename T , int Rows, int Cols, typename F , typename = typename std::enable_if<std::is_arithmetic<F>::value>::type>
auto bpp::numeric::convert (const F &from, const Dimension< Eigen::Matrix< T, Rows, Cols >> &dim) -> decltype(Eigen::Matrix< T, Rows, Cols >::Constant(dim.rows, dim.cols, from))
 
template<int R, int C, template< int R2=R, int C2=C > class MatType, typename F , typename = typename std::enable_if<std::is_same<F, ExtendedFloat>::value || std::is_arithmetic<F>::value>::type>
auto bpp::numeric::convert (const F &from, const Dimension< ExtendedFloatEigen< R, C, MatType >> &dim) -> decltype(ExtendedFloatEigen< R, C, MatType >::Constant(dim.rows, dim.cols, from))
 
TransitionFunction bpp::numeric::convert (double from, const Dimension< TransitionFunction > &dim)
 
template<typename T , int R, int C, typename DerivedF >
const Eigen::Matrix< T, R, C > bpp::numeric::convert (const Eigen::MatrixBase< DerivedF > &from, const Dimension< Eigen::Matrix< T, R, C >> &dim, typename std::enable_if< std::is_same< DerivedF, Eigen::RowVectorXi >::value||std::is_same< DerivedF, Eigen::VectorXi >::value >::type *=0)
 
template<int R, int C, typename DerivedF >
const ExtendedFloatMatrix< R, C > bpp::numeric::convert (const Eigen::MatrixBase< DerivedF > &from, const Dimension< ExtendedFloatMatrix< R, C >> &dim, typename std::enable_if< std::is_same< DerivedF, Eigen::RowVectorXi >::value||std::is_same< DerivedF, Eigen::VectorXi >::value >::type *=0)
 
template<typename T , int Rows, int Cols, typename DerivedF >
const DerivedF & bpp::numeric::convert (const Eigen::MatrixBase< DerivedF > &from, const Dimension< Eigen::Matrix< T, Rows, Cols >> &dim, typename std::enable_if<!(std::is_same< DerivedF, Eigen::RowVectorXi >::value||std::is_same< DerivedF, Eigen::VectorXi >::value)>::type *=0)
 
template<int R, int C, typename DerivedF >
const ExtendedFloatMatrix< R, C > bpp::numeric::convert (const Eigen::MatrixBase< DerivedF > &from, const Dimension< ExtendedFloatMatrix< R, C >> &dim, typename std::enable_if<!(std::is_same< DerivedF, Eigen::RowVectorXi >::value||std::is_same< DerivedF, Eigen::VectorXi >::value)>::type *=0)
 
template<int R, int C, typename DerivedF >
const DerivedF & bpp::numeric::convert (const ExtendedFloatEigenBase< DerivedF > &from, const Dimension< ExtendedFloatMatrix< R, C >> &dim)
 
template<int R, int C>
const Eigen::Matrix< double, R, C > bpp::numeric::convert (const ExtendedFloatMatrix< R, C > &from, const Dimension< Eigen::Matrix< double, R, C >> &dim)
 
template<typename R , typename F >
void bpp::numeric::convert (R &r, const F &from, const Dimension< R > &dim)
 
template<typename R >
void bpp::numeric::convert (R &r, const R &from, const Dimension< R > &dim)
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
bpp::numeric::inverse (T t)
 
ExtendedFloat bpp::numeric::inverse (const ExtendedFloat &t)
 
template<typename Derived >
Derived bpp::numeric::inverse (ExtendedFloatEigenBase< Derived > base)
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
bpp::numeric::log (T t)
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
bpp::numeric::exp (T t)
 
template<typename T >
std::string bpp::numeric::debug (const T &t, typename std::enable_if< std::is_arithmetic< T >::value >::type *=0)
 
template<typename T >
std::string bpp::numeric::debug (const Parameter &t)
 
template<typename T = std::string>
std::string bpp::numeric::debug (const std::string &t)
 
template<typename T = ExtendedFloat>
std::string bpp::numeric::debug (const ExtendedFloat &t)
 
template<typename Derived >
std::string bpp::numeric::debug (const Eigen::MatrixBase< Derived > &m)
 
template<typename Derived >
std::string bpp::numeric::debug (const ExtendedFloatEigenBase< Derived > &m)
 
template<typename T = TransitionFunction>
std::string bpp::numeric::debug (const TransitionFunction &f)
 
template<typename T >
std::size_t bpp::numeric::hash (T t, typename std::enable_if< std::is_floating_point< T >::value||std::is_integral< T >::value >::type *=0)
 
std::size_t bpp::numeric::hash (const ExtendedFloat &ef)
 
template<typename T = std::string>
std::size_t bpp::numeric::hash (const std::string &t)
 
template<typename Derived >
std::size_t bpp::numeric::hash (const Eigen::MatrixBase< Derived > &m)
 
template<typename Derived >
std::size_t bpp::numeric::hash (const ExtendedFloatEigenBase< Derived > &efm)
 
void bpp::failureDeltaNotDerivable (const std::type_info &contextNodeType)
 
void bpp::failureNumericalDerivationNotConfigured ()
 
void bpp::checkRecreateWithoutDependencies (const std::type_info &contextNodeType, const NodeRefVec &deps)
 
template<typename Predicate >
void bpp::removeDependenciesIf (NodeRefVec &deps, Predicate p)