ALP User Documentation 0.7.alpha
Algebraic Programming User Documentation
|
A collection of functions that let GraphBLAS operators work on zero-dimensional containers, i.e., on scalars. More...
Functions | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType1 , typename InputType2 , typename OutputType > | |
static enum RC | apply (OutputType &out, const InputType1 &x, const InputType2 &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< OutputType >::value, void >::type *=nullptr) |
Out-of-place application of the operator OP on two data elements. | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType , typename IOType > | |
static RC | foldl (IOType &x, const InputType &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType >::value &&!grb::is_object< IOType >::value, void >::type *=nullptr) |
Application of the operator OP on two data elements. | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType , typename IOType > | |
static RC | foldr (const InputType &x, IOType &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType >::value &&!grb::is_object< IOType >::value, void >::type *=nullptr) |
Application of the operator OP on two data elements. | |
A collection of functions that let GraphBLAS operators work on zero-dimensional containers, i.e., on scalars.
The GraphBLAS uses opaque data types and defines several standard functions to operate on these data types. Examples types are grb::Vector and grb::Matrix, example functions are grb::dot and grb::vxm.
To input data into an opaque GraphBLAS type, each opaque type defines a member function build: grb::Vector::build() and grb::Matrix::build().
To extract data from opaque GraphBLAS types, each opaque type provides iterators that may be obtained via the STL standard begin and end functions:
Some GraphBLAS functions, however, reduce all elements in a GraphBLAS container into a single element of a given type. So for instance, grb::dot on two vectors of type grb::Vector<double> using the regular real semiring grb::Semiring<double> will store its output in a variable of type double.
When parametrising GraphBLAS functions in terms of arbitrary Semirings, Monoids, Operators, and object types, it is useful to have a way to apply the same operators on whatever type they make functions like grb::dot produce– that is, we require functions that enable the application of GraphBLAS operators on single elements.
This group of BLAS level 0 functions provides this functionality.
|
static |
Out-of-place application of the operator OP on two data elements.
The output data will be output to an existing memory location, overwriting any existing data.
descr | The descriptor passed to this operator. |
OP | The type of the oparator to apply. |
InputType1 | The left-hand side input argument type. |
InputType2 | The right-hand side input argument type. |
OutputType | The output argument type. |
If InputType1 does not match the left-hand side input domain of OP, or if InputType2 does not match the right-hand side input domain of OP, or if OutputType does not match the output domain of OP while grb::descriptors::no_casting was set, then the code shall not compile.
[in] | x | The left-hand side input data. |
[in] | y | The right-hand side input data. |
[out] | out | Where to store the result of the operator. |
[in] | op | The operator to apply (optional). |
double a, b, c; grb::apply< grb::operators::add<double> >( a, b, c );
, or double a, b, c; grb::operators::add< double > addition_over_doubles; grb::apply( a, b, c, addition_over_doubles);
|
static |
Application of the operator OP on two data elements.
The output data will overwrite the left-hand side input element.
In mathematical notation, this function calculates \( x \odot y \) and copies the result into x.
descr | The descriptor passed to this operator. |
OP | The type of the operator to apply. |
IOType | The type of the left-hand side input element, which will be overwritten. |
InputType | The type of the right-hand side input element. This element will be accessed read-only. |
If InputType does not match the right-hand side input domain (see grb::operators::internal::Operator::D2) corresponding to OP, then x will be temporarily cached and cast into D2. If IOType does not match the left-hand side input domain corresponding to OP, then y will be temporarily cached and cast into D1. If IOType does not match the output domain corresponding to OP, then the result of \( x \odot y \) will be temporarily cached before cast to IOType and written to y.
[in,out] | x | On function entry: the left-hand side input parameter. On function exit: the output of the operator. |
[in] | y | The right-hand side input parameter. |
[in] | op | The operator to apply (optional). |
|
static |
Application of the operator OP on two data elements.
The output data will overwrite the right-hand side input element.
In mathematical notation, this function calculates \( x \odot y \) and copies the result into y.
descr | The descriptor passed to this operator. |
OP | The type of the operator to apply. |
InputType | The type of the left-hand side input element. This element will be accessed read-only. |
IOType | The type of the right-hand side input element, which will be overwritten. |
If InputType does not match the left-hand side input domain (see grb::operators::internal::Operator::D1) corresponding to OP, then x will be temporarily cached and cast into D1. If IOType does not match the right-hand side input domain corresponding to OP, then y will be temporarily cached and cast into D2. If IOType does not match the output domain corresponding to OP, then the result of \( x \odot y \) will be temporarily cached before cast to IOType and written to y.
[in] | x | The left-hand side input parameter. |
[in,out] | y | On function entry: the right-hand side input parameter. On function exit: the output of the operator. |
[in] | op | The operator to apply (optional). |