ALP User Documentation 0.7.0
Algebraic Programming User Documentation
|
A collection of functions that allow ALP/GraphBLAS operators, monoids, and semirings work on a mix of zero-dimensional and one-dimensional containers; i.e., allows various linear algebra operations on scalars and objects of type grb::Vector. More...
Macros | |
#define | NO_MASK Vector< bool >( 0 ) |
A standard vector to use for mask parameters. More... | |
Functions | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , Backend backend, typename Coords > | |
RC | dot (IOType &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< IOType >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the dot product, \( z += (x,y) \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class AddMonoid , class AnyOp , typename OutputType , typename InputType1 , typename InputType2 , enum Backend backend, typename Coords > | |
RC | dot (OutputType &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const AddMonoid &addMonoid=AddMonoid(), const AnyOp &anyOp=AnyOp(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< AddMonoid >::value &&grb::is_operator< AnyOp >::value, void >::type *const =nullptr) |
Calculates the dot product, \( z += (x,y) \), under a given additive monoid and multiplicative operator. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, monoid version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, monoid version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, masked monoid version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, operator and masked version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, masked monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, masked operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, masked monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, masked operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, masked monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, masked operator variant. More... | |
template<typename Func , typename DataType , Backend backend, typename Coords , typename... Args> | |
RC | eWiseLambda (const Func f, const Vector< DataType, backend, Coords > &x, Args...) |
Executes an arbitrary element-wise user-defined function f on any number of vectors of equal length. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename IOType , typename InputType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, left-to-right. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename InputType , typename IOType , typename MaskType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Vector< MaskType, backend, Coords > &mask, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Reduces, or folds, a vector into a scalar. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , typename IOType , typename InputType , typename MaskType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Vector< MaskType, backend, Coords > &mask, const OP &op=OP(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< MaskType >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, left-to-right. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename InputType , typename IOType , typename MaskType , Backend backend, typename Coords > | |
RC | foldr (const Vector< InputType, backend, Coords > &x, const Vector< MaskType, backend, Coords > &mask, IOType &y, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, right-to-left. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename IOType , typename InputType , Backend backend, typename Coords > | |
RC | foldr (const Vector< InputType, backend, Coords > &y, IOType &x, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, right-to-left. More... | |
A collection of functions that allow ALP/GraphBLAS operators, monoids, and semirings work on a mix of zero-dimensional and one-dimensional containers; i.e., allows various linear algebra operations on scalars and objects of type grb::Vector.
All functions return an error code of the enum-type grb::RC.
Primitives which produce vector output:
Primitives that produce scalar output:
Primitives that do not require an operator, monoid, or semiring:
Primitives that could take an operator (see grb::operators):
Therefore, all aforementioned functions are also defined for monoids instead of operators.
The following functions are defined for monoids and semirings, but not for operators alone:
The following functions require a semiring, and are not defined for operators or monoids alone:
Sometimes, operations that are defined for semirings we would sometimes also like enabled on improper semirings. ALP/GraphBLAS statically checks most properties required for composing proper semirings, and as such, attempts to compose improper ones will result in a compilation error. In such cases, we allow to pass an additive monoid and a multiplicative operator instead of a semiring. The following functions allow this:
The algebraic structures lost with improper semirings typically correspond to distributivity, zero being an annihilator to multiplication, as well as the concept of one. Due to the latter lost structure, the above functions on impure semirings are not defined for pattern inputs.
For fusing multiple BLAS-1 style operations on any number of inputs and outputs, users can pass their own operator function to be executed for every index i.
For all of these functions, the element types of input and output types do not have to match the domains of the given operator, monoid, or semiring unless the grb::descriptors::no_casting descriptor was passed.
An implementation, whether blocking or non-blocking, should have clear performance semantics for every sequence of graphBLAS calls, no matter whether those are made from sequential or parallel contexts. Backends may define different performance semantics depending on which grb::Phase primitives execute in.
#define NO_MASK Vector< bool >( 0 ) |
A standard vector to use for mask parameters.
Indicates that no mask shall be used.
RC grb::dot | ( | IOType & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< IOType >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the dot product, \( z += (x,y) \), under a given semiring.
descr | The descriptor to be used. Optional; default descriptor is grb::descriptors::no_operation. |
Ring | The semiring type to use. |
OutputType | The output type. |
InputType1 | The input element type of the left-hand input vector. |
InputType2 | The input element type of the right-hand input vector. |
[in,out] | z | The output element \( z += (x,y) \). |
[in] | x | The left-hand input vector x. |
[in] | y | The right-hand input vector y. |
[in] | ring | The semiring under which to compute the dot product \( (x,y) \). The additive monoid is used to accumulate the dot product result into z. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::dot | ( | OutputType & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const AddMonoid & | addMonoid = AddMonoid() , |
||
const AnyOp & | anyOp = AnyOp() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< AddMonoid >::value &&grb::is_operator< AnyOp >::value, void >::type * const | = nullptr |
||
) |
Calculates the dot product, \( z += (x,y) \), under a given additive monoid and multiplicative operator.
descr | The descriptor to be used. Optional; the default descriptors is grb::descriptors::no_operation. |
AddMonoid | The monoid used for addition during the computation of \( (x,y) \). The same monoid is used for accumulating the result into a given scalar. |
AnyOp | A binary operator that acts as the multiplication during \( (x,y) \). |
OutputType | The output type. |
InputType1 | The input element type of the left-hand input vector. |
InputType2 | The input element type of the right-hand input vector. |
[in,out] | z | Where to fold \( (x,y) \) into. |
[in] | x | The left-hand input vector. |
[in] | y | The right-hand input vector. |
[in] | addMonoid | The additive monoid under which the reduction of the results of element-wise multiplications of x and y are performed. |
[in] | anyOp | The multiplicative operator using which element-wise multiplications of x and y are performed. This may be any binary operator. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. This may be a sparse vector. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | x | The left-hand input vector of type InputType1. This may be a sparse vector. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | x | The left-hand input vector of type InputType1. This may be a sparse vector. |
[in] | y | The right-hand input vector of type InputType2. This may be a sparse vector. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
MaskType | The nonzero type of the output mask vector. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | mask | The output mask. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
MaskType | The nonzero type of the output mask vector. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | mask | The output mask. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. This may be a sparse vector. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
MaskType | The nonzero type of the output mask vector. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | mask | The output mask. |
[in] | x | The left-hand input vector of type InputType1. This may be a sparse vector. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseAdd | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise addition on. |
InputType1 | The left-hand side input type to the additive operator of the ring. |
InputType2 | The right-hand side input type to the additive operator of the ring. |
OutputType | The result type of the additive operator of the ring. |
MaskType | The nonzero type of the output mask vector. |
[out] | z | The output vector of type OutputType. This may be a sparse vector. |
[in] | mask | The output mask vector of type MaskType. |
[in] | x | The left-hand input vector of type InputType1. This may be a sparse vector. |
[in] | y | The right-hand input vector of type InputType2. This may be a sparse vector. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot \beta \), out of place, monoid version.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | alpha | The left-hand input scalar. |
[in] | beta | The right-hand input scalar. |
[in] | monoid | The monoid with underlying operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
Specialisation scalar inputs, unmasked monoid version.
A call to this function is equivalent to the following code:
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot \beta \), out of place, operator version.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | alpha | The left-hand input scalar. |
[in] | beta | The right-hand input scalar. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
Specialisation scalar inputs, unmasked operator version.
A call to this function is equivalent to the following code:
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot y \), out of place, monoid version.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = \alpha \odot y \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( \alpha \odot y_i \). Any old entries of z are removed.
After a successful call to this primitive, z shall be dense.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | alpha | The left-hand input scalar. |
[in] | y | The right-hand input vector. |
[in] | monoid | The monoid that provides the operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot y \), out of place, operator version.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = \alpha \odot y \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( \alpha \odot y_i \). Any old entries of z are removed. Entries i for which y has no nonzero will be skipped.
After a successful call to this primitive, the sparsity structure of z shall match that of y.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | alpha | The left-hand input scalar. |
[in] | y | The right-hand input vector. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot \beta \), out of place, monoid variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot \beta \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot \beta \). Any old entries of z are removed.
After a successful call to this primitive, z shall be dense.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | x | The left-hand input vector. |
[in] | beta | The right-hand input scalar. |
[in] | monoid | The monoid that provides the operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot \beta \), out of place, operator variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x .* \beta \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot \beta \). Any old entries of z are removed.
Entries i for which no nonzero exists in x are skipped. Therefore, after a successful call to this primitive, the nonzero structure of z will match that of x.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | x | The left-hand input vector. |
[in] | beta | The right-hand input scalar. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot y \), out of place, monoid variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot y \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot y_i \). Any old entries of z are removed.
After a successful call to this primitive, the nonzero structure of z will match that of the union of x and y. An implementing backend may skip processing indices i that are not in the union of the nonzero structure of x and y.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | x | The left-hand input vector. |
[in] | y | The right-hand input vector. |
[in] | monoid | The monoid structure that \( \odot \) corresponds to. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot y \), out of place, operator variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot y \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot y_i \). Any old entries of z are removed. Entries i which have no nonzero in either x or y are skipped.
After a successful call to this primitive, the nonzero structure of z will match that of the intersection of x and y.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
[out] | z | The output vector. |
[in] | x | The left-hand input vector. |
[in] | y | The right-hand input vector. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot \beta \), out of place, masked monoid version.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the output mask vector. |
[out] | z | The output vector. |
[in] | mask | The output mask. |
[in] | alpha | The left-hand input scalar. |
[in] | beta | The right-hand input scalar. |
[in] | monoid | The monoid with underlying operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
Specialisation for scalar inputs, masked monoid version.
A call to this function is equivalent to the following code:
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot \beta \), out of place, operator and masked version.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the output mask vector. |
[out] | z | The output vector. |
[in] | mask | The ouptut mask. |
[in] | alpha | The left-hand input scalar. |
[in] | beta | The right-hand input scalar. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
Specialisation scalar inputs, masked operator version.
A call to this function is equivalent to the following code:
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot y \), out of place, masked monoid variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = \alpha \odot y \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( \alpha \odot y_i \). Any old entries of z are removed. Entries i for which mask evaluates false
will be skipped.
After a successful call to this primitive, the sparsity structure of z shall match that of mask (after interpretation).
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the output mask vector. |
[out] | z | The output vector. |
[out] | mask | The output mask. |
[in] | alpha | The left-hand input scalar. |
[in] | y | The right-hand input vector. |
[in] | monoid | The monoid that provides the operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = \alpha \odot y \), out of place, masked operator version.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = \alpha \odot y \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( \alpha \odot y_i \). Any old entries of z are removed. Entries i for which y has no nonzero will be skipped, as will entries i for which mask evaluates false
.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the mask vector. |
[out] | z | The output vector. |
[in] | mask | The output mask. |
[in] | alpha | The left-hand input scalar. |
[in] | y | The right-hand input vector. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot \beta \), out of place, masked monoid variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot \beta \), using the given operator. The input and output vectors must be of equal length.
For all indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot \beta \). Any old entries of z are removed. Entries i for which mask evaluates false
will be skipped.
After a successful call to this primitive, the sparsity structure of z matches that of mask (after interpretation).
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the mask vector. |
[out] | z | The output vector. |
[out] | mask | The output mask. |
[in] | x | The left-hand input vector. |
[in] | beta | The right-hand input scalar. |
[in] | monoid | The monoid that provides the operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot \beta \), out of place, masked operator variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x .* \beta \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot \beta \). Any old entries of z are removed.
Entries i for which no nonzero exists in x are skipped. Entries i for which the mask evaluates false
are skipped as well.
descr | The descriptor to be used. Equal to descriptors::no_operation if left unspecified. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the output vector. |
MaskType | The value type of the output mask vector. |
[out] | z | The output vector. |
[in] | mask | The output mask. |
[in] | x | The left-hand input vector. |
[in] | beta | The right-hand input scalar. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot y \), out of place, masked monoid variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot y \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot y_i \). Any old entries of z are removed. Entries i for which mask evaluates false
will be skipped.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Monoid | The monoid to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the mask vector. |
[out] | z | The output vector. |
[in] | mask | The output mask. |
[in] | x | The left-hand input vector. |
[in] | y | The right-hand input vector. |
[in] | monoid | The monoid structure that \( \odot \) corresponds to. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseApply | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const OP & | op = OP() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Computes \( z = x \odot y \), out of place, masked operator variant.
Calculates the element-wise operation on one scalar to elements of one vector, \( z = x \odot y \), using the given operator. The input and output vectors must be of equal length.
For all valid indices i of z, its element \( z_i \) after the call to this function completes equals \( x_i \odot y_i \). Any old entries of z are removed. Entries i which have no nonzero in either x or y are skipped, as will entries i for which mask evaluates false
.
After a successful call to this primitive, the nonzero structure of z will match that of the intersection of x and y.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
OP | The operator to use. |
InputType1 | The value type of the left-hand vector. |
InputType2 | The value type of the right-hand scalar. |
OutputType | The value type of the ouput vector. |
MaskType | The value type of the output mask vector. |
[out] | z | The output vector. |
[in] | mask | The output mask. |
[in] | x | The left-hand input vector. |
[in] | y | The right-hand input vector. |
[in] | op | The operator \( \odot \). |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
Executes an arbitrary element-wise user-defined function f on any number of vectors of equal length.
The vectors touched by f can be accessed in a read-only or a read/write fashion. The function f must be parametrised in a global index i, and f is only allowed to access elements of the captured vectors on that specific index.
All vectors captured by f must furthermore all be given as additional (variadic) arguments to this primitive. Captured vectors can only be used for dereferencing elements at a given position i; any other use invokes undefined behaviour.
This primitive will execute f on all indices where the first given such vector argument has nonzeroes. All other indices i will be ignored.
This primitive hence allows a user to implement any level-1 like BLAS functionality over any number of input/output vectors, and also allows to compute multiple level-1 (like) BLAS functionalities as a single pass over the involved containers.
The function f may also capture scalars for read-only access.
If grb::Properties::writableCaptured evaluates true
then captured scalars may also safely be written to, instead of requiring to be read-only.
false
.Func | the user-defined lambda function type. |
DataType | the type of the user-supplied vector example. |
backend | the backend type of the user-supplied vector example. |
[in] | f | The user-supplied lambda. This lambda should only capture and reference vectors of the same length as x. The lambda function should prescribe the operations required to execute at a given index i. Captured ALP/GraphBLAS vectors can access that element via the operator[]. It is illegal to access any element not at position i. The lambda takes only the single parameter i of type const size_t . Captured scalars will not be globally updated– the user must program this explicitly. Scalars and other non-GraphBLAS containers are always local to their user process. |
[in] | x | The vector the lambda will be executed on. This argument determines which indices i will be accessed during the elementwise operation– elements with indices i that do not appear in x will be skipped during evaluation of f. |
The remaining arguments must collect all vectors the lambda is to access elements of. Such vectors must be of the same length as x. If this constraint is violated, grb::MISMATCH shall be returned.
x[i] += x[i+1]
. Vectors can only be dereferenced at position i and i alone.An example valid use:
This code takes a value beta, a vector x, and a semiring ring and computes: 1) y as the element-wise multiplication (under ring) of beta and x; and 2) alpha as the dot product (under ring) of x and y. This function can easily be made agnostic to whatever exact semiring is used by templating the type of ring. As it is, this code is functionally equivalent to:
If the latter code block is compiled using a blocking ALP/GraphBLAS backend, the version using the lambdas is expected to execute faster as both x and y are streamed only once, while the latter code may stream both vectors twice. This performance difference disappears when compiling the latter code block using a nonblocking backend instead.
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output type. |
[out] | z | The output vector of type OutputType. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output type. |
[out] | z | The output vector of type OutputType. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output type. |
[out] | z | The output vector of type OutputType. |
[in] | x | The left-hand input vector of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output type. |
[out] | z | The output vector of type OutputType. |
[in] | x | The left-hand input vector of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output vector type. |
MaskType | The output mask type. |
[in,out] | z | The output vector of type OutputType. |
[in] | mask | The ouput mask of type MaskType. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const InputType1 | alpha, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output vector type. |
MaskType | The output mask type. |
[in,out] | z | The output vector of type OutputType. |
[in] | mask | The ouput mask of type MaskType. |
[in] | alpha | The left-hand input scalar of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const InputType2 | beta, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output vector type. |
MaskType | The output mask type. |
[in,out] | z | The output vector of type OutputType. |
[in] | mask | The output mask of type MaskType. |
[in] | x | The left-hand input vector of type InputType1. |
[in] | beta | The right-hand input scalar of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::eWiseMul | ( | Vector< OutputType, backend, Coords > & | z, |
const Vector< MaskType, backend, Coords > & | mask, | ||
const Vector< InputType1, backend, Coords > & | x, | ||
const Vector< InputType2, backend, Coords > & | y, | ||
const Ring & | ring = Ring() , |
||
const Phase & | phase = EXECUTE , |
||
const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type * const | = nullptr |
||
) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring, masked variant.
descr | The descriptor to be used. Optional; the default is grb::descriptors::no_operation. |
Ring | The semiring type to perform the element-wise multiply with. |
InputType1 | The left-hand side input type. |
InputType2 | The right-hand side input type. |
OutputType | The output vector type. |
MaskType | The output mask type. |
[in,out] | z | The output vector of type OutputType. |
[in] | mask | The ouput mask of type MaskType. |
[in] | x | The left-hand input vector of type InputType1. |
[in] | y | The right-hand input vector of type InputType2. |
[in] | ring | The generalized semiring under which to perform this element-wise multiplication. |
[in] | phase | The grb::Phase the call should execute. Optional; the default parameter is grb::EXECUTE. |
RC grb::foldl | ( | IOType & | x, |
const Vector< InputType, backend, Coords > & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Folds a vector into a scalar, left-to-right.
Unmasked monoid variant. See masked variant for the full documentation.
RC grb::foldl | ( | IOType & | x, |
const Vector< InputType, backend, Coords > & | y, | ||
const Vector< MaskType, backend, Coords > & | mask, | ||
const Monoid & | monoid = Monoid() , |
||
const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Reduces, or folds, a vector into a scalar.
Reduction takes place according a monoid \( (\oplus,1) \), where \( \oplus:\ D_1 \times D_2 \to D_3 \) with associated identities \( 1_k in D_k \). Usually, \( D_k \subseteq D_3, 1 \leq k < 3 \), though other more exotic structures may be envisioned (and used).
Let \( x_0 = 1 \) and let \( x_{i+1} = \begin{cases} x_i \oplus y_i\text{ if }y_i\text{ is nonzero and }m_i\text{ evaluates true} x_i\text{ otherwise} \end{cases},\) for all \( i \in \{ 0, 1, \ldots, n-1 \} \).
After a successfull call, x will be equal to \( x_n \).
Note that the operator \( \oplus \) must be associative since it is part of a monoid. This algebraic property is exploited when parallelising the requested operation. The identity is required when parallelising over multiple user processes.
descr | The descriptor to be used (descriptors::no_operation if left unspecified). |
Monoid | The monoid to use for reduction. |
InputType | The type of the elements in the supplied ALP/GraphBLAS vector y. |
IOType | The type of the output scalar x. |
MaskType | The type of the elements in the supplied ALP/GraphBLAS vector mask. |
[out] | x | The result of the reduction. |
[in] | y | Any ALP/GraphBLAS vector. This vector may be sparse. |
[in] | mask | Any ALP/GraphBLAS vector. This vector may be sparse. |
[in] | monoid | The monoid under which to perform this reduction. |
bool
. If one of these is not true, the code shall not compile. RC grb::foldl | ( | IOType & | x, |
const Vector< InputType, backend, Coords > & | y, | ||
const Vector< MaskType, backend, Coords > & | mask, | ||
const OP & | op = OP() , |
||
const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< MaskType >::value &&grb::is_operator< OP >::value, void >::type * const | = nullptr |
||
) |
Folds a vector into a scalar, left-to-right.
Unmasked operator variant. See masked variant for the full documentation.
RC grb::foldr | ( | const Vector< InputType, backend, Coords > & | x, |
const Vector< MaskType, backend, Coords > & | mask, | ||
IOType & | y, | ||
const Monoid & | monoid = Monoid() , |
||
const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Folds a vector into a scalar, right-to-left.
Masked variant. See the masked, left-to-right variant for the full documentation.
RC grb::foldr | ( | const Vector< InputType, backend, Coords > & | y, |
IOType & | x, | ||
const Monoid & | monoid = Monoid() , |
||
const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type * const | = nullptr |
||
) |
Folds a vector into a scalar, right-to-left.
Unmasked variant. See the masked, left-to-right variant for the full documentation.