ALP User Documentation  0.8.preview
Algebraic Programming User Documentation
blas1.hpp
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2021 Huawei Technologies Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
27 #ifndef _H_GRB_BASE_BLAS1
28 #define _H_GRB_BASE_BLAS1
29 
30 #include <graphblas/rc.hpp>
31 #include <graphblas/ops.hpp>
32 #include <graphblas/phase.hpp>
33 #include <graphblas/monoid.hpp>
34 #include <graphblas/backends.hpp>
35 #include <graphblas/semiring.hpp>
37 #include <graphblas/internalops.hpp>
38 
39 #include <assert.h>
40 
41 
42 namespace grb {
43 
154  #define NO_MASK Vector< bool >( 0 )
155 
201  template<
203  class OP, enum Backend backend,
204  typename OutputType,
205  typename InputType1, typename InputType2,
206  typename Coords
207  >
210  const InputType1 alpha,
211  const InputType2 beta,
212  const OP &op = OP(),
213  const Phase &phase = EXECUTE,
214  const typename std::enable_if<
219  >::type * const = nullptr
220  ) {
221 #ifdef _DEBUG
222  std::cout << "In eWiseApply ([T1]<-T2<-T3), operator, base\n";
223 #endif
224 #ifndef NDEBUG
225  const bool should_not_call_eWiseApplyOpASS_base = false;
226  assert( should_not_call_eWiseApplyOpASS_base );
227 #endif
228  (void) z;
229  (void) alpha;
230  (void) beta;
231  (void) op;
232  (void) phase;
233  return UNSUPPORTED;
234  }
235 
284  template<
286  class OP, enum Backend backend,
287  typename OutputType, typename MaskType,
288  typename InputType1, typename InputType2,
289  typename Coords
290  >
294  const InputType1 alpha,
295  const InputType2 beta,
296  const OP &op = OP(),
297  const Phase &phase = EXECUTE,
298  const typename std::enable_if<
304  >::type * const = nullptr
305  ) {
306 #ifdef _DEBUG
307  std::cout << "In masked eWiseApply ([T1]<-T2<-T3), operator, base\n";
308 #endif
309 #ifndef NDEBUG
310  const bool should_not_call_eWiseApplyOpAMSS_base = false;
311  assert( should_not_call_eWiseApplyOpAMSS_base );
312 #endif
313  (void) z;
314  (void) mask;
315  (void) alpha;
316  (void) beta;
317  (void) op;
318  (void) phase;
319  return UNSUPPORTED;
320  }
321 
367  template<
369  class Monoid, enum Backend backend,
370  typename OutputType,
371  typename InputType1, typename InputType2,
372  typename Coords
373  >
376  const InputType1 alpha,
377  const InputType2 beta,
378  const Monoid &monoid = Monoid(),
379  const Phase &phase = EXECUTE,
380  const typename std::enable_if<
385  >::type * const = nullptr
386  ) {
387 #ifdef _DEBUG
388  std::cout << "In eWiseApply ([T1]<-T2<-T3), monoid, base\n";
389 #endif
390 #ifndef NDEBUG
391  const bool should_not_call_eWiseApplyMonASS_base = false;
392  assert( should_not_call_eWiseApplyMonASS_base );
393 #endif
394  (void) z;
395  (void) alpha;
396  (void) beta;
397  (void) monoid;
398  (void) phase;
399  return UNSUPPORTED;
400  }
401 
450  template<
452  class Monoid, enum Backend backend,
453  typename OutputType, typename MaskType,
454  typename InputType1, typename InputType2,
455  typename Coords
456  >
460  const InputType1 alpha,
461  const InputType2 beta,
462  const Monoid &monoid = Monoid(),
463  const Phase &phase = EXECUTE,
464  const typename std::enable_if<
470  >::type * const = nullptr
471  ) {
472 #ifdef _DEBUG
473  std::cout << "In masked eWiseApply ([T1]<-T2<-T3), monoid, base\n";
474 #endif
475 #ifndef NDEBUG
476  const bool should_not_call_eWiseApplyMonAMSS_base = false;
477  assert( should_not_call_eWiseApplyMonAMSS_base );
478 #endif
479  (void) z;
480  (void) mask;
481  (void) alpha;
482  (void) beta;
483  (void) monoid;
484  (void) phase;
485  return UNSUPPORTED;
486  }
487 
563  template<
565  class OP, enum Backend backend,
566  typename OutputType, typename InputType1, typename InputType2,
567  typename Coords
568  >
571  const InputType1 alpha,
573  const OP &op = OP(),
574  const Phase &phase = EXECUTE,
575  const typename std::enable_if<
580  >::type * const = nullptr
581  ) {
582 #ifdef _DEBUG
583  std::cout << "In eWiseApply ([T1]<-T2<-[T3]), operator, base\n";
584 #endif
585 #ifndef NDEBUG
586  const bool should_not_call_eWiseApplyOpASA_base = false;
587  assert( should_not_call_eWiseApplyOpASA_base );
588 #endif
589  (void) z;
590  (void) alpha;
591  (void) y;
592  (void) op;
593  (void) phase;
594  return UNSUPPORTED;
595  }
596 
672  template<
674  class OP, enum Backend backend,
675  typename OutputType, typename MaskType,
676  typename InputType1, typename InputType2,
677  typename Coords
678  >
682  const InputType1 alpha,
684  const OP &op = OP(),
685  const Phase &phase = EXECUTE,
686  const typename std::enable_if<
692  >::type * const = nullptr
693  ) {
694 #ifdef _DEBUG
695  std::cout << "In masked eWiseApply ([T1]<-T2<-[T3], operator, base)\n";
696 #endif
697 #ifndef NDEBUG
698  const bool should_not_call_eWiseApplyOpAMSA_base = false;
699  assert( should_not_call_eWiseApplyOpAMSA_base );
700 #endif
701  (void) z;
702  (void) mask;
703  (void) alpha;
704  (void) y;
705  (void) op;
706  (void) phase;
707  return UNSUPPORTED;
708  }
709 
784  template<
786  class Monoid, enum Backend backend,
787  typename OutputType, typename InputType1, typename InputType2,
788  typename Coords
789  >
792  const InputType1 alpha,
794  const Monoid &monoid = Monoid(),
795  const Phase &phase = EXECUTE,
796  const typename std::enable_if< !grb::is_object< OutputType >::value &&
800  >::type * const = nullptr
801  ) {
802 #ifdef _DEBUG
803  std::cout << "In unmasked eWiseApply ([T1]<-T2<-[T3], monoid, base)\n";
804 #endif
805 #ifndef NDEBUG
806  const bool should_not_call_eWiseApplyMonoidASA_base = false;
807  assert( should_not_call_eWiseApplyMonoidASA_base );
808 #endif
809  (void) z;
810  (void) alpha;
811  (void) y;
812  (void) monoid;
813  (void) phase;
814  return UNSUPPORTED;
815  }
816 
895  template<
897  class Monoid, enum Backend backend,
898  typename OutputType, typename MaskType,
899  typename InputType1, typename InputType2,
900  typename Coords
901  >
905  const InputType1 alpha,
907  const Monoid &monoid = Monoid(),
908  const Phase &phase = EXECUTE,
909  const typename std::enable_if< !grb::is_object< OutputType >::value &&
914  void >::type * const = nullptr
915  ) {
916 #ifdef _DEBUG
917  std::cout << "In masked eWiseApply ([T1]<-T2<-[T3], using monoid)\n";
918 #endif
919 #ifndef NDEBUG
920  const bool should_not_call_eWiseApplyMonoidAMSA_base = false;
921  assert( should_not_call_eWiseApplyMonoidAMSA_base );
922 #endif
923  (void) z;
924  (void) mask;
925  (void) alpha;
926  (void) y;
927  (void) monoid;
928  (void) phase;
929  return UNSUPPORTED;
930  }
931 
1008  template<
1010  class OP, enum Backend backend,
1011  typename OutputType, typename InputType1, typename InputType2,
1012  typename Coords
1013  >
1017  const InputType2 beta,
1018  const OP &op = OP(),
1019  const Phase &phase = EXECUTE,
1020  const typename std::enable_if<
1025  >::type * const = nullptr
1026  ) {
1027 #ifdef _DEBUG
1028  std::cout << "In eWiseApply ([T1]<-[T2]<-T3), operator, base\n";
1029 #endif
1030 #ifndef NDEBUG
1031  const bool should_not_call_eWiseApplyOpAAS_base = false;
1032  assert( should_not_call_eWiseApplyOpAAS_base );
1033 #endif
1034  (void) z;
1035  (void) x;
1036  (void) beta;
1037  (void) op;
1038  (void) phase;
1039  return UNSUPPORTED;
1040  }
1041 
1119  template<
1121  class OP, enum Backend backend,
1122  typename OutputType, typename MaskType,
1123  typename InputType1, typename InputType2,
1124  typename Coords
1125  >
1130  const InputType2 beta,
1131  const OP &op = OP(),
1132  const Phase &phase = EXECUTE,
1133  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1138  >::type * const = nullptr
1139  ) {
1140 #ifdef _DEBUG
1141  std::cout << "In masked eWiseApply ([T1]<-[T2]<-T3, operator, base)\n";
1142 #endif
1143 #ifndef NDEBUG
1144  const bool should_not_call_eWiseApplyOpAMAS_base = false;
1145  assert( should_not_call_eWiseApplyOpAMAS_base );
1146 #endif
1147  (void) z;
1148  (void) mask;
1149  (void) x;
1150  (void) beta;
1151  (void) op;
1152  (void) phase;
1153  return UNSUPPORTED;
1154  }
1155 
1230  template<
1232  class Monoid, enum Backend backend,
1233  typename OutputType, typename InputType1, typename InputType2,
1234  typename Coords
1235  >
1239  const InputType2 beta,
1240  const Monoid &monoid = Monoid(),
1241  const Phase &phase = EXECUTE,
1242  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1246  void >::type * const = nullptr
1247  ) {
1248 #ifdef _DEBUG
1249  std::cout << "In unmasked eWiseApply ([T1]<-[T2]<-T3, monoid, base)\n";
1250 #endif
1251 #ifndef NDEBUG
1252  const bool should_not_call_eWiseApplyMonoidAAS_base = false;
1253  assert( should_not_call_eWiseApplyMonoidAAS_base );
1254 #endif
1255  (void) z;
1256  (void) x;
1257  (void) beta;
1258  (void) monoid;
1259  (void) phase;
1260  return UNSUPPORTED;
1261  }
1262 
1341  template<
1343  class Monoid, enum Backend backend,
1344  typename OutputType, typename MaskType,
1345  typename InputType1, typename InputType2,
1346  typename Coords
1347  >
1352  const InputType2 beta,
1353  const Monoid &monoid = Monoid(),
1354  const Phase &phase = EXECUTE,
1355  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1360  >::type * const = nullptr
1361  ) {
1362 #ifdef _DEBUG
1363  std::cout << "In masked eWiseApply ([T1]<-[T2]<-T3, monoid, base)\n";
1364 #endif
1365 #ifndef NDEBUG
1366  const bool should_not_call_eWiseApplyMonoidAMAS_base = false;
1367  assert( should_not_call_eWiseApplyMonoidAMAS_base );
1368 #endif
1369  (void) z;
1370  (void) mask;
1371  (void) x;
1372  (void) beta;
1373  (void) monoid;
1374  (void) phase;
1375  return UNSUPPORTED;
1376  }
1377 
1454  template<
1456  class OP, enum Backend backend,
1457  typename OutputType, typename InputType1, typename InputType2,
1458  typename Coords
1459  >
1464  const OP &op = OP(),
1465  const Phase &phase = EXECUTE,
1466  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1470  >::type * const = nullptr
1471  ) {
1472 #ifdef _DEBUG
1473  std::cout << "In eWiseApply ([T1]<-[T2]<-[T3]), operator variant\n";
1474 #endif
1475 #ifndef NDEBUG
1476  const bool should_not_call_eWiseApplyOpAAA_base = false;
1477  assert( should_not_call_eWiseApplyOpAAA_base );
1478 #endif
1479  (void) z;
1480  (void) x;
1481  (void) y;
1482  (void) op;
1483  (void) phase;
1484  return UNSUPPORTED;
1485  }
1486 
1566  template<
1568  class OP, enum Backend backend,
1569  typename OutputType, typename MaskType,
1570  typename InputType1, typename InputType2,
1571  typename Coords
1572  >
1578  const OP &op = OP(),
1579  const Phase &phase = EXECUTE,
1580  const typename std::enable_if<
1586  >::type * const = nullptr
1587  ) {
1588 #ifdef _DEBUG
1589  std::cout << "In masked eWiseApply ([T1]<-[T2]<-[T3], operator, base)\n";
1590 #endif
1591 #ifndef NDEBUG
1592  const bool should_not_call_eWiseApplyOpAMAA_base = false;
1593  assert( should_not_call_eWiseApplyOpAMAA_base );
1594 #endif
1595  (void) z;
1596  (void) mask;
1597  (void) x;
1598  (void) y;
1599  (void) op;
1600  (void) phase;
1601  return UNSUPPORTED;
1602  }
1603 
1681  template<
1683  class Monoid, enum Backend backend,
1684  typename OutputType, typename InputType1, typename InputType2,
1685  typename Coords
1686  >
1691  const Monoid &monoid = Monoid(),
1692  const Phase &phase = EXECUTE,
1693  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1697  >::type * const = nullptr
1698  ) {
1699 #ifdef _DEBUG
1700  std::cout << "In unmasked eWiseApply ([T1]<-[T2]<-[T3], monoid, base)\n";
1701 #endif
1702 #ifndef NDEBUG
1703  const bool should_not_call_eWiseApplyOpAMAA_base = false;
1704  assert( should_not_call_eWiseApplyOpAMAA_base );
1705 #endif
1706  (void) z;
1707  (void) x;
1708  (void) y;
1709  (void) monoid;
1710  (void) phase;
1711  return UNSUPPORTED;
1712  }
1713 
1789  template<
1791  class Monoid, enum Backend backend,
1792  typename OutputType, typename MaskType,
1793  typename InputType1, typename InputType2,
1794  typename Coords
1795  >
1801  const Monoid &monoid = Monoid(),
1802  const Phase &phase = EXECUTE,
1803  const typename std::enable_if<
1809  >::type * const = nullptr
1810  ) {
1811 #ifdef _DEBUG
1812  std::cout << "In masked eWiseApply ([T1]<-[T2]<-[T3], monoid, base)\n";
1813 #endif
1814 #ifndef NDEBUG
1815  const bool should_not_call_eWiseApplyMonoidAMAA_base = false;
1816  assert( should_not_call_eWiseApplyMonoidAMAA_base );
1817 #endif
1818  (void) z;
1819  (void) mask;
1820  (void) x;
1821  (void) y;
1822  (void) monoid;
1823  (void) phase;
1824  return UNSUPPORTED;
1825  }
1826 
1906  template<
1908  class Ring, enum Backend backend,
1909  typename OutputType, typename InputType1, typename InputType2,
1910  typename Coords
1911  >
1916  const Ring &ring = Ring(),
1917  const Phase &phase = EXECUTE,
1918  const typename std::enable_if< !grb::is_object< OutputType >::value &&
1922  >::type * const = nullptr
1923  ) {
1924 #ifdef _DEBUG
1925  std::cout << "in eWiseAdd ([T1] <- [T2] + [T3]), unmasked, base";
1926 #endif
1927 #ifndef NDEBUG
1928  const bool should_not_call_eWiseAddAAA_base = false;
1929  assert( should_not_call_eWiseAddAAA_base );
1930 #endif
1931  (void) z;
1932  (void) x;
1933  (void) y;
1934  (void) ring;
1935  (void) phase;
1936  return UNSUPPORTED;
1937  }
1938 
2013  template<
2015  class Ring, enum Backend backend,
2016  typename InputType1, typename InputType2, typename OutputType,
2017  typename Coords
2018  >
2021  const InputType1 alpha,
2023  const Ring &ring = Ring(),
2024  const Phase &phase = EXECUTE,
2025  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2029  >::type * const = nullptr
2030  ) {
2031 #ifdef _DEBUG
2032  std::cout << "in eWiseAdd ([T1] <- T2 + [T3]), unmasked, base";
2033 #endif
2034 #ifndef NDEBUG
2035  const bool should_not_call_eWiseAddASA_base = false;
2036  assert( should_not_call_eWiseAddASA_base );
2037 #endif
2038  (void) z;
2039  (void) alpha;
2040  (void) y;
2041  (void) ring;
2042  (void) phase;
2043  return UNSUPPORTED;
2044  }
2045 
2120  template<
2122  class Ring, enum Backend backend,
2123  typename InputType1, typename InputType2, typename OutputType,
2124  typename Coords
2125  >
2129  const InputType2 beta,
2130  const Ring &ring = Ring(),
2131  const Phase &phase = EXECUTE,
2132  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2136  >::type * const = nullptr
2137  ) {
2138 #ifdef _DEBUG
2139  std::cout << "in eWiseAdd ([T1] <- [T2] + T3), unmasked, base";
2140 #endif
2141 #ifndef NDEBUG
2142  const bool should_not_call_eWiseAddAAS_base = false;
2143  assert( should_not_call_eWiseAddAAS_base );
2144 #endif
2145  (void) z;
2146  (void) x;
2147  (void) beta;
2148  (void) ring;
2149  (void) phase;
2150  return UNSUPPORTED;
2151  }
2152 
2223  template<
2225  class Ring, enum Backend backend,
2226  typename InputType1, typename InputType2, typename OutputType,
2227  typename Coords
2228  >
2231  const InputType1 alpha,
2232  const InputType2 beta,
2233  const Ring &ring = Ring(),
2234  const Phase &phase = EXECUTE,
2235  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2239  >::type * const = nullptr
2240  ) {
2241 #ifdef _DEBUG
2242  std::cout << "in eWiseAdd ([T1] <- T2 + T3), unmasked, base";
2243 #endif
2244 #ifndef NDEBUG
2245  const bool should_not_call_eWiseAddASS_base = false;
2246  assert( should_not_call_eWiseAddASS_base );
2247 #endif
2248  (void) z;
2249  (void) alpha;
2250  (void) beta;
2251  (void) ring;
2252  (void) phase;
2253  return UNSUPPORTED;
2254  }
2255 
2341  template<
2343  class Ring, enum Backend backend,
2344  typename OutputType, typename MaskType,
2345  typename InputType1, typename InputType2,
2346  typename Coords
2347  >
2353  const Ring &ring = Ring(),
2354  const Phase &phase = EXECUTE,
2355  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2359  >::type * const = nullptr
2360  ) {
2361 #ifdef _DEBUG
2362  std::cout << "in eWiseAdd ([T1] <- [T2] + [T3]), masked, base";
2363 #endif
2364 #ifndef NDEBUG
2365  const bool should_not_call_eWiseAddAMAA_base = false;
2366  assert( should_not_call_eWiseAddAMAA_base );
2367 #endif
2368  (void) z;
2369  (void) mask;
2370  (void) x;
2371  (void) y;
2372  (void) ring;
2373  (void) phase;
2374  return UNSUPPORTED;
2375  }
2376 
2458  template<
2460  class Ring, enum Backend backend,
2461  typename InputType1, typename InputType2,
2462  typename OutputType, typename MaskType,
2463  typename Coords
2464  >
2468  const InputType1 alpha,
2470  const Ring &ring = Ring(),
2471  const Phase &phase = EXECUTE,
2472  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2476  >::type * const = nullptr
2477  ) {
2478 #ifdef _DEBUG
2479  std::cout << "in eWiseAdd ([T1] <- T2 + [T3]), masked, base";
2480 #endif
2481 #ifndef NDEBUG
2482  const bool should_not_call_eWiseAddAMSA_base = false;
2483  assert( should_not_call_eWiseAddAMSA_base );
2484 #endif
2485  (void) z;
2486  (void) mask;
2487  (void) alpha;
2488  (void) y;
2489  (void) ring;
2490  (void) phase;
2491  return UNSUPPORTED;
2492  }
2493 
2575  template<
2577  class Ring, enum Backend backend,
2578  typename InputType1, typename InputType2,
2579  typename OutputType, typename MaskType,
2580  typename Coords
2581  >
2586  const InputType2 beta,
2587  const Ring &ring = Ring(),
2588  const Phase &phase = EXECUTE,
2589  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2593  >::type * const = nullptr
2594  ) {
2595 #ifdef _DEBUG
2596  std::cout << "in eWiseAdd ([T1] <- [T2] + T3), masked, base";
2597 #endif
2598 #ifndef NDEBUG
2599  const bool should_not_call_eWiseAddAMAS_base = false;
2600  assert( should_not_call_eWiseAddAMAS_base );
2601 #endif
2602  (void) z;
2603  (void) mask;
2604  (void) x;
2605  (void) beta;
2606  (void) ring;
2607  (void) phase;
2608  return UNSUPPORTED;
2609  }
2610 
2688  template<
2690  class Ring, enum Backend backend,
2691  typename InputType1, typename InputType2,
2692  typename OutputType, typename MaskType,
2693  typename Coords
2694  >
2698  const InputType1 alpha,
2699  const InputType2 beta,
2700  const Ring &ring = Ring(),
2701  const Phase &phase = EXECUTE,
2702  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2706  >::type * const = nullptr
2707  ) {
2708 #ifdef _DEBUG
2709  std::cout << "in eWiseAdd ([T1] <- T2 + T3), masked, base";
2710 #endif
2711 #ifndef NDEBUG
2712  const bool should_not_call_eWiseAddAMSS_base = false;
2713  assert( should_not_call_eWiseAddAMSS_base );
2714 #endif
2715  (void) z;
2716  (void) mask;
2717  (void) alpha;
2718  (void) beta;
2719  (void) ring;
2720  (void) phase;
2721  return UNSUPPORTED;
2722  }
2723 
2788  template<
2790  class Ring, enum Backend backend,
2791  typename InputType1, typename InputType2, typename OutputType,
2792  typename Coords
2793  >
2798  const Ring &ring = Ring(),
2799  const Phase &phase = EXECUTE,
2800  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2804  >::type * const = nullptr
2805  ) {
2806 #ifdef _DEBUG
2807  std::cout << "in eWiseMul ([T1] <- [T2] * [T3]), unmasked, base";
2808 #endif
2809 #ifndef NDEBUG
2810  const bool should_not_call_eWiseMulAAA_base = false;
2811  assert( should_not_call_eWiseMulAAA_base );
2812 #endif
2813  (void) z;
2814  (void) x;
2815  (void) y;
2816  (void) ring;
2817  (void) phase;
2818  return UNSUPPORTED;
2819  }
2820 
2885  template<
2887  class Ring, enum Backend backend,
2888  typename InputType1, typename InputType2, typename OutputType,
2889  typename Coords
2890  >
2893  const InputType1 alpha,
2895  const Ring &ring = Ring(),
2896  const Phase &phase = EXECUTE,
2897  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2901  >::type * const = nullptr
2902  ) {
2903 #ifdef _DEBUG
2904  std::cout << "in eWiseMul ([T1] <- T2 * [T3]), unmasked, base";
2905 #endif
2906 #ifndef NDEBUG
2907  const bool should_not_call_eWiseMulASA_base = false;
2908  assert( should_not_call_eWiseMulASA_base );
2909 #endif
2910  (void) z;
2911  (void) alpha;
2912  (void) y;
2913  (void) ring;
2914  (void) phase;
2915  return UNSUPPORTED;
2916  }
2917 
2982  template<
2984  class Ring, enum Backend backend,
2985  typename InputType1, typename InputType2, typename OutputType,
2986  typename Coords
2987  >
2991  const InputType2 beta,
2992  const Ring &ring = Ring(),
2993  const Phase &phase = EXECUTE,
2994  const typename std::enable_if< !grb::is_object< OutputType >::value &&
2998  >::type * const = nullptr
2999  ) {
3000 #ifdef _DEBUG
3001  std::cout << "in eWiseMul ([T1] <- [T2] * T3), unmasked, base";
3002 #endif
3003 #ifndef NDEBUG
3004  const bool should_not_call_eWiseMulAAS_base = false;
3005  assert( should_not_call_eWiseMulAAS_base );
3006 #endif
3007  (void) z;
3008  (void) x;
3009  (void) beta;
3010  (void) ring;
3011  (void) phase;
3012  return UNSUPPORTED;
3013  }
3014 
3075  template<
3077  class Ring, enum Backend backend,
3078  typename InputType1, typename InputType2, typename OutputType,
3079  typename Coords
3080  >
3083  const InputType1 alpha,
3084  const InputType2 beta,
3085  const Ring &ring = Ring(),
3086  const Phase &phase = EXECUTE,
3087  const typename std::enable_if< !grb::is_object< OutputType >::value &&
3091  >::type * const = nullptr
3092  ) {
3093 #ifdef _DEBUG
3094  std::cout << "in eWiseMul ([T1] <- T2 * T3), unmasked, base";
3095 #endif
3096 #ifndef NDEBUG
3097  const bool should_not_call_eWiseMulASS_base = false;
3098  assert( should_not_call_eWiseMulASS_base );
3099 #endif
3100  (void) z;
3101  (void) alpha;
3102  (void) beta;
3103  (void) ring;
3104  (void) phase;
3105  return UNSUPPORTED;
3106  }
3107 
3177  template<
3179  class Ring, enum Backend backend,
3180  typename InputType1, typename InputType2,
3181  typename OutputType, typename MaskType,
3182  typename Coords
3183  >
3189  const Ring &ring = Ring(),
3190  const Phase &phase = EXECUTE,
3191  const typename std::enable_if< !grb::is_object< OutputType >::value &&
3195  >::type * const = nullptr
3196  ) {
3197 #ifdef _DEBUG
3198  std::cout << "in eWiseMul ([T1] <- [T2] * [T3]), masked, base";
3199 #endif
3200 #ifndef NDEBUG
3201  const bool should_not_call_eWiseMulAMAA_base = false;
3202  assert( should_not_call_eWiseMulAMAA_base );
3203 #endif
3204  (void) z;
3205  (void) mask;
3206  (void) x;
3207  (void) y;
3208  (void) ring;
3209  (void) phase;
3210  return UNSUPPORTED;
3211  }
3212 
3282  template<
3284  class Ring, enum Backend backend,
3285  typename InputType1, typename InputType2,
3286  typename OutputType, typename MaskType,
3287  typename Coords
3288  >
3292  const InputType1 alpha,
3294  const Ring &ring = Ring(),
3295  const Phase &phase = EXECUTE,
3296  const typename std::enable_if< !grb::is_object< OutputType >::value &&
3300  >::type * const = nullptr
3301  ) {
3302 #ifdef _DEBUG
3303  std::cout << "in eWiseMul ([T1] <- T2 * [T3]), masked, base";
3304 #endif
3305 #ifndef NDEBUG
3306  const bool should_not_call_eWiseMulAMSA_base = false;
3307  assert( should_not_call_eWiseMulAMSA_base );
3308 #endif
3309  (void) z;
3310  (void) mask;
3311  (void) alpha;
3312  (void) y;
3313  (void) ring;
3314  (void) phase;
3315  return UNSUPPORTED;
3316  }
3317 
3387  template<
3389  class Ring, enum Backend backend,
3390  typename InputType1, typename InputType2,
3391  typename OutputType, typename MaskType,
3392  typename Coords
3393  >
3398  const InputType2 beta,
3399  const Ring &ring = Ring(),
3400  const Phase &phase = EXECUTE,
3401  const typename std::enable_if< !grb::is_object< OutputType >::value &&
3405  >::type * const = nullptr
3406  ) {
3407 #ifdef _DEBUG
3408  std::cout << "in eWiseMul ([T1] <- [T2] * T3), masked, base";
3409 #endif
3410 #ifndef NDEBUG
3411  const bool should_not_call_eWiseMulAMAS_base = false;
3412  assert( should_not_call_eWiseMulAMAS_base );
3413 #endif
3414  (void) z;
3415  (void) mask;
3416  (void) x;
3417  (void) beta;
3418  (void) ring;
3419  (void) phase;
3420  return UNSUPPORTED;
3421  }
3422 
3489  template<
3491  class Ring, enum Backend backend,
3492  typename InputType1, typename InputType2,
3493  typename OutputType, typename MaskType,
3494  typename Coords
3495  >
3499  const InputType1 alpha,
3500  const InputType2 beta,
3501  const Ring &ring = Ring(),
3502  const Phase &phase = EXECUTE,
3503  const typename std::enable_if< !grb::is_object< OutputType >::value &&
3507  >::type * const = nullptr
3508  ) {
3509 #ifdef _DEBUG
3510  std::cout << "in eWiseMul ([T1] <- T2 * T3), masked, base";
3511 #endif
3512 #ifndef NDEBUG
3513  const bool should_not_call_eWiseMulAMSS_base = false;
3514  assert( should_not_call_eWiseMulAMSS_base );
3515 #endif
3516  (void) z;
3517  (void) mask;
3518  (void) alpha;
3519  (void) beta;
3520  (void) ring;
3521  (void) phase;
3522  return UNSUPPORTED;
3523  }
3524 
3739  template<
3740  typename Func,
3741  typename DataType,
3742  Backend backend,
3743  typename Coords,
3744  typename... Args
3745  >
3747  const Func f,
3748  const Vector< DataType, backend, Coords > & x, Args...
3749  ) {
3750 #ifndef NDEBUG
3751  const bool should_not_call_base_vector_ewiselambda = false;
3752  assert( should_not_call_base_vector_ewiselambda );
3753 #endif
3754  (void) f;
3755  (void) x;
3756  return UNSUPPORTED;
3757  }
3758 
3834  template<
3836  class Monoid,
3837  typename InputType, typename IOType, typename MaskType,
3838  Backend backend, typename Coords
3839  >
3841  IOType &x,
3844  const Monoid &monoid = Monoid(),
3845  const typename std::enable_if< !grb::is_object< IOType >::value &&
3849  >::type * const = nullptr
3850  ) {
3851 #ifndef NDEBUG
3852  const bool should_not_call_base_scalar_foldl = false;
3853  assert( should_not_call_base_scalar_foldl );
3854 #endif
3855  (void) y;
3856  (void) x;
3857  (void) mask;
3858  (void) monoid;
3859  return UNSUPPORTED;
3860  }
3861 
3867  template<
3869  class Monoid,
3870  typename IOType, typename InputType,
3871  Backend backend,
3872  typename Coords
3873  >
3875  IOType &x,
3877  const Monoid &monoid = Monoid(),
3878  const typename std::enable_if<
3881  void >::type * const = nullptr
3882  ) {
3883 #ifndef NDEBUG
3884  const bool should_not_call_base_scalar_foldl_nomask = false;
3885  assert( should_not_call_base_scalar_foldl_nomask );
3886 #endif
3887  (void) y;
3888  (void) x;
3889  (void) monoid;
3890  return UNSUPPORTED;
3891  }
3892 
3903  template<
3905  class OP,
3906  typename IOType, typename InputType, typename MaskType,
3907  Backend backend, typename Coords
3908  >
3910  IOType &x,
3913  const OP &op = OP(),
3914  const typename std::enable_if<
3918  void >::type * const = nullptr
3919  ) {
3920 #ifndef NDEBUG
3921  const bool should_not_call_base_scalar_foldl_op = false;
3922  assert( should_not_call_base_scalar_foldl_op );
3923 #endif
3924  (void) x;
3925  (void) y;
3926  (void) mask;
3927  (void) op;
3928  return UNSUPPORTED;
3929  }
3930 
3937  template<
3939  class Monoid,
3940  typename InputType, typename IOType, typename MaskType,
3941  Backend backend, typename Coords
3942  >
3946  IOType &y,
3947  const Monoid &monoid = Monoid(),
3948  const typename std::enable_if< !grb::is_object< IOType >::value &&
3952  >::type * const = nullptr
3953  ) {
3954 #ifndef NDEBUG
3955  const bool should_not_call_base_scalar_foldr = false;
3956  assert( should_not_call_base_scalar_foldr );
3957 #endif
3958  (void) y;
3959  (void) x;
3960  (void) mask;
3961  (void) monoid;
3962  return UNSUPPORTED;
3963  }
3964 
3971  template<
3973  class Monoid,
3974  typename IOType, typename InputType,
3975  Backend backend, typename Coords
3976  >
3979  IOType &x,
3980  const Monoid &monoid = Monoid(),
3981  const typename std::enable_if<
3984  void >::type * const = nullptr
3985  ) {
3986 #ifndef NDEBUG
3987  const bool should_not_call_base_scalar_foldr_nomask = false;
3988  assert( should_not_call_base_scalar_foldr_nomask );
3989 #endif
3990  (void) y;
3991  (void) x;
3992  (void) monoid;
3993  return UNSUPPORTED;
3994  }
3995 
4050  template<
4052  class AddMonoid, class AnyOp,
4053  typename OutputType, typename InputType1, typename InputType2,
4054  enum Backend backend, typename Coords
4055  >
4057  OutputType &z,
4060  const AddMonoid &addMonoid = AddMonoid(),
4061  const AnyOp &anyOp = AnyOp(),
4062  const Phase &phase = EXECUTE,
4063  const typename std::enable_if<
4069  void >::type * const = nullptr
4070  ) {
4071 #ifdef _DEBUG
4072  std::cout << "Should not call base grb::dot (monoid-operator version)\n";
4073 #endif
4074 #ifndef NDEBUG
4075  const bool should_not_call_base_dot_monOp = false;
4076  assert( should_not_call_base_dot_monOp );
4077 #endif
4078  (void) z;
4079  (void) x;
4080  (void) y;
4081  (void) addMonoid;
4082  (void) anyOp;
4083  (void) phase;
4084  return UNSUPPORTED;
4085  }
4086 
4129  template<
4131  class Ring,
4132  typename IOType, typename InputType1, typename InputType2,
4133  Backend backend, typename Coords
4134  >
4136  IOType &z,
4139  const Ring &ring = Ring(),
4140  const Phase &phase = EXECUTE,
4141  const typename std::enable_if<
4146  void >::type * const = nullptr
4147  ) {
4148 #ifdef _DEBUG
4149  std::cout << "Should not call base grb::dot (semiring version)\n";
4150 #endif
4151 #ifndef NDEBUG
4152  const bool should_not_call_base_dot_semiring = false;
4153  assert( should_not_call_base_dot_semiring );
4154 #endif
4155  (void) z;
4156  (void) x;
4157  (void) y;
4158  (void) ring;
4159  (void) phase;
4160  return UNSUPPORTED;
4161  }
4162 
4165 } // end namespace grb
4166 
4167 #endif // end _H_GRB_BASE_BLAS1
4168 
Defines the ALP error codes.
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:208
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:2794
This file contains a register of all backends that are either implemented, under implementation,...
RC
Return codes of ALP primitives.
Definition: rc.hpp:47
A GraphBLAS vector.
Definition: vector.hpp:64
Used to inspect whether a given type is an ALP monoid.
Definition: type_traits.hpp:85
Speculatively assumes that the output container of the requested operation has enough capacity to com...
Definition: phase.hpp:257
Used to inspect whether a given type is an ALP semiring.
Definition: type_traits.hpp:66
Defines the various phases an ALP/GraphBLAS primitive may be executed with.
Used to inspect whether a given type is an ALP/GraphBLAS object.
Definition: type_traits.hpp:130
Phase
Primitives with sparse ALP/GraphBLAS output containers may run into the issue where an appropriate gr...
Definition: phase.hpp:152
static constexpr Descriptor no_operation
Indicates no additional pre- or post-processing on any of the GraphBLAS function arguments.
Definition: descriptors.hpp:63
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
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:3840
Indicates that the execution of the requested primitive with the given arguments is not supported by ...
Definition: rc.hpp:129
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:3943
Backend
A collection of all backends.
Definition: backends.hpp:49
The ALP/GraphBLAS namespace.
Definition: graphblas.hpp:477
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:4056
Provides an ALP semiring.
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.
Definition: blas1.hpp:3746
Used to inspect whether a given type is an ALP operator.
Definition: type_traits.hpp:104
Provides a set of standard binary operators.
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:1912
A generalised monoid.
Definition: monoid.hpp:54
Provides an ALP monoid.