Graph Framework
Loading...
Searching...
No Matches
graph::argument_node< T, SAFE_MATH > Class Template Referencefinal

Node class to contain the index argument. More...

#include <piecewise.hpp>

Inheritance diagram for graph::argument_node< T, SAFE_MATH >:
graph::no_derivative< T, false, straight_node< T, false > > graph::straight_node< T, false > graph::leaf_node< T, SAFE_MATH >

Public Member Functions

 argument_node (shared_leaf< T, SAFE_MATH > x, const T scale, const T offset, const size_t length)
 Construct an Argument node.
virtual backend::buffer< T > evaluate ()
 Evaluate the argument.
virtual shared_leaf< T, SAFE_MATH > reduce ()
 Reduction method.
virtual shared_leaf< T, SAFE_MATH > compile (std::ostringstream &stream, jit::register_map &registers, const jit::register_map &thread_mem, const jit::register_usage &usage)
 Compile the node.
virtual bool is_match (shared_leaf< T, SAFE_MATH > x)
 Query if the nodes match.
T get_scale () const
 Get argument scale.
T get_offset () const
 Get argument offset.
size_t get_size () const
 Get the size of the array.
virtual shared_leaf< T, SAFE_MATH > to_vizgraph (std::stringstream &stream, jit::register_map &registers)
 Convert the node to vizgraph.
Public Member Functions inherited from graph::no_derivative< T, false, straight_node< T, false > >
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.
Public Member Functions inherited from graph::straight_node< T, false >
 straight_node (shared_leaf< T, SAFE_MATH > a, const std::string s)
 Construct a straight node.
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.
shared_leaf< T, SAFE_MATH > get_arg () const
 Get the argument.
virtual bool is_all_variables () const
 Test if node acts like a variable.
virtual shared_leaf< T, SAFE_MATH > get_power_exponent () const
 Get the exponent of a power.
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 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 to_latex () const
 Convert the node to latex.
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_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.
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::straight_node< T, false >
shared_leaf< T, SAFE_MATH > arg
 Argument.
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 graph::argument_node< T, SAFE_MATH >

Node class to contain the index argument.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.

Constructor & Destructor Documentation

◆ argument_node()

template<jit::float_scalar T, bool SAFE_MATH = false>
graph::argument_node< T, SAFE_MATH >::argument_node ( shared_leaf< T, SAFE_MATH > x,
const T scale,
const T offset,
const size_t length )
inline

Construct an Argument node.

Parameters
[in]xArgument.
[in]scaleScale factor for the argument.
[in]offsetOffset factor for the argument.
[in]lengthLength of the array to index.

Member Function Documentation

◆ compile()

template<jit::float_scalar T, bool SAFE_MATH = false>
virtual shared_leaf< T, SAFE_MATH > graph::argument_node< T, SAFE_MATH >::compile ( std::ostringstream & stream,
jit::register_map & registers,
const jit::register_map & thread_mem,
const jit::register_usage & usage )
inlinevirtual

Compile the node.

x' = (x - xmin)/dx (1)

Parameters
[in,out]streamString buffer stream.
[in,out]registersList of defined registers.
[in]thread_memList of defined thread memory registers.
[in]usageList of register usage count.
Returns
The current node.

Reimplemented from graph::straight_node< T, false >.

◆ evaluate()

template<jit::float_scalar T, bool SAFE_MATH = false>
virtual backend::buffer< T > graph::argument_node< T, SAFE_MATH >::evaluate ( )
inlinevirtual

Evaluate the argument.

Evaluate functions are only used by the minimization. So this node does not evaluate the argument. Instead this only returns the data as if it were a constant.

Returns
The evaluated value of the node.

Reimplemented from graph::straight_node< T, false >.

◆ get_offset()

template<jit::float_scalar T, bool SAFE_MATH = false>
T graph::argument_node< T, SAFE_MATH >::get_offset ( ) const
inline

Get argument offset.

Returns
The offset factor for x.

◆ get_scale()

template<jit::float_scalar T, bool SAFE_MATH = false>
T graph::argument_node< T, SAFE_MATH >::get_scale ( ) const
inline

Get argument scale.

Returns
The scale factor for x.

◆ get_size()

template<jit::float_scalar T, bool SAFE_MATH = false>
size_t graph::argument_node< T, SAFE_MATH >::get_size ( ) const
inline

Get the size of the array.

Returns
The size of the array.

◆ is_match()

template<jit::float_scalar T, bool SAFE_MATH = false>
virtual bool graph::argument_node< T, SAFE_MATH >::is_match ( shared_leaf< T, SAFE_MATH > x)
inlinevirtual

Query if the nodes match.

The argument of this node can be deferred so we need to check if the arguments are null.

Parameters
[in]xOther graph to check if it is a match.
Returns
True if the nodes are a match.

◆ reduce()

template<jit::float_scalar T, bool SAFE_MATH = false>
virtual shared_leaf< T, SAFE_MATH > graph::argument_node< T, SAFE_MATH >::reduce ( )
inlinevirtual

Reduction method.

If all the values in the data buffer are the same. Reduce to a single constant.

Returns
A reduced representation of the node.

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

◆ to_vizgraph()

template<jit::float_scalar T, bool SAFE_MATH = false>
virtual shared_leaf< T, SAFE_MATH > graph::argument_node< T, SAFE_MATH >::to_vizgraph ( std::stringstream & stream,
jit::register_map & registers )
inlinevirtual

Convert the node to vizgraph.

Parameters
[in,out]streamString buffer stream.
[in,out]registersList of defined registers.
Returns
The current node.

Implements graph::leaf_node< T, SAFE_MATH >.


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