bpp-phyl3  3.0.0
bpp::NumericalDependencyTransform< T > Struct Template Reference

Template struct used to describe a dependency transformation before compute(). More...

#include <Bpp/Phyl/Likelihood/DataFlow/DataFlowNumeric.h>

Public Types

using DepType = T
 Real type of the dependency: T in the default case. More...
 

Static Public Member Functions

static const DepTypetransform (const DepType &d)
 Transform the DepType value: do nothing in the default case. More...
 

Detailed Description

template<typename T>
struct bpp::NumericalDependencyTransform< T >

Template struct used to describe a dependency transformation before compute().

Transforms allow to generate variants of computation nodes with a readable syntax: MatrixProduct<R, T0, T1> will perform R = T0 * T1. MatrixProduct<R, Transposed<T0>, T1> will perform R = transpose(T0) * T1.

This struct is used to implement the transformation. A default case is provided that performs no transformation. Adding a new transformation type consists of declaring a type tag (like Transposed<T>), and specialising this struct for the type tag to implement the transformation. Specialisations should be recursive to allow nesting of transformations (see Transposed<T>).

The DepType field gives the real type of the dependency, removing any type tag. For Transposed<T0>, DepType = T0. DepType is used to check the dependency types (Value<DepType>), and casting during computation.

transform(const DepType & d) -> ? "performs" the transformation. By default, this just forwards the d reference, doing nothing. For Transposed<T>, this returns an Eigen expression template declaring a transposition.

A transformation must not change the result of hasNumericalProperty(), because it is not applied to it, and would make the simplifications wrong. This makes it unlikely that something other than transposition can be implemented with this model.

For now, this is only used to implement transposed variants of MatrixProduct, and Convert. This can be extended to other nodes if useful.

Definition at line 942 of file DataFlowNumeric.h.

Member Typedef Documentation

◆ DepType

template<typename T >
using bpp::NumericalDependencyTransform< T >::DepType = T

Real type of the dependency: T in the default case.

Definition at line 945 of file DataFlowNumeric.h.

Member Function Documentation

◆ transform()

template<typename T >
static const DepType& bpp::NumericalDependencyTransform< T >::transform ( const DepType d)
inlinestatic

Transform the DepType value: do nothing in the default case.

Definition at line 947 of file DataFlowNumeric.h.

Referenced by bpp::MatrixProduct< R, T0, T1 >::compute(), and bpp::NumericalDependencyTransform< Transposed< T > >::transform().


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