Graph Framework
Loading...
Searching...
No Matches
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N > Class Template Reference

Nodes without derivatives. More...

#include <node.hpp>

Inheritance diagram for graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >:
graph::leaf_node< T, SAFE_MATH >

Public Member Functions

template<bool HAS_DF = false>
requires (HAS_DF)
std::shared_ptr< leaf_node< T, SAFE_MATH > > df (std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
 Transform node to derivative.
 no_derivative (const std::string s)
 Constructor for base leaf nodes base classes.
 no_derivative (shared_leaf< T, SAFE_MATH > arg, const std::string s)
 Constructor for straight node base classes.
 no_derivative (shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > r, const std::string s)
 Constructor for base branch nodes base classes.
 no_derivative (shared_leaf< T, SAFE_MATH > l, shared_leaf< T, SAFE_MATH > m, shared_leaf< T, SAFE_MATH > r, const std::string s)
 Constructor for base triple nodes base classes.
 no_derivative (std::array< shared_leaf< T, SAFE_MATH >, N > b, const std::string s)
 Constructor for base n branch nodes base classes.
Public Member Functions inherited from graph::leaf_node< T, SAFE_MATH >
 leaf_node (const std::string s, const size_t count, const bool pseudo)
 Construct a basic node.
virtual ~leaf_node ()
 Destructor.
virtual backend::buffer< T > evaluate ()=0
 Evaluate method.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > reduce ()
 Reduction method.
virtual void compile_preamble (std::ostringstream &stream, jit::register_map &registers, jit::visiter_map &visited, jit::register_usage &usage, jit::texture1d_list &textures1d, jit::texture2d_list &textures2d, jit::preamble_map &pre_funcs, int &avail_const_mem)
 Compile preamble.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > compile (std::ostringstream &stream, jit::register_map &registers, const jit::register_map &thread_mem, const jit::register_usage &usage)=0
 Compile the node.
virtual bool is_match (std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
 Query if the nodes match.
bool is_power_base_match (std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
 Check if the base of the powers match.
virtual void set (const T d)
 Set the value of variable data.
virtual void set (const size_t index, const T d)
 Set the value of variable data.
virtual void set (const std::vector< T > &d)
 Set the value of variable data.
virtual void set (const backend::buffer< T > &d)
 Set the value of variable data.
virtual void to_latex () const
 Convert the node to latex.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > to_vizgraph (std::stringstream &stream, jit::register_map &registers)=0
 Convert the node to vizgraph.
virtual bool is_constant () const
 Test if node is a constant.
virtual bool has_constant_zero () const
 Test the constant node has a zero.
bool is_normal ()
 Test if the result is normal.
virtual bool is_all_variables () const
 Test if all the sub-nodes terminate in variables.
virtual bool is_power_like () const
 Test if the node acts like a power of variable.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > get_power_base ()
 Get the base of a power.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > get_power_exponent () const =0
 Get the exponent of a power.
size_t get_hash () const
 Get the hash for the node.
size_t get_complexity () const
 Get the number of nodes in the subgraph.
virtual bool has_pseudo () const
 Query if the node contains pseudo variables.
virtual std::shared_ptr< leaf_node< T, SAFE_MATH > > remove_pseudo ()
 Remove pseudo variable nodes.
virtual void endline (std::ostringstream &stream, const jit::register_usage &usage, const char end=';') const
 End a line in the kernel source.

Additional Inherited Members

Public Types inherited from graph::leaf_node< T, SAFE_MATH >
typedef T base
 Type def to retrieve the backend type.
Static Public Attributes inherited from graph::leaf_node< T, SAFE_MATH >
static caches_t caches
 A per thread instance of the cache structure.
Protected Attributes inherited from graph::leaf_node< T, SAFE_MATH >
const size_t hash
 Hash for node.
const size_t complexity
 Graph complexity.
std::unordered_map< size_t, std::shared_ptr< leaf_node< T, SAFE_MATH > > > df_cache
 Cache derivative terms.
const bool contains_pseudo
 Node contains pseudo variables.

Detailed Description

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
class graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >

Nodes without derivatives.

Some functions have no derivative. This can be used as a base class to case a compile error if a derivative node is attempted.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
BASE_NODEBase code to subclass from.
NNumber of sub-nodes.

Constructor & Destructor Documentation

◆ no_derivative() [1/5]

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::no_derivative ( const std::string s)
inline

Constructor for base leaf nodes base classes.

Parameters
[in]sNode string to hash.

◆ no_derivative() [2/5]

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::no_derivative ( shared_leaf< T, SAFE_MATH > arg,
const std::string s )
inline

Constructor for straight node base classes.

Parameters
[in]argNode argument.
[in]sNode string to hash.

◆ no_derivative() [3/5]

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::no_derivative ( shared_leaf< T, SAFE_MATH > l,
shared_leaf< T, SAFE_MATH > r,
const std::string s )
inline

Constructor for base branch nodes base classes.

Parameters
[in]lLeft branch.
[in]rRight branch.
[in]sNode string to hash.

◆ no_derivative() [4/5]

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::no_derivative ( shared_leaf< T, SAFE_MATH > l,
shared_leaf< T, SAFE_MATH > m,
shared_leaf< T, SAFE_MATH > r,
const std::string s )
inline

Constructor for base triple nodes base classes.

Parameters
[in]lLeft branch.
[in]mMiddle branch.
[in]rRight branch.
[in]sNode string to hash.

◆ no_derivative() [5/5]

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::no_derivative ( std::array< shared_leaf< T, SAFE_MATH >, N > b,
const std::string s )
inline

Constructor for base n branch nodes base classes.

Parameters
[in]bArray of branches.
[in]sNode string to hash.

Member Function Documentation

◆ df()

template<jit::float_scalar T, bool SAFE_MATH = false, class BASE_NODE = leaf_node<T, SAFE_MATH>, size_t N = 1>
template<bool HAS_DF = false>
requires (HAS_DF)
std::shared_ptr< leaf_node< T, SAFE_MATH > > graph::no_derivative< T, SAFE_MATH, BASE_NODE, N >::df ( std::shared_ptr< leaf_node< T, SAFE_MATH > > x)
virtual

Transform node to derivative.

Parameters
[in]xThe variable to take the derivative to.
Returns
The derivative of the node.

Reimplemented from graph::leaf_node< T, SAFE_MATH >.


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