27#ifndef _H_GRB_BASE_BLAS1
28#define _H_GRB_BASE_BLAS1
37#include <graphblas/internalops.hpp>
154 #define NO_MASK Vector< bool >( 0 )
202 class OP,
enum Backend backend,
203 typename OutputType,
typename InputType1,
typename InputType2,
208 const InputType1 alpha,
209 const InputType2 beta,
212 const typename std::enable_if<
217 >::type *
const =
nullptr
220 std::cout <<
"In eWiseApply ([T1]<-T2<-T3), operator, base\n";
223 const bool should_not_call_eWiseApplyOpASS_base =
false;
224 assert( should_not_call_eWiseApplyOpASS_base );
280 class Monoid,
enum Backend backend,
281 typename OutputType,
typename InputType1,
typename InputType2,
286 const InputType1 alpha,
287 const InputType2 beta,
290 const typename std::enable_if<
295 >::type *
const =
nullptr
298 std::cout <<
"In eWiseApply ([T1]<-T2<-T3), monoid, base\n";
301 const bool should_not_call_eWiseApplyMonASS_base =
false;
302 assert( should_not_call_eWiseApplyMonASS_base );
389 class OP,
enum Backend backend,
390 typename OutputType,
typename InputType1,
typename InputType2,
395 const InputType1 alpha,
399 const typename std::enable_if<
404 >::type *
const =
nullptr
407 std::cout <<
"In eWiseApply ([T1]<-T2<-[T3]), operator, base\n";
410 const bool should_not_call_eWiseApplyOpASA_base =
false;
411 assert( should_not_call_eWiseApplyOpASA_base );
498 class OP,
enum Backend backend,
499 typename OutputType,
typename MaskType,
500 typename InputType1,
typename InputType2,
506 const InputType1 alpha,
510 const typename std::enable_if<
516 >::type *
const =
nullptr
519 std::cout <<
"In masked eWiseApply ([T1]<-T2<-[T3], operator, base)\n";
522 const bool should_not_call_eWiseApplyOpAMSA_base =
false;
523 assert( should_not_call_eWiseApplyOpAMSA_base );
610 class Monoid,
enum Backend backend,
611 typename OutputType,
typename InputType1,
typename InputType2,
616 const InputType1 alpha,
624 >::type *
const =
nullptr
627 std::cout <<
"In unmasked eWiseApply ([T1]<-T2<-[T3], monoid, base)\n";
630 const bool should_not_call_eWiseApplyMonoidASA_base =
false;
631 assert( should_not_call_eWiseApplyMonoidASA_base );
721 class Monoid,
enum Backend backend,
722 typename OutputType,
typename MaskType,
723 typename InputType1,
typename InputType2,
729 const InputType1 alpha,
738 void >::type *
const =
nullptr
741 std::cout <<
"In masked eWiseApply ([T1]<-T2<-[T3], using monoid)\n";
744 const bool should_not_call_eWiseApplyMonoidAMSA_base =
false;
745 assert( should_not_call_eWiseApplyMonoidAMSA_base );
834 class OP,
enum Backend backend,
835 typename OutputType,
typename InputType1,
typename InputType2,
841 const InputType2 beta,
844 const typename std::enable_if<
849 >::type *
const =
nullptr
852 std::cout <<
"In eWiseApply ([T1]<-[T2]<-T3), operator, base\n";
855 const bool should_not_call_eWiseApplyOpAAS_base =
false;
856 assert( should_not_call_eWiseApplyOpAAS_base );
945 class OP,
enum Backend backend,
946 typename OutputType,
typename MaskType,
947 typename InputType1,
typename InputType2,
954 const InputType2 beta,
962 >::type *
const =
nullptr
965 std::cout <<
"In masked eWiseApply ([T1]<-[T2]<-T3, operator, base)\n";
968 const bool should_not_call_eWiseApplyOpAMAS_base =
false;
969 assert( should_not_call_eWiseApplyOpAMAS_base );
1056 class Monoid,
enum Backend backend,
1057 typename OutputType,
typename InputType1,
typename InputType2,
1063 const InputType2 beta,
1070 void >::type *
const =
nullptr
1073 std::cout <<
"In unmasked eWiseApply ([T1]<-[T2]<-T3, monoid, base)\n";
1076 const bool should_not_call_eWiseApplyMonoidAAS_base =
false;
1077 assert( should_not_call_eWiseApplyMonoidAAS_base );
1167 class Monoid,
enum Backend backend,
1168 typename OutputType,
typename MaskType,
1169 typename InputType1,
typename InputType2,
1176 const InputType2 beta,
1184 >::type *
const =
nullptr
1187 std::cout <<
"In masked eWiseApply ([T1]<-[T2]<-T3, monoid, base)\n";
1190 const bool should_not_call_eWiseApplyMonoidAMAS_base =
false;
1191 assert( should_not_call_eWiseApplyMonoidAMAS_base );
1280 class OP,
enum Backend backend,
1281 typename OutputType,
typename InputType1,
typename InputType2,
1288 const OP &op = OP(),
1294 >::type *
const =
nullptr
1297 std::cout <<
"In eWiseApply ([T1]<-[T2]<-[T3]), operator variant\n";
1300 const bool should_not_call_eWiseApplyOpAAA_base =
false;
1301 assert( should_not_call_eWiseApplyOpAAA_base );
1392 class OP,
enum Backend backend,
1393 typename OutputType,
typename MaskType,
1394 typename InputType1,
typename InputType2,
1402 const OP &op = OP(),
1404 const typename std::enable_if<
1410 >::type *
const =
nullptr
1413 std::cout <<
"In masked eWiseApply ([T1]<-[T2]<-[T3], operator, base)\n";
1416 const bool should_not_call_eWiseApplyOpAMAA_base =
false;
1417 assert( should_not_call_eWiseApplyOpAMAA_base );
1507 class Monoid,
enum Backend backend,
1508 typename OutputType,
typename InputType1,
typename InputType2,
1521 >::type *
const =
nullptr
1524 std::cout <<
"In unmasked eWiseApply ([T1]<-[T2]<-[T3], monoid, base)\n";
1527 const bool should_not_call_eWiseApplyOpAMAA_base =
false;
1528 assert( should_not_call_eWiseApplyOpAMAA_base );
1615 class Monoid,
enum Backend backend,
1616 typename OutputType,
typename MaskType,
1617 typename InputType1,
typename InputType2,
1627 const typename std::enable_if<
1633 >::type *
const =
nullptr
1636 std::cout <<
"In masked eWiseApply ([T1]<-[T2]<-[T3], monoid, base)\n";
1639 const bool should_not_call_eWiseApplyMonoidAMAA_base =
false;
1640 assert( should_not_call_eWiseApplyMonoidAMAA_base );
1732 class Ring,
enum Backend backend,
1733 typename OutputType,
typename InputType1,
typename InputType2,
1740 const Ring &ring = Ring(),
1746 >::type *
const =
nullptr
1749 std::cout <<
"in eWiseAdd ([T1] <- [T2] + [T3]), unmasked, base";
1752 const bool should_not_call_eWiseAddAAA_base =
false;
1753 assert( should_not_call_eWiseAddAAA_base );
1839 class Ring,
enum Backend backend,
1840 typename InputType1,
typename InputType2,
typename OutputType,
1845 const InputType1 alpha,
1847 const Ring &ring = Ring(),
1853 >::type *
const =
nullptr
1856 std::cout <<
"in eWiseAdd ([T1] <- T2 + [T3]), unmasked, base";
1859 const bool should_not_call_eWiseAddASA_base =
false;
1860 assert( should_not_call_eWiseAddASA_base );
1946 class Ring,
enum Backend backend,
1947 typename InputType1,
typename InputType2,
typename OutputType,
1953 const InputType2 beta,
1954 const Ring &ring = Ring(),
1960 >::type *
const =
nullptr
1963 std::cout <<
"in eWiseAdd ([T1] <- [T2] + T3), unmasked, base";
1966 const bool should_not_call_eWiseAddAAS_base =
false;
1967 assert( should_not_call_eWiseAddAAS_base );
2049 class Ring,
enum Backend backend,
2050 typename InputType1,
typename InputType2,
typename OutputType,
2055 const InputType1 alpha,
2056 const InputType2 beta,
2057 const Ring &ring = Ring(),
2063 >::type *
const =
nullptr
2066 std::cout <<
"in eWiseAdd ([T1] <- T2 + T3), unmasked, base";
2069 const bool should_not_call_eWiseAddASS_base =
false;
2070 assert( should_not_call_eWiseAddASS_base );
2167 class Ring,
enum Backend backend,
2168 typename OutputType,
typename MaskType,
2169 typename InputType1,
typename InputType2,
2177 const Ring &ring = Ring(),
2183 >::type *
const =
nullptr
2186 std::cout <<
"in eWiseAdd ([T1] <- [T2] + [T3]), masked, base";
2189 const bool should_not_call_eWiseAddAMAA_base =
false;
2190 assert( should_not_call_eWiseAddAMAA_base );
2284 class Ring,
enum Backend backend,
2285 typename InputType1,
typename InputType2,
2286 typename OutputType,
typename MaskType,
2292 const InputType1 alpha,
2294 const Ring &ring = Ring(),
2300 >::type *
const =
nullptr
2303 std::cout <<
"in eWiseAdd ([T1] <- T2 + [T3]), masked, base";
2306 const bool should_not_call_eWiseAddAMSA_base =
false;
2307 assert( should_not_call_eWiseAddAMSA_base );
2401 class Ring,
enum Backend backend,
2402 typename InputType1,
typename InputType2,
2403 typename OutputType,
typename MaskType,
2410 const InputType2 beta,
2411 const Ring &ring = Ring(),
2417 >::type *
const =
nullptr
2420 std::cout <<
"in eWiseAdd ([T1] <- [T2] + T3), masked, base";
2423 const bool should_not_call_eWiseAddAMAS_base =
false;
2424 assert( should_not_call_eWiseAddAMAS_base );
2514 class Ring,
enum Backend backend,
2515 typename InputType1,
typename InputType2,
2516 typename OutputType,
typename MaskType,
2522 const InputType1 alpha,
2523 const InputType2 beta,
2524 const Ring &ring = Ring(),
2530 >::type *
const =
nullptr
2533 std::cout <<
"in eWiseAdd ([T1] <- T2 + T3), masked, base";
2536 const bool should_not_call_eWiseAddAMSS_base =
false;
2537 assert( should_not_call_eWiseAddAMSS_base );
2614 class Ring,
enum Backend backend,
2615 typename InputType1,
typename InputType2,
typename OutputType,
2622 const Ring &ring = Ring(),
2628 >::type *
const =
nullptr
2631 std::cout <<
"in eWiseMul ([T1] <- [T2] * [T3]), unmasked, base";
2634 const bool should_not_call_eWiseMulAAA_base =
false;
2635 assert( should_not_call_eWiseMulAAA_base );
2711 class Ring,
enum Backend backend,
2712 typename InputType1,
typename InputType2,
typename OutputType,
2717 const InputType1 alpha,
2719 const Ring &ring = Ring(),
2725 >::type *
const =
nullptr
2728 std::cout <<
"in eWiseMul ([T1] <- T2 * [T3]), unmasked, base";
2731 const bool should_not_call_eWiseMulASA_base =
false;
2732 assert( should_not_call_eWiseMulASA_base );
2808 class Ring,
enum Backend backend,
2809 typename InputType1,
typename InputType2,
typename OutputType,
2815 const InputType2 beta,
2816 const Ring &ring = Ring(),
2822 >::type *
const =
nullptr
2825 std::cout <<
"in eWiseMul ([T1] <- [T2] * T3), unmasked, base";
2828 const bool should_not_call_eWiseMulAAS_base =
false;
2829 assert( should_not_call_eWiseMulAAS_base );
2901 class Ring,
enum Backend backend,
2902 typename InputType1,
typename InputType2,
typename OutputType,
2907 const InputType1 alpha,
2908 const InputType2 beta,
2909 const Ring &ring = Ring(),
2915 >::type *
const =
nullptr
2918 std::cout <<
"in eWiseMul ([T1] <- T2 * T3), unmasked, base";
2921 const bool should_not_call_eWiseMulASS_base =
false;
2922 assert( should_not_call_eWiseMulASS_base );
3003 class Ring,
enum Backend backend,
3004 typename InputType1,
typename InputType2,
3005 typename OutputType,
typename MaskType,
3013 const Ring &ring = Ring(),
3019 >::type *
const =
nullptr
3022 std::cout <<
"in eWiseMul ([T1] <- [T2] * [T3]), masked, base";
3025 const bool should_not_call_eWiseMulAMAA_base =
false;
3026 assert( should_not_call_eWiseMulAMAA_base );
3108 class Ring,
enum Backend backend,
3109 typename InputType1,
typename InputType2,
3110 typename OutputType,
typename MaskType,
3116 const InputType1 alpha,
3118 const Ring &ring = Ring(),
3124 >::type *
const =
nullptr
3127 std::cout <<
"in eWiseMul ([T1] <- T2 * [T3]), masked, base";
3130 const bool should_not_call_eWiseMulAMSA_base =
false;
3131 assert( should_not_call_eWiseMulAMSA_base );
3213 class Ring,
enum Backend backend,
3214 typename InputType1,
typename InputType2,
3215 typename OutputType,
typename MaskType,
3222 const InputType2 beta,
3223 const Ring &ring = Ring(),
3229 >::type *
const =
nullptr
3232 std::cout <<
"in eWiseMul ([T1] <- [T2] * T3), masked, base";
3235 const bool should_not_call_eWiseMulAMAS_base =
false;
3236 assert( should_not_call_eWiseMulAMAS_base );
3315 class Ring,
enum Backend backend,
3316 typename InputType1,
typename InputType2,
3317 typename OutputType,
typename MaskType,
3323 const InputType1 alpha,
3324 const InputType2 beta,
3325 const Ring &ring = Ring(),
3331 >::type *
const =
nullptr
3334 std::cout <<
"in eWiseMul ([T1] <- T2 * T3), masked, base";
3337 const bool should_not_call_eWiseMulAMSS_base =
false;
3338 assert( should_not_call_eWiseMulAMSS_base );
3529 const bool should_not_call_base_vector_ewiselambda =
false;
3530 assert( should_not_call_base_vector_ewiselambda );
3615 typename InputType,
typename IOType,
typename MaskType,
3616 Backend backend,
typename Coords
3627 >::type *
const =
nullptr
3630 const bool should_not_call_base_scalar_foldl =
false;
3631 assert( should_not_call_base_scalar_foldl );
3648 typename IOType,
typename InputType,
3656 const typename std::enable_if<
3659 void >::type *
const =
nullptr
3662 const bool should_not_call_base_scalar_foldl_nomask =
false;
3663 assert( should_not_call_base_scalar_foldl_nomask );
3684 typename IOType,
typename InputType,
typename MaskType,
3685 Backend backend,
typename Coords
3691 const OP &op = OP(),
3692 const typename std::enable_if<
3696 void >::type *
const =
nullptr
3699 const bool should_not_call_base_scalar_foldl_op =
false;
3700 assert( should_not_call_base_scalar_foldl_op );
3718 typename InputType,
typename IOType,
typename MaskType,
3719 Backend backend,
typename Coords
3730 >::type *
const =
nullptr
3733 const bool should_not_call_base_scalar_foldr =
false;
3734 assert( should_not_call_base_scalar_foldr );
3752 typename IOType,
typename InputType,
3753 Backend backend,
typename Coords
3759 const typename std::enable_if<
3762 void >::type *
const =
nullptr
3765 const bool should_not_call_base_scalar_foldr_nomask =
false;
3766 assert( should_not_call_base_scalar_foldr_nomask );
3830 class AddMonoid,
class AnyOp,
3831 typename OutputType,
typename InputType1,
typename InputType2,
3832 enum Backend backend,
typename Coords
3838 const AddMonoid &addMonoid = AddMonoid(),
3839 const AnyOp &anyOp = AnyOp(),
3846 void >::type *
const =
nullptr
3849 std::cout <<
"Should not call base grb::dot (monoid-operator version)\n";
3852 const bool should_not_call_base_dot_monOp =
false;
3853 assert( should_not_call_base_dot_monOp );
3909 typename IOType,
typename InputType1,
typename InputType2,
3910 Backend backend,
typename Coords
3916 const Ring &ring = Ring(),
3918 const typename std::enable_if<
3923 void >::type *
const =
nullptr
3926 std::cout <<
"Should not call base grb::dot (semiring version)\n";
3929 const bool should_not_call_base_dot_semiring =
false;
3930 assert( should_not_call_base_dot_semiring );
This file contains a register of all backends that are either implemented, under implementation,...
A generalised monoid.
Definition: monoid.hpp:54
A GraphBLAS vector.
Definition: vector.hpp:64
Defines all ALP/GraphBLAS descriptors.
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.
Definition: blas1.hpp:3618
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 , out of place, operator version.
Definition: blas1.hpp:206
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, , under a given additive monoid and multiplicative operator.
Definition: blas1.hpp:3834
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.
Definition: blas1.hpp:3721
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, , under a given semiring.
Definition: blas1.hpp:2618
RC eWiseLambda(const Func f, const Vector< DataType, backend, Coords > &x, Args...)
Executes an arbitrary element-wise user-defined function f using any number of vectors of equal lengt...
Definition: blas1.hpp:3524
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, , under a given semiring.
Definition: blas1.hpp:1736
Backend
A collection of all backends.
Definition: backends.hpp:46
static constexpr Descriptor no_operation
Indicates no additional pre- or post-processing on any of the GraphBLAS function arguments.
Definition: descriptors.hpp:63
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:450
RC
Return codes of ALP primitives.
Definition: rc.hpp:47
@ UNSUPPORTED
Indicates that the execution of the requested primitive with the given arguments is not supported by ...
Definition: rc.hpp:129
unsigned int Descriptor
Descriptors indicate pre- or post-processing for some or all of the arguments to an ALP/GraphBLAS cal...
Definition: descriptors.hpp:54
Phase
Primitives with sparse ALP/GraphBLAS output containers may run into the issue where an appropriate gr...
Definition: phase.hpp:152
@ EXECUTE
Speculatively assumes that the output container of the requested operation has enough capacity to com...
Definition: phase.hpp:257
Provides a set of standard binary operators.
Defines the various phases an ALP/GraphBLAS primitive may be executed with.
Defines the ALP error codes.
Provides an ALP semiring.
Used to inspect whether a given type is an ALP monoid.
Definition: type_traits.hpp:85
Used to inspect whether a given type is an ALP/GraphBLAS object.
Definition: type_traits.hpp:130
Used to inspect whether a given type is an ALP operator.
Definition: type_traits.hpp:104
Used to inspect whether a given type is an ALP semiring.
Definition: type_traits.hpp:66