|
Graph Framework
|
Implimentation of the c binding library. More...
#include "graph_c_binding.h"#include "../graph_framework/register.hpp"#include "../graph_framework/node.hpp"#include "../graph_framework/workflow.hpp"#include "../graph_framework/arithmetic.hpp"#include "../graph_framework/math.hpp"#include "../graph_framework/trigonometry.hpp"#include "../graph_framework/piecewise.hpp"Classes | |
| struct | graph_c_context_type< T, SAFE_MATH > |
| C context with specific type. More... | |
Functions | |
| graph_c_context * | graph_construct_context (const enum graph_type type, const bool use_safe_math) |
| Construct a C context. | |
| void | graph_destroy_context (graph_c_context *c) |
| Destroy C context. | |
| graph_node | graph_variable (STRUCT_TAG graph_c_context *c, const size_t size, const char *symbol) |
| Create variable node. | |
| graph_node | graph_constant (STRUCT_TAG graph_c_context *c, const double value) |
| Create constant node. | |
| void | graph_set_variable (STRUCT_TAG graph_c_context *c, graph_node var, const void *source) |
| Set a variable value. | |
| graph_node | graph_constant_c (STRUCT_TAG graph_c_context *c, const double real_value, const double img_value) |
| Create complex constant node. | |
| graph_node | graph_pseudo_variable (STRUCT_TAG graph_c_context *c, graph_node var) |
| Create a pseudo variable. | |
| graph_node | graph_remove_pseudo (STRUCT_TAG graph_c_context *c, graph_node var) |
| Remove pseudo. | |
| graph_node | graph_add (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create add node. | |
| graph_node | graph_sub (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create Substract node. | |
| graph_node | graph_mul (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create Multiply node. | |
| graph_node | graph_div (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create Divide node. | |
| graph_node | graph_sqrt (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create Sqrt node. | |
| graph_node | graph_exp (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create exp node. | |
| graph_node | graph_log (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create log node. | |
| graph_node | graph_pow (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create Pow node. | |
| graph_node | graph_erfi (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create imaginary error function node. | |
| graph_node | graph_sin (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create sine node. | |
| graph_node | graph_cos (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create cosine node. | |
| graph_node | graph_atan (STRUCT_TAG graph_c_context *c, graph_node left, graph_node right) |
| Create arctangent node. | |
| graph_node | graph_random_state (STRUCT_TAG graph_c_context *c, const uint32_t seed) |
| Construct a random state node. | |
| graph_node | graph_random (STRUCT_TAG graph_c_context *c, graph_node arg) |
| Create random node. | |
| graph_node | graph_piecewise_1D (STRUCT_TAG graph_c_context *c, graph_node arg, const double scale, const double offset, const void *source, const size_t source_size) |
| Create 1D piecewise node. | |
| graph_node | graph_piecewise_2D (STRUCT_TAG graph_c_context *c, const size_t num_cols, graph_node x_arg, const double x_scale, const double x_offset, graph_node y_arg, const double y_scale, const double y_offset, const void *source, const size_t source_size) |
| Create 2D piecewise node. | |
| size_t | graph_get_max_concurrency (graph_c_context *c) |
| Create 2D piecewise node with complex arguments. | |
| void | graph_set_device_number (STRUCT_TAG graph_c_context *c, const size_t num) |
| Choose the device number. | |
| void | graph_add_pre_item (STRUCT_TAG graph_c_context *c, graph_node *inputs, size_t num_inputs, graph_node *outputs, size_t num_outputs, graph_node *map_inputs, graph_node *map_outputs, size_t num_maps, graph_node random_state, const char *name, const size_t size) |
| Add pre workflow item. | |
| void | graph_add_item (STRUCT_TAG graph_c_context *c, graph_node *inputs, size_t num_inputs, graph_node *outputs, size_t num_outputs, graph_node *map_inputs, graph_node *map_outputs, size_t num_maps, graph_node random_state, const char *name, const size_t size) |
| Add workflow item. | |
| void | graph_add_converge_item (STRUCT_TAG graph_c_context *c, graph_node *inputs, size_t num_inputs, graph_node *outputs, size_t num_outputs, graph_node *map_inputs, graph_node *map_outputs, size_t num_maps, graph_node random_state, const char *name, const size_t size, const double tol, const size_t max_iter) |
| Add a converge item. | |
| void | graph_compile (graph_c_context *c) |
| Compile the work items. | |
| void | graph_pre_run (graph_c_context *c) |
| Run pre work items. | |
| void | graph_run (graph_c_context *c) |
| Run work items. | |
| void | graph_wait (graph_c_context *c) |
| Wait for work items to complete. | |
| void | graph_copy_to_device (STRUCT_TAG graph_c_context *c, graph_node node, void *source) |
| Copy data to a device buffer. | |
| void | graph_copy_to_host (STRUCT_TAG graph_c_context *c, graph_node node, void *destination) |
| Copy data to a host buffer. | |
| void | graph_print (STRUCT_TAG graph_c_context *c, const size_t index, graph_node *nodes, const size_t num_nodes) |
| Print a value from nodes. | |
| graph_node | graph_df (STRUCT_TAG graph_c_context *c, graph_node fnode, graph_node xnode) |
| Take derivative ∂f∂x. | |
Implimentation of the c binding library.
| graph_node graph_add | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create add node.
Create Addition node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| void graph_add_converge_item | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node * | inputs, | ||
| size_t | num_inputs, | ||
| graph_node * | outputs, | ||
| size_t | num_outputs, | ||
| graph_node * | map_inputs, | ||
| graph_node * | map_outputs, | ||
| size_t | num_maps, | ||
| graph_node | random_state, | ||
| const char * | name, | ||
| const size_t | size, | ||
| const double | tol, | ||
| const size_t | max_iter | ||
| ) |
Add a converge item.
| [in] | c | The graph C context. |
| [in] | inputs | Array of input nodes. |
| [in] | num_inputs | Number of inputs. |
| [in] | outputs | Array of output nodes. |
| [in] | num_outputs | Number of outputs. |
| [in] | map_inputs | Array of map input nodes. |
| [in] | map_outputs | Array of map output nodes. |
| [in] | num_maps | Number of maps. |
| [in] | random_state | Optional random state, can be NULL if not used. |
| [in] | name | Name for the kernel. |
| [in] | size | Number of elements to operate on. |
| [in] | tol | Tolarance to converge the function to. |
| [in] | max_iter | Maximum number of iterations before giving up. |
| void graph_add_item | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node * | inputs, | ||
| size_t | num_inputs, | ||
| graph_node * | outputs, | ||
| size_t | num_outputs, | ||
| graph_node * | map_inputs, | ||
| graph_node * | map_outputs, | ||
| size_t | num_maps, | ||
| graph_node | random_state, | ||
| const char * | name, | ||
| const size_t | size | ||
| ) |
Add workflow item.
| [in] | c | The graph C context. |
| [in] | inputs | Array of input nodes. |
| [in] | num_inputs | Number of inputs. |
| [in] | outputs | Array of output nodes. |
| [in] | num_outputs | Number of outputs. |
| [in] | map_inputs | Array of map input nodes. |
| [in] | map_outputs | Array of map output nodes. |
| [in] | num_maps | Number of maps. |
| [in] | random_state | Optional random state, can be NULL if not used. |
| [in] | name | Name for the kernel. |
| [in] | size | Number of elements to operate on. |
| void graph_add_pre_item | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node * | inputs, | ||
| size_t | num_inputs, | ||
| graph_node * | outputs, | ||
| size_t | num_outputs, | ||
| graph_node * | map_inputs, | ||
| graph_node * | map_outputs, | ||
| size_t | num_maps, | ||
| graph_node | random_state, | ||
| const char * | name, | ||
| const size_t | size | ||
| ) |
Add pre workflow item.
| [in] | c | The graph C context. |
| [in] | inputs | Array of input nodes. |
| [in] | num_inputs | Number of inputs. |
| [in] | outputs | Array of output nodes. |
| [in] | num_outputs | Number of outputs. |
| [in] | map_inputs | Array of map input nodes. |
| [in] | map_outputs | Array of map output nodes. |
| [in] | num_maps | Number of maps. |
| [in] | random_state | Optional random state, can be NULL if not used. |
| [in] | name | Name for the kernel. |
| [in] | size | Number of elements to operate on. |
| graph_node graph_atan | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create arctangent node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| void graph_compile | ( | graph_c_context * | c | ) |
Compile the work items.
| [in] | c | The graph C context. |
| graph_node graph_constant | ( | STRUCT_TAG graph_c_context * | c, |
| const double | value | ||
| ) |
Create constant node.
| [in] | c | The graph C context. |
| [in] | value | The value to create the constant. |
| graph_node graph_constant_c | ( | STRUCT_TAG graph_c_context * | c, |
| const double | real_value, | ||
| const double | img_value | ||
| ) |
Create complex constant node.
| [in] | c | The graph C context. |
| [in] | real_value | The real component. |
| [in] | img_value | The imaginary component. |
| graph_c_context * graph_construct_context | ( | const enum graph_type | type, |
| const bool | use_safe_math | ||
| ) |
Construct a C context.
| [in] | type | Base type. |
| [in] | use_safe_math | Control is safe math is used. |
| void graph_copy_to_device | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | node, | ||
| void * | source | ||
| ) |
Copy data to a device buffer.
| [in] | c | The graph C context. |
| [in] | node | Node to copy to. |
| [in] | source | Source to copy from. |
| void graph_copy_to_host | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | node, | ||
| void * | destination | ||
| ) |
Copy data to a host buffer.
| [in] | c | The graph C context. |
| [in] | node | Node to copy from. |
| [in] | destination | Host side buffer to copy to. |
| graph_node graph_cos | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create cosine node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| void graph_destroy_context | ( | graph_c_context * | c | ) |
Destroy C context.
| [in,out] | c | The c context to delete. |
| graph_node graph_df | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | fnode, | ||
| graph_node | xnode | ||
| ) |
Take derivative ∂f∂x.
| [in] | c | The graph C context. |
| [in] | fnode | The function expression to take the derivative of. |
| [in] | xnode | The expression to take the derivative with respect to. |
| graph_node graph_div | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create Divide node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| graph_node graph_erfi | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create imaginary error function node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| graph_node graph_exp | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create exp node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| size_t graph_get_max_concurrency | ( | graph_c_context * | c | ) |
Create 2D piecewise node with complex arguments.
| [in] | c | The graph C context. |
| graph_node graph_log | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create log node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| graph_node graph_mul | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create Multiply node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| graph_node graph_piecewise_1D | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg, | ||
| const double | scale, | ||
| const double | offset, | ||
| const void * | source, | ||
| const size_t | source_size | ||
| ) |
Create 1D piecewise node.
| [in] | c | The graph C context. |
| [in] | arg | The function argument. |
| [in] | scale | Scale factor argument. |
| [in] | offset | Offset factor argument. |
| [in] | source | Source buffer to fill elements. |
| [in] | source_size | Number of elements in the source buffer. |
| graph_node graph_piecewise_2D | ( | STRUCT_TAG graph_c_context * | c, |
| const size_t | num_cols, | ||
| graph_node | x_arg, | ||
| const double | x_scale, | ||
| const double | x_offset, | ||
| graph_node | y_arg, | ||
| const double | y_scale, | ||
| const double | y_offset, | ||
| const void * | source, | ||
| const size_t | source_size | ||
| ) |
Create 2D piecewise node.
| [in] | c | The graph C context. |
| [in] | num_cols | Number of columns. |
| [in] | x_arg | The function x argument. |
| [in] | x_scale | Scale factor x argument. |
| [in] | x_offset | Offset factor x argument. |
| [in] | y_arg | The function y argument. |
| [in] | y_scale | Scale factor y argument. |
| [in] | y_offset | Offset factor y argument. |
| [in] | source | Source buffer to fill elements. |
| [in] | source_size | Number of elements in the source buffer. |
| graph_node graph_pow | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create Pow node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| void graph_pre_run | ( | graph_c_context * | c | ) |
Run pre work items.
| [in] | c | The graph C context. |
| void graph_print | ( | STRUCT_TAG graph_c_context * | c, |
| const size_t | index, | ||
| graph_node * | nodes, | ||
| const size_t | num_nodes | ||
| ) |
Print a value from nodes.
| [in] | c | The graph C context. |
| [in] | index | Particle index to print. |
| [in] | nodes | Nodes to print. |
| [in] | num_nodes | Number of nodes. |
| graph_node graph_pseudo_variable | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | var | ||
| ) |
Create a pseudo variable.
| [in] | c | The graph C context. |
| [in] | var | The variable to set. |
| graph_node graph_random | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create random node.
| [in] | c | The graph C context. |
| [in] | arg | A random state node. |
| graph_node graph_random_state | ( | STRUCT_TAG graph_c_context * | c, |
| const uint32_t | seed | ||
| ) |
Construct a random state node.
| [in] | c | The graph C context. |
| [in] | seed | Intial random seed. |
| graph_node graph_remove_pseudo | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | var | ||
| ) |
Remove pseudo.
| [in] | c | The graph C context. |
| [in] | var | The variable to set. |
| void graph_run | ( | graph_c_context * | c | ) |
Run work items.
| [in] | c | The graph C context. |
| void graph_set_device_number | ( | STRUCT_TAG graph_c_context * | c, |
| const size_t | num | ||
| ) |
Choose the device number.
| [in] | c | The graph C context. |
| [in] | num | The device number. |
| void graph_set_variable | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | var, | ||
| const void * | source | ||
| ) |
Set a variable value.
| [in] | c | The graph C context. |
| [in] | var | The variable to set. |
| [in] | source | The source pointer. |
| graph_node graph_sin | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create sine node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| graph_node graph_sqrt | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | arg | ||
| ) |
Create Sqrt node.
| [in] | c | The graph C context. |
| [in] | arg | The left opperand. |
| graph_node graph_sub | ( | STRUCT_TAG graph_c_context * | c, |
| graph_node | left, | ||
| graph_node | right | ||
| ) |
Create Substract node.
| [in] | c | The graph C context. |
| [in] | left | The left opperand. |
| [in] | right | The right opperand. |
| graph_node graph_variable | ( | STRUCT_TAG graph_c_context * | c, |
| const size_t | size, | ||
| const char * | symbol | ||
| ) |
Create variable node.
| [in] | c | The graph C context. |
| [in] | size | Size of the data buffer. |
| [in] | symbol | Symbol of the variable used in equations. |
| void graph_wait | ( | graph_c_context * | c | ) |
Wait for work items to complete.
| [in] | c | The graph C context. |