1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911
|
//------------------------------------------------------------------------------
// GraphBLAS.h: definitions for the GraphBLAS package
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS is a complete implementation of the GraphBLAS
// standard, which defines a set of sparse matrix operations on an extended
// algebra of semirings, using an almost unlimited variety of operators and
// types. When applied to sparse adjacency matrices, these algebraic
// operations are equivalent to computations on graphs. GraphBLAS provides a
// powerful and expressive framework creating graph algorithms based on the
// elegant mathematics of sparse matrix operations on a semiring.
// This GraphBLAS.h file contains GraphBLAS definitions for user applications
// to #include. A few functions and variables with the prefix GB_ need to be
// defined in this file and are thus technically visible to the user, but they
// must not be accessed in user code. They are here only so that the ANSI C11
// _Generic feature can be used in the user-accessible polymorphic functions,
// or to implement a fast GxB_Iterator using macros.
// This implementation conforms to the GraphBLAS API Specification and also
// includes functions and features that are extensions to the spec, which are
// given names of the form GxB_* for functions, built-in objects, and macros,
// so it is clear which are in the spec and which are extensions. Extensions
// with the name GxB_* are user-accessible in SuiteSparse:GraphBLAS but cannot
// be guaranteed to appear in all GraphBLAS implementations.
// Regarding "historical" functions and symbols: when a GxB_* function or
// symbol is added to the C API Specification, the new GrB_* name should be
// used instead. The old GxB_* name will be kept for historical reasons,
// documented here and in working order; it might no longer be mentioned in the
// user guide. Historical functions and symbols would only be removed in the
// rare case that they cause a serious conflict with future methods.
#ifndef GRAPHBLAS_H
#define GRAPHBLAS_H
//==============================================================================
// include files required by GraphBLAS
//==============================================================================
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <stddef.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
//==============================================================================
// renaming for use in R2021a or later
//==============================================================================
#define GB_CAT2(x,y) x ## y
#define GB_EVAL2(x,y) GB_CAT2 (x,y)
#ifdef GBRENAME
// All symbols must be renamed for the @GrB interface when using
// R2021a and following, since those versions include an earlier
// version of SuiteSparse:GraphBLAS.
#define GB(x) GB_EVAL2 (GM_, x)
#define GRB(x) GB_EVAL2 (GrM_, x)
#define GXB(x) GB_EVAL2 (GxM_, x)
#define GrB GrM
#define GxB GxM
#include "GB_rename.h"
#else
// Use the standard GraphBLAS prefix.
#define GB(x) GB_EVAL2 (GB_, x)
#define GRB(x) GB_EVAL2 (GrB_, x)
#define GXB(x) GB_EVAL2 (GxB_, x)
#endif
//==============================================================================
// compiler variations
//==============================================================================
// Exporting/importing symbols for Microsoft Visual Studio
#if ( _MSC_VER && !(__INTEL_COMPILER || __INTEL_CLANG_COMPILER) )
#ifdef GB_LIBRARY
// compiling SuiteSparse:GraphBLAS itself, exporting symbols to user apps
#define GB_PUBLIC extern __declspec ( dllexport )
#else
// compiling the user application, importing symbols from SuiteSparse:GraphBLAS
#define GB_PUBLIC extern __declspec ( dllimport )
#endif
#else
// for other compilers
#define GB_PUBLIC extern
#endif
// GraphBLAS requires an ANSI C11 compiler for its polymorphic functions (using
// the _Generic keyword), but it can be used in an C90 compiler if those
// functions are disabled.
// With ANSI C11 and later, _Generic keyword and polymorphic functions can be
// used. Earlier versions of the language do not have this feature.
#ifdef __STDC_VERSION__
// ANSI C17: 201710L
// ANSI C11: 201112L
// ANSI C99: 199901L
// ANSI C95: 199409L
#define GxB_STDC_VERSION __STDC_VERSION__
#else
// assume ANSI C90 / C89
#define GxB_STDC_VERSION 199001L
#endif
//------------------------------------------------------------------------------
// definitions for complex types, and restrict keyword
//------------------------------------------------------------------------------
#undef GB_restrict
// See:
// https://www.drdobbs.com/complex-arithmetic-in-the-intersection-o/184401628#
#if defined ( __cplusplus )
extern "C++"
{
// C++ complex types
#include <cmath>
#include <complex>
#undef I
typedef std::complex<float> GxB_FC32_t ;
typedef std::complex<double> GxB_FC64_t ;
}
#define GxB_CMPLXF(r,i) GxB_FC32_t(r,i)
#define GxB_CMPLX(r,i) GxB_FC64_t(r,i)
#define GB_restrict
#elif ( _MSC_VER && !(__INTEL_COMPILER || __INTEL_CLANG_COMPILER) )
// Microsoft Windows complex types
#include <complex.h>
#undef I
typedef _Fcomplex GxB_FC32_t ;
typedef _Dcomplex GxB_FC64_t ;
#define GxB_CMPLXF(r,i) (_FCbuild (r,i))
#define GxB_CMPLX(r,i) ( _Cbuild (r,i))
#define GB_restrict __restrict
#else
// ANSI C11 complex types
#include <complex.h>
#undef I
typedef float complex GxB_FC32_t ;
typedef double complex GxB_FC64_t ;
#ifndef CMPLX
// gcc 6.2 on the the Mac doesn't #define CMPLX
#define GxB_CMPLX(r,i) \
((GxB_FC64_t)((double)(r)) + (GxB_FC64_t)((double)(i) * _Complex_I))
#else
// use the ANSI C11 CMPLX macro
#define GxB_CMPLX(r,i) CMPLX (r,i)
#endif
#ifndef CMPLXF
// gcc 6.2 on the the Mac doesn't #define CMPLXF
#define GxB_CMPLXF(r,i) \
((GxB_FC32_t)((float)(r)) + (GxB_FC32_t)((float)(i) * _Complex_I))
#else
// use the ANSI C11 CMPLXF macro
#define GxB_CMPLXF(r,i) CMPLXF (r,i)
#endif
// restrict keyword
#if defined ( __NVCC__ )
// NVIDIA nvcc
#define GB_restrict __restrict__
#elif GxB_STDC_VERSION >= 199901L
// ANSI C99 or later
#define GB_restrict restrict
#else
// ANSI C95 and earlier: no restrict keyword
#define GB_restrict
#endif
#endif
//==============================================================================
// version control
//==============================================================================
// There are two version numbers that user codes can check against with
// compile-time #if tests: the version of this GraphBLAS implementation,
// and the version of the GraphBLAS specification it conforms to. User code
// can use tests like this:
//
// #if GxB_SPEC_VERSION >= GxB_VERSION (2,0,3)
// ... use features in GraphBLAS specification 2.0.3 ...
// #else
// ... only use features in early specifications
// #endif
//
// #if GxB_IMPLEMENTATION > GxB_VERSION (1,4,0)
// ... use features from version 1.4.0 of a GraphBLAS package
// #endif
// X_GRAPHBLAS: names this particular implementation:
#define GxB_SUITESPARSE_GRAPHBLAS
// GxB_VERSION: a single integer for comparing spec and version levels
#define GxB_VERSION(major,minor,sub) \
(((major)*1000ULL + (minor))*1000ULL + (sub))
// The version of this implementation, and the GraphBLAS API version:
#define GxB_IMPLEMENTATION_NAME "SuiteSparse:GraphBLAS"
#define GxB_IMPLEMENTATION_DATE "@GraphBLAS_DATE@"
#define GxB_IMPLEMENTATION_MAJOR @GraphBLAS_VERSION_MAJOR@
#define GxB_IMPLEMENTATION_MINOR @GraphBLAS_VERSION_MINOR@
#define GxB_IMPLEMENTATION_SUB @GraphBLAS_VERSION_SUB@
#define GxB_SPEC_DATE "@GraphBLAS_API_DATE@"
#define GxB_SPEC_MAJOR @GraphBLAS_API_VERSION_MAJOR@
#define GxB_SPEC_MINOR @GraphBLAS_API_VERSION_MINOR@
#define GxB_SPEC_SUB @GraphBLAS_API_VERSION_SUB@
// compile-time access to the C API Version number of this library.
#define GRB_VERSION GxB_SPEC_MAJOR
#define GRB_SUBVERSION GxB_SPEC_MINOR
#define GxB_IMPLEMENTATION \
GxB_VERSION (GxB_IMPLEMENTATION_MAJOR, \
GxB_IMPLEMENTATION_MINOR, \
GxB_IMPLEMENTATION_SUB)
// The 'about' string the describes this particular implementation of GraphBLAS:
#define GxB_IMPLEMENTATION_ABOUT \
"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved." \
"\nhttp://suitesparse.com Dept of Computer Sci. & Eng, Texas A&M University.\n"
// The GraphBLAS license for this particular implementation of GraphBLAS:
#define GxB_IMPLEMENTATION_LICENSE \
"SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved." \
"\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may\n"\
"not use SuiteSparse:GraphBLAS except in compliance with the License. You\n" \
"may obtain a copy of the License at\n\n" \
" http://www.apache.org/licenses/LICENSE-2.0\n\n" \
"Unless required by applicable law or agreed to in writing, software\n" \
"distributed under the License is distributed on an \"AS IS\" BASIS,\n" \
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" \
"See the License for the specific language governing permissions and\n" \
"limitations under the License.\n"
//------------------------------------------------------------------------------
// GraphBLAS C API version
//------------------------------------------------------------------------------
#define GxB_SPEC_VERSION GxB_VERSION(GxB_SPEC_MAJOR,GxB_SPEC_MINOR,GxB_SPEC_SUB)
// The 'spec' string describes the GraphBLAS spec:
#define GxB_SPEC_ABOUT \
"GraphBLAS C API, by Aydin Buluc, Timothy Mattson, Scott McMillan,\n" \
"Jose' Moreira, Carl Yang, and Benjamin Brock. Based on 'GraphBLAS\n" \
"Mathematics by Jeremy Kepner. See also 'Graph Algorithms in the Language\n" \
"of Linear Algebra,' edited by J. Kepner and J. Gilbert, SIAM, 2011.\n"
//==============================================================================
// GrB_Index: the GraphBLAS integer
//==============================================================================
// GrB_Index: row or column index, or matrix dimension. This typedef is used
// for row and column indices, or matrix and vector dimensions.
typedef uint64_t GrB_Index ;
// GrB_INDEX_MAX is the largest permissible index value. The largest valid
// matrix or vector dimension is GrB_INDEX_MAX+1, or 2^60 in SuiteSparse:GrB.
#define GrB_INDEX_MAX ((GrB_Index) (1ULL << 60) - 1)
// GxB_INDEX_MAX is historical; use GrB_INDEX_MAX+1 instead. It differs by one
// from GrB_INDEX_MAX, since it defined the largest valid matrix or vector
// dimension.
#define GxB_INDEX_MAX ((GrB_Index) (1ULL << 60))
//==============================================================================
// GraphBLAS error and informational codes
//==============================================================================
// All GraphBLAS functions return a code that indicates if it was successful
// or not. If more information is required, the GrB_error function can be
// called, which returns a string that provides more information on the last
// return value from GraphBLAS.
// The v1.3 C API did not specify the enum values, but they appear in v2.0.
// Changing them will require SuiteSparse:GraphBLAS to bump to v6.x.
// Error codes GrB_NOT_IMPLEMENTED and GrB_EMPTY_OBJECT are new to v2.0.
typedef enum
{
GrB_SUCCESS = 0, // all is well
//--------------------------------------------------------------------------
// informational codes, not an error:
//--------------------------------------------------------------------------
GrB_NO_VALUE = 1, // A(i,j) requested but not there
GxB_EXHAUSTED = 2, // iterator is exhausted
//--------------------------------------------------------------------------
// errors:
//--------------------------------------------------------------------------
GrB_UNINITIALIZED_OBJECT = -1, // object has not been initialized
GrB_NULL_POINTER = -2, // input pointer is NULL
GrB_INVALID_VALUE = -3, // generic error; some value is bad
GrB_INVALID_INDEX = -4, // row or column index is out of bounds
GrB_DOMAIN_MISMATCH = -5, // object domains are not compatible
GrB_DIMENSION_MISMATCH = -6, // matrix dimensions do not match
GrB_OUTPUT_NOT_EMPTY = -7, // output matrix already has values
GrB_NOT_IMPLEMENTED = -8, // method not implemented
GrB_PANIC = -101, // unknown error
GrB_OUT_OF_MEMORY = -102, // out of memory
GrB_INSUFFICIENT_SPACE = -103, // output array not large enough
GrB_INVALID_OBJECT = -104, // object is corrupted
GrB_INDEX_OUT_OF_BOUNDS = -105, // row or col index out of bounds
GrB_EMPTY_OBJECT = -106 // an object does not contain a value
}
GrB_Info ;
//==============================================================================
// GrB_init / GrB_finalize
//==============================================================================
// GrB_init must called before any other GraphBLAS operation. GrB_finalize
// must be called as the last GraphBLAS operation.
// GrB_init defines the mode that GraphBLAS will use: blocking or
// non-blocking. With blocking mode, all operations finish before returning to
// the user application. With non-blocking mode, operations can be left
// pending, and are computed only when needed.
// The extension GxB_init does the work of GrB_init, but it also defines the
// memory management functions that SuiteSparse:GraphBLAS will use internally.
typedef enum
{
GrB_NONBLOCKING = 0, // methods may return with pending computations
GrB_BLOCKING = 1, // no computations are ever left pending
// DRAFT: in progress, do not use:
GxB_NONBLOCKING_GPU = 2, // non-blocking mode, allow use of GPU(s)
GxB_BLOCKING_GPU = 3, // blocking mode, allow use of GPU(s)
}
GrB_Mode ;
GB_PUBLIC
GrB_Info GrB_init // start up GraphBLAS
(
GrB_Mode mode // blocking or non-blocking mode, no GPU
) ;
GB_PUBLIC
GrB_Info GxB_init // start up GraphBLAS and also define malloc, etc
(
GrB_Mode mode, // blocking or non-blocking mode,
// with or without GPU
// pointers to memory management functions
void * (* user_malloc_function ) (size_t),
void * (* user_calloc_function ) (size_t, size_t),
void * (* user_realloc_function ) (void *, size_t),
void (* user_free_function ) (void *)
) ;
GB_PUBLIC
GrB_Info GrB_finalize (void) ; // finish GraphBLAS
//==============================================================================
// GrB_getVersion: GraphBLAS C API version
//==============================================================================
// GrB_getVersion provides a runtime access of the C API Version.
GB_PUBLIC
GrB_Info GrB_getVersion // runtime access to C API version number
(
unsigned int *version, // returns GRB_VERSION
unsigned int *subversion // returns GRB_SUBVERSION
) ;
//==============================================================================
// GrB_Descriptor: the GraphBLAS descriptor
//==============================================================================
// The GrB_Descriptor is used to modify the behavior of GraphBLAS operations.
//
// GrB_OUTP: can be GxB_DEFAULT or GrB_REPLACE. If GrB_REPLACE, then C is
// cleared after taking part in the accum operation but before the mask.
// In other words, C<Mask> = accum (C,T) is split into Z = accum(C,T) ;
// C=0 ; C<Mask> = Z.
//
// GrB_MASK: can be GxB_DEFAULT, GrB_COMP, GrB_STRUCTURE, or set to both
// GrB_COMP and GrB_STRUCTURE. If GxB_DEFAULT, the mask is used
// normally, where Mask(i,j)=1 means C(i,j) can be modified by C<Mask>=Z,
// and Mask(i,j)=0 means it cannot be modified even if Z(i,j) is has been
// computed and differs from C(i,j). If GrB_COMP, this is the same as
// taking the logical complement of the Mask. If GrB_STRUCTURE is set,
// the value of the mask is not considered, just its pattern. The
// GrB_COMP and GrB_STRUCTURE settings can be combined.
//
// GrB_INP0: can be GxB_DEFAULT or GrB_TRAN. If GxB_DEFAULT, the first input
// is used as-is. If GrB_TRAN, it is transposed. Only matrices are
// transposed this way. Vectors are never transposed via the
// GrB_Descriptor.
//
// GrB_INP1: the same as GrB_INP0 but for the second input
//
// GxB_NTHREADS: the maximum number of threads to use in the current method.
// If <= GxB_DEFAULT (which is zero), then the number of threads is
// determined automatically. This is the default value.
//
// GxB_CHUNK: an integer parameter that determines the number of threads to use
// for a small problem. If w is the work to be performed, and chunk is
// the value of this parameter, then the # of threads is limited to floor
// (w/chunk). The default chunk is currently 64K, but this may change in
// the future. If chunk is set to <= GxB_DEFAULT (that is, zero), the
// default is used.
//
// GxB_AxB_METHOD: this is a hint to SuiteSparse:GraphBLAS on which algorithm
// it should use to compute C=A*B, in GrB_mxm, GrB_mxv, and GrB_vxm.
// SuiteSparse:GraphBLAS has four different heuristics, and the default
// method (GxB_DEFAULT) selects between them automatically. The complete
// rule is in the User Guide. The brief discussion here assumes all
// matrices are stored by column. All methods compute the same result,
// except that floating-point roundoff may differ when working on
// floating-point data types.
//
// GxB_AxB_SAXPY: C(:,j)=A*B(:,j) is computed using a mix of Gustavson
// and Hash methods. Each task in the parallel computation makes its
// own decision between these two methods, via a heuristic.
//
// GxB_AxB_GUSTAVSON: This is the same as GxB_AxB_SAXPY, except that
// every task uses Gustavon's method, computing C(:,j)=A*B(:,j) via a
// gather/scatter workspace of size equal to the number of rows of A.
// Very good general-purpose method, but sometimes the workspace can
// be too large when many threads are used.
//
// GxB_AxB_HASH: This is the same as GxB_AxB_SAXPY, except that every
// task uses the Hash method. It is very good for hypersparse
// matrices and uses very little workspace, and so it scales well to
// many threads.
//
// GxB_AxB_DOT: computes C(i,j) = A(:,i)'*B(:,j), for each entry C(i,j).
// A very specialized method that works well only if the mask is
// present, very sparse, and not complemented, or when C is a dense
// vector or matrix, or when C is small.
//
// GxB_SORT: GrB_mxm and other methods may return a matrix in a 'jumbled'
// state, with indices out of order. The sort is left pending. Some
// methods can tolerate jumbled matrices on input, so this can be faster.
// However, in some cases, it can be faster for GrB_mxm to sort its output
// as it is computed. With GxB_SORT set to GxB_DEFAULT, the sort is left
// pending. With GxB_SORT set to a nonzero value, GrB_mxm typically sorts
// the resulting matrix C (but not always; this is just a hint). If
// GrB_init is called with GrB_BLOCKING mode, the sort will always be
// done, and this setting has no effect.
//
// GxB_COMPRESSION: compression method for GxB_Matrix_serialize and
// GxB_Vector_serialize. The default is ZSTD (level 1).
//
// GxB_IMPORT: GxB_FAST_IMPORT (faster, for trusted input data) or
// GxB_SECURE_IMPORT (slower, for untrusted input data), for the
// GxB*_pack* methods.
// The following are enumerated values in both the GrB_Desc_Field and the
// GxB_Option_Field for global options. They are defined with the same integer
// value for both enums, so the user can use them for both.
#define GxB_NTHREADS 5
#define GxB_CHUNK 7
// GPU control (DRAFT: in progress, do not use)
#define GxB_GPU_CONTROL 21
#define GxB_GPU_CHUNK 22
typedef enum
{
GrB_OUTP = 0, // descriptor for output of a method
GrB_MASK = 1, // descriptor for the mask input of a method
GrB_INP0 = 2, // descriptor for the first input of a method
GrB_INP1 = 3, // descriptor for the second input of a method
GxB_DESCRIPTOR_NTHREADS = GxB_NTHREADS, // max number of threads to use.
// If <= GxB_DEFAULT, then GraphBLAS selects the number
// of threads automatically.
GxB_DESCRIPTOR_CHUNK = GxB_CHUNK, // chunk size for small problems.
// If <= GxB_DEFAULT, then the default is used.
// GPU control (DRAFT: in progress, do not use)
GxB_DESCRIPTOR_GPU_CONTROL = GxB_GPU_CONTROL,
GxB_DESCRIPTOR_GPU_CHUNK = GxB_GPU_CHUNK,
GxB_AxB_METHOD = 1000, // descriptor for selecting C=A*B algorithm
GxB_SORT = 35, // control sort in GrB_mxm
GxB_COMPRESSION = 36, // select compression for serialize
GxB_IMPORT = 37, // secure vs fast import
}
GrB_Desc_Field ;
typedef enum
{
// for all GrB_Descriptor fields:
GxB_DEFAULT = 0, // default behavior of the method
// for GrB_OUTP only:
GrB_REPLACE = 1, // clear the output before assigning new values to it
// for GrB_MASK only:
GrB_COMP = 2, // use the structural complement of the input
GrB_STRUCTURE = 4, // use the only pattern of the mask, not its values
// for GrB_INP0 and GrB_INP1 only:
GrB_TRAN = 3, // use the transpose of the input
// for GxB_GPU_CONTROL only (DRAFT: in progress, do not use)
GxB_GPU_ALWAYS = 2001,
GxB_GPU_NEVER = 2002,
// for GxB_AxB_METHOD only:
GxB_AxB_GUSTAVSON = 1001, // gather-scatter saxpy method
GxB_AxB_DOT = 1003, // dot product
GxB_AxB_HASH = 1004, // hash-based saxpy method
GxB_AxB_SAXPY = 1005, // saxpy method (any kind)
// for GxB_IMPORT only:
GxB_SECURE_IMPORT = 502 // GxB*_pack* methods trust their input data
}
GrB_Desc_Value ;
// default for GxB pack is to trust the input data
#define GxB_FAST_IMPORT GxB_DEFAULT
typedef struct GB_Descriptor_opaque *GrB_Descriptor ;
GB_PUBLIC
GrB_Info GrB_Descriptor_new // create a new descriptor
(
GrB_Descriptor *descriptor // handle of descriptor to create
) ;
GB_PUBLIC
GrB_Info GrB_Descriptor_set // set a parameter in a descriptor
(
GrB_Descriptor desc, // descriptor to modify
GrB_Desc_Field field, // parameter to change
GrB_Desc_Value val // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Descriptor_get // get a parameter from a descriptor
(
GrB_Desc_Value *val, // value of the parameter
GrB_Descriptor desc, // descriptor to query; NULL means defaults
GrB_Desc_Field field // parameter to query
) ;
GB_PUBLIC
GrB_Info GxB_Desc_set // set a parameter in a descriptor
(
GrB_Descriptor desc, // descriptor to modify
GrB_Desc_Field field, // parameter to change
... // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Desc_set_INT32 // set a parameter in a descriptor
(
GrB_Descriptor desc, // descriptor to modify
GrB_Desc_Field field, // parameter to change
int32_t value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Desc_set_FP64 // set a parameter in a descriptor
(
GrB_Descriptor desc, // descriptor to modify
GrB_Desc_Field field, // parameter to change
double value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Desc_get // get a parameter from a descriptor
(
GrB_Descriptor desc, // descriptor to query; NULL means defaults
GrB_Desc_Field field, // parameter to query
... // value of the parameter
) ;
GB_PUBLIC
GrB_Info GxB_Desc_get_INT32 // get a parameter from a descriptor
(
GrB_Descriptor desc, // descriptor to query; NULL is ok
GrB_Desc_Field field, // parameter to query
int32_t *value // return value of the descriptor
) ;
GB_PUBLIC
GrB_Info GxB_Desc_get_FP64 // get a parameter from a descriptor
(
GrB_Descriptor desc, // descriptor to query; NULL is ok
GrB_Desc_Field field, // parameter to query
double *value // return value of the descriptor
) ;
GB_PUBLIC
GrB_Info GrB_Descriptor_free // free a descriptor
(
GrB_Descriptor *descriptor // handle of descriptor to free
) ;
// Predefined descriptors and their values:
GB_PUBLIC
GrB_Descriptor // OUTP MASK MASK INP0 INP1
// structural complement
// =========== ============== ========== ======== ========
// GrB_NULL // - - - - -
GrB_DESC_T1 , // - - - - GrB_TRAN
GrB_DESC_T0 , // - - - GrB_TRAN -
GrB_DESC_T0T1 , // - - - GrB_TRAN GrB_TRAN
GrB_DESC_C , // - - GrB_COMP - -
GrB_DESC_CT1 , // - - GrB_COMP - GrB_TRAN
GrB_DESC_CT0 , // - - GrB_COMP GrB_TRAN -
GrB_DESC_CT0T1 , // - - GrB_COMP GrB_TRAN GrB_TRAN
GrB_DESC_S , // - GrB_STRUCTURE - - -
GrB_DESC_ST1 , // - GrB_STRUCTURE - - GrB_TRAN
GrB_DESC_ST0 , // - GrB_STRUCTURE - GrB_TRAN -
GrB_DESC_ST0T1 , // - GrB_STRUCTURE - GrB_TRAN GrB_TRAN
GrB_DESC_SC , // - GrB_STRUCTURE GrB_COMP - -
GrB_DESC_SCT1 , // - GrB_STRUCTURE GrB_COMP - GrB_TRAN
GrB_DESC_SCT0 , // - GrB_STRUCTURE GrB_COMP GrB_TRAN -
GrB_DESC_SCT0T1 , // - GrB_STRUCTURE GrB_COMP GrB_TRAN GrB_TRAN
GrB_DESC_R , // GrB_REPLACE - - - -
GrB_DESC_RT1 , // GrB_REPLACE - - - GrB_TRAN
GrB_DESC_RT0 , // GrB_REPLACE - - GrB_TRAN -
GrB_DESC_RT0T1 , // GrB_REPLACE - - GrB_TRAN GrB_TRAN
GrB_DESC_RC , // GrB_REPLACE - GrB_COMP - -
GrB_DESC_RCT1 , // GrB_REPLACE - GrB_COMP - GrB_TRAN
GrB_DESC_RCT0 , // GrB_REPLACE - GrB_COMP GrB_TRAN -
GrB_DESC_RCT0T1 , // GrB_REPLACE - GrB_COMP GrB_TRAN GrB_TRAN
GrB_DESC_RS , // GrB_REPLACE GrB_STRUCTURE - - -
GrB_DESC_RST1 , // GrB_REPLACE GrB_STRUCTURE - - GrB_TRAN
GrB_DESC_RST0 , // GrB_REPLACE GrB_STRUCTURE - GrB_TRAN -
GrB_DESC_RST0T1 , // GrB_REPLACE GrB_STRUCTURE - GrB_TRAN GrB_TRAN
GrB_DESC_RSC , // GrB_REPLACE GrB_STRUCTURE GrB_COMP - -
GrB_DESC_RSCT1 , // GrB_REPLACE GrB_STRUCTURE GrB_COMP - GrB_TRAN
GrB_DESC_RSCT0 , // GrB_REPLACE GrB_STRUCTURE GrB_COMP GrB_TRAN -
GrB_DESC_RSCT0T1 ; // GrB_REPLACE GrB_STRUCTURE GrB_COMP GrB_TRAN GrB_TRAN
// GrB_NULL is the default descriptor, with all settings at their defaults:
//
// OUTP: do not replace the output
// MASK: mask is valued and not complemented
// INP0: first input not transposed
// INP1: second input not transposed
// Predefined descriptors may not be modified or freed. Attempting to modify
// them results in an error (GrB_INVALID_VALUE). Attempts to free them are
// silently ignored.
//==============================================================================
// GrB_Type: data types
//==============================================================================
typedef struct GB_Type_opaque *GrB_Type ;
// GraphBLAS predefined types and their counterparts in pure C:
GB_PUBLIC GrB_Type
GrB_BOOL , // in C: bool
GrB_INT8 , // in C: int8_t
GrB_INT16 , // in C: int16_t
GrB_INT32 , // in C: int32_t
GrB_INT64 , // in C: int64_t
GrB_UINT8 , // in C: uint8_t
GrB_UINT16 , // in C: uint16_t
GrB_UINT32 , // in C: uint32_t
GrB_UINT64 , // in C: uint64_t
GrB_FP32 , // in C: float
GrB_FP64 , // in C: double
GxB_FC32 , // in C: float complex
GxB_FC64 ; // in C: double complex
//------------------------------------------------------------------------------
// helper macros for polymorphic functions
//------------------------------------------------------------------------------
#define GB_CAT(w,x,y,z) w ## x ## y ## z
#define GB_CONCAT(w,x,y,z) GB_CAT (w, x, y, z)
#if GxB_STDC_VERSION >= 201112L
#define GB_CASES(p,prefix,func) \
const bool p : GB_CONCAT ( prefix, _, func, _BOOL ), \
bool p : GB_CONCAT ( prefix, _, func, _BOOL ), \
const int8_t p : GB_CONCAT ( prefix, _, func, _INT8 ), \
int8_t p : GB_CONCAT ( prefix, _, func, _INT8 ), \
const int16_t p : GB_CONCAT ( prefix, _, func, _INT16 ), \
int16_t p : GB_CONCAT ( prefix, _, func, _INT16 ), \
const int32_t p : GB_CONCAT ( prefix, _, func, _INT32 ), \
int32_t p : GB_CONCAT ( prefix, _, func, _INT32 ), \
const int64_t p : GB_CONCAT ( prefix, _, func, _INT64 ), \
int64_t p : GB_CONCAT ( prefix, _, func, _INT64 ), \
const uint8_t p : GB_CONCAT ( prefix, _, func, _UINT8 ), \
uint8_t p : GB_CONCAT ( prefix, _, func, _UINT8 ), \
const uint16_t p : GB_CONCAT ( prefix, _, func, _UINT16 ), \
uint16_t p : GB_CONCAT ( prefix, _, func, _UINT16 ), \
const uint32_t p : GB_CONCAT ( prefix, _, func, _UINT32 ), \
uint32_t p : GB_CONCAT ( prefix, _, func, _UINT32 ), \
const uint64_t p : GB_CONCAT ( prefix, _, func, _UINT64 ), \
uint64_t p : GB_CONCAT ( prefix, _, func, _UINT64 ), \
const float p : GB_CONCAT ( prefix, _, func, _FP32 ), \
float p : GB_CONCAT ( prefix, _, func, _FP32 ), \
const double p : GB_CONCAT ( prefix, _, func, _FP64 ), \
double p : GB_CONCAT ( prefix, _, func, _FP64 ), \
const GxB_FC32_t p : GB_CONCAT ( GxB , _, func, _FC32 ), \
GxB_FC32_t p : GB_CONCAT ( GxB , _, func, _FC32 ), \
const GxB_FC64_t p : GB_CONCAT ( GxB , _, func, _FC64 ), \
GxB_FC64_t p : GB_CONCAT ( GxB , _, func, _FC64 ), \
const void * : GB_CONCAT ( prefix, _, func, _UDT ), \
void * : GB_CONCAT ( prefix, _, func, _UDT )
#endif
//------------------------------------------------------------------------------
// GrB_Type_new: create a new type
//------------------------------------------------------------------------------
// GrB_Type_new is implemented both as a macro and a function. Both are
// user-callable. The default is to use the macro, since this allows the name
// of the type to be saved as a string, for subsequent error reporting by
// GrB_error.
#undef GrB_Type_new
#undef GrM_Type_new
GB_PUBLIC
GrB_Info GRB (Type_new) // create a new GraphBLAS type
(
GrB_Type *type, // handle of user type to create
size_t sizeof_ctype // size = sizeof (ctype) of the C type
) ;
// user code should not directly use GB_STR or GB_XSTR
// GB_STR: convert the content of x into a string "x"
#define GB_XSTR(x) GB_STR(x)
#define GB_STR(x) #x
// GrB_Type_new as a user-callable macro, which allows the name of the ctype
// to be added to the new type. The type_defn is unknown.
#define GrB_Type_new(utype, sizeof_ctype) \
GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL)
#define GrM_Type_new(utype, sizeof_ctype) \
GxB_Type_new(utype, sizeof_ctype, GB_STR(sizeof_ctype), NULL)
// GxB_Type_new creates a type with a name and definition that are known to
// GraphBLAS, as strings. The type_name is any valid string (max length of 128
// characters, including the required null-terminating character) that may
// appear as the name of a C type created by a C "typedef" statement. It must
// not contain any white-space characters. Example, creating a type of size
// 16*4+4 = 68 bytes, with a 4-by-4 dense float array and a 32-bit integer:
//
// typedef struct { float x [4][4] ; int color ; } myquaternion ;
// GrB_Type MyQtype ;
// GxB_Type_new (&MyQtype, sizeof (myquaternion), "myquaternion",
// "typedef struct { float x [4][4] ; int color ; } myquaternion ;") ;
//
// The type_name and type_defn are both null-terminated strings. Currently,
// type_defn is unused, but it will be required for best performance when a JIT
// is implemented in SuiteSparse:GraphBLAS (both on the CPU and GPU). User
// defined types created by GrB_Type_new will not work with a JIT.
//
// At most GxB_MAX_NAME_LEN characters are accessed in type_name; characters
// beyond that limit are silently ignored.
#define GxB_MAX_NAME_LEN 128
GB_PUBLIC
GrB_Info GxB_Type_new // create a new named GraphBLAS type
(
GrB_Type *type, // handle of user type to create
size_t sizeof_ctype, // size = sizeof (ctype) of the C type
const char *type_name, // name of the type (max 128 characters)
const char *type_defn // typedef for the type (no max length)
) ;
// GB_Type_new is historical: use GxB_Type_new instead
GB_PUBLIC
GrB_Info GB_Type_new // not user-callable
(
GrB_Type *type, // handle of user type to create
size_t sizeof_ctype, // size of the user type
const char *type_name // name of the type, as "sizeof (ctype)"
) ;
GB_PUBLIC
GrB_Info GxB_Type_name // return the name of a GraphBLAS type
(
char *type_name, // name of the type (char array of size at least
// GxB_MAX_NAME_LEN, owned by the user application).
const GrB_Type type
) ;
GB_PUBLIC
GrB_Info GxB_Type_size // determine the size of the type
(
size_t *size, // the sizeof the type
const GrB_Type type // type to determine the sizeof
) ;
GB_PUBLIC
GrB_Info GxB_Type_from_name // return the built-in GrB_Type from a name
(
GrB_Type *type, // built-in type, or NULL if user-defined
const char *type_name // array of size at least GxB_MAX_NAME_LEN
) ;
GB_PUBLIC
GrB_Info GrB_Type_free // free a user-defined type
(
GrB_Type *type // handle of user-defined type to free
) ;
//==============================================================================
// GrB_UnaryOp: unary operators
//==============================================================================
// GrB_UnaryOp: a function z=f(x). The function f must have the signature:
// void f (void *z, const void *x) ;
// The pointers are void * but they are always of pointers to objects of type
// ztype and xtype, respectively. The function must typecast its arguments as
// needed from void* to ztype* and xtype*.
typedef struct GB_UnaryOp_opaque *GrB_UnaryOp ;
//------------------------------------------------------------------------------
// built-in unary operators, z = f(x)
//------------------------------------------------------------------------------
GB_PUBLIC GrB_UnaryOp
// For these functions z=f(x), z and x have the same type.
// The suffix in the name is the type of x and z.
// z = x z = -x z = 1/x z = ! (x != 0)
// identity additive multiplicative logical
// inverse inverse negation
GrB_IDENTITY_BOOL, GrB_AINV_BOOL, GrB_MINV_BOOL, GxB_LNOT_BOOL,
GrB_IDENTITY_INT8, GrB_AINV_INT8, GrB_MINV_INT8, GxB_LNOT_INT8,
GrB_IDENTITY_INT16, GrB_AINV_INT16, GrB_MINV_INT16, GxB_LNOT_INT16,
GrB_IDENTITY_INT32, GrB_AINV_INT32, GrB_MINV_INT32, GxB_LNOT_INT32,
GrB_IDENTITY_INT64, GrB_AINV_INT64, GrB_MINV_INT64, GxB_LNOT_INT64,
GrB_IDENTITY_UINT8, GrB_AINV_UINT8, GrB_MINV_UINT8, GxB_LNOT_UINT8,
GrB_IDENTITY_UINT16, GrB_AINV_UINT16, GrB_MINV_UINT16, GxB_LNOT_UINT16,
GrB_IDENTITY_UINT32, GrB_AINV_UINT32, GrB_MINV_UINT32, GxB_LNOT_UINT32,
GrB_IDENTITY_UINT64, GrB_AINV_UINT64, GrB_MINV_UINT64, GxB_LNOT_UINT64,
GrB_IDENTITY_FP32, GrB_AINV_FP32, GrB_MINV_FP32, GxB_LNOT_FP32,
GrB_IDENTITY_FP64, GrB_AINV_FP64, GrB_MINV_FP64, GxB_LNOT_FP64,
// complex unary operators:
GxB_IDENTITY_FC32, GxB_AINV_FC32, GxB_MINV_FC32, // no LNOT
GxB_IDENTITY_FC64, GxB_AINV_FC64, GxB_MINV_FC64, // for complex
// z = 1 z = abs(x) z = bnot(x) z = signum
// one absolute value bitwise negation
GxB_ONE_BOOL, GrB_ABS_BOOL,
GxB_ONE_INT8, GrB_ABS_INT8, GrB_BNOT_INT8,
GxB_ONE_INT16, GrB_ABS_INT16, GrB_BNOT_INT16,
GxB_ONE_INT32, GrB_ABS_INT32, GrB_BNOT_INT32,
GxB_ONE_INT64, GrB_ABS_INT64, GrB_BNOT_INT64,
GxB_ONE_UINT8, GrB_ABS_UINT8, GrB_BNOT_UINT8,
GxB_ONE_UINT16, GrB_ABS_UINT16, GrB_BNOT_UINT16,
GxB_ONE_UINT32, GrB_ABS_UINT32, GrB_BNOT_UINT32,
GxB_ONE_UINT64, GrB_ABS_UINT64, GrB_BNOT_UINT64,
GxB_ONE_FP32, GrB_ABS_FP32,
GxB_ONE_FP64, GrB_ABS_FP64,
// complex unary operators:
GxB_ONE_FC32, // for complex types, z = abs(x)
GxB_ONE_FC64, // is real; listed below.
// Boolean negation, z = !x, where both z and x are boolean. There is no
// suffix since z and x are only boolean. This operator is identical to
// GxB_LNOT_BOOL; it just has a different name.
GrB_LNOT ;
// GxB_ABS is now in the v1.3 spec, the following names are historical:
GB_PUBLIC GrB_UnaryOp
// z = abs(x)
GxB_ABS_BOOL,
GxB_ABS_INT8,
GxB_ABS_INT16,
GxB_ABS_INT32,
GxB_ABS_INT64,
GxB_ABS_UINT8,
GxB_ABS_UINT16,
GxB_ABS_UINT32,
GxB_ABS_UINT64,
GxB_ABS_FP32,
GxB_ABS_FP64 ;
//------------------------------------------------------------------------------
// Unary operators for floating-point types only
//------------------------------------------------------------------------------
// The following floating-point unary operators and their ANSI C11 equivalents,
// are only defined for floating-point (real and complex) types.
GB_PUBLIC GrB_UnaryOp
//--------------------------------------------------------------------------
// z = f(x) where z and x have the same type (all 4 floating-point types)
//--------------------------------------------------------------------------
// z = sqrt (x) z = log (x) z = exp (x) z = log2 (x)
GxB_SQRT_FP32, GxB_LOG_FP32, GxB_EXP_FP32, GxB_LOG2_FP32,
GxB_SQRT_FP64, GxB_LOG_FP64, GxB_EXP_FP64, GxB_LOG2_FP64,
GxB_SQRT_FC32, GxB_LOG_FC32, GxB_EXP_FC32, GxB_LOG2_FC32,
GxB_SQRT_FC64, GxB_LOG_FC64, GxB_EXP_FC64, GxB_LOG2_FC64,
// z = sin (x) z = cos (x) z = tan (x)
GxB_SIN_FP32, GxB_COS_FP32, GxB_TAN_FP32,
GxB_SIN_FP64, GxB_COS_FP64, GxB_TAN_FP64,
GxB_SIN_FC32, GxB_COS_FC32, GxB_TAN_FC32,
GxB_SIN_FC64, GxB_COS_FC64, GxB_TAN_FC64,
// z = acos (x) z = asin (x) z = atan (x)
GxB_ACOS_FP32, GxB_ASIN_FP32, GxB_ATAN_FP32,
GxB_ACOS_FP64, GxB_ASIN_FP64, GxB_ATAN_FP64,
GxB_ACOS_FC32, GxB_ASIN_FC32, GxB_ATAN_FC32,
GxB_ACOS_FC64, GxB_ASIN_FC64, GxB_ATAN_FC64,
// z = sinh (x) z = cosh (x) z = tanh (x)
GxB_SINH_FP32, GxB_COSH_FP32, GxB_TANH_FP32,
GxB_SINH_FP64, GxB_COSH_FP64, GxB_TANH_FP64,
GxB_SINH_FC32, GxB_COSH_FC32, GxB_TANH_FC32,
GxB_SINH_FC64, GxB_COSH_FC64, GxB_TANH_FC64,
// z = acosh (x) z = asinh (x) z = atanh (x) z = signum (x)
GxB_ACOSH_FP32, GxB_ASINH_FP32, GxB_ATANH_FP32, GxB_SIGNUM_FP32,
GxB_ACOSH_FP64, GxB_ASINH_FP64, GxB_ATANH_FP64, GxB_SIGNUM_FP64,
GxB_ACOSH_FC32, GxB_ASINH_FC32, GxB_ATANH_FC32, GxB_SIGNUM_FC32,
GxB_ACOSH_FC64, GxB_ASINH_FC64, GxB_ATANH_FC64, GxB_SIGNUM_FC64,
// z = ceil (x) z = floor (x) z = round (x) z = trunc (x)
GxB_CEIL_FP32, GxB_FLOOR_FP32, GxB_ROUND_FP32, GxB_TRUNC_FP32,
GxB_CEIL_FP64, GxB_FLOOR_FP64, GxB_ROUND_FP64, GxB_TRUNC_FP64,
GxB_CEIL_FC32, GxB_FLOOR_FC32, GxB_ROUND_FC32, GxB_TRUNC_FC32,
GxB_CEIL_FC64, GxB_FLOOR_FC64, GxB_ROUND_FC64, GxB_TRUNC_FC64,
// z = exp2 (x) z = expm1 (x) z = log10 (x) z = log1p (x)
GxB_EXP2_FP32, GxB_EXPM1_FP32, GxB_LOG10_FP32, GxB_LOG1P_FP32,
GxB_EXP2_FP64, GxB_EXPM1_FP64, GxB_LOG10_FP64, GxB_LOG1P_FP64,
GxB_EXP2_FC32, GxB_EXPM1_FC32, GxB_LOG10_FC32, GxB_LOG1P_FC32,
GxB_EXP2_FC64, GxB_EXPM1_FC64, GxB_LOG10_FC64, GxB_LOG1P_FC64,
//--------------------------------------------------------------------------
// z = f(x) where z and x are the same type (floating-point real only)
//--------------------------------------------------------------------------
// z = lgamma (x) z = tgamma (x) z = erf (x) z = erfc (x)
GxB_LGAMMA_FP32, GxB_TGAMMA_FP32, GxB_ERF_FP32, GxB_ERFC_FP32,
GxB_LGAMMA_FP64, GxB_TGAMMA_FP64, GxB_ERF_FP64, GxB_ERFC_FP64,
// z = cbrt (x)
GxB_CBRT_FP32,
GxB_CBRT_FP64,
// frexpx and frexpe return the mantissa and exponent, respectively,
// from the ANSI C11 frexp function. The exponent is returned as a
// floating-point value, not an integer.
// z = frexpx (x) z = frexpe (x)
GxB_FREXPX_FP32, GxB_FREXPE_FP32,
GxB_FREXPX_FP64, GxB_FREXPE_FP64,
//--------------------------------------------------------------------------
// z = f(x) where z and x are the same type (complex only)
//--------------------------------------------------------------------------
// z = conj (x)
GxB_CONJ_FC32,
GxB_CONJ_FC64,
//--------------------------------------------------------------------------
// z = f(x) where z is real and x is complex:
//--------------------------------------------------------------------------
// z = creal (x) z = cimag (x) z = carg (x) z = abs (x)
GxB_CREAL_FC32, GxB_CIMAG_FC32, GxB_CARG_FC32, GxB_ABS_FC32,
GxB_CREAL_FC64, GxB_CIMAG_FC64, GxB_CARG_FC64, GxB_ABS_FC64,
//--------------------------------------------------------------------------
// z = f(x) where z is bool and x is any floating-point type
//--------------------------------------------------------------------------
// z = isinf (x)
GxB_ISINF_FP32,
GxB_ISINF_FP64,
GxB_ISINF_FC32, // isinf (creal (x)) || isinf (cimag (x))
GxB_ISINF_FC64, // isinf (creal (x)) || isinf (cimag (x))
// z = isnan (x)
GxB_ISNAN_FP32,
GxB_ISNAN_FP64,
GxB_ISNAN_FC32, // isnan (creal (x)) || isnan (cimag (x))
GxB_ISNAN_FC64, // isnan (creal (x)) || isnan (cimag (x))
// z = isfinite (x)
GxB_ISFINITE_FP32,
GxB_ISFINITE_FP64,
GxB_ISFINITE_FC32, // isfinite (real (x)) && isfinite (cimag (x))
GxB_ISFINITE_FC64 ; // isfinite (real (x)) && isfinite (cimag (x))
//------------------------------------------------------------------------------
// methods for unary operators
//------------------------------------------------------------------------------
typedef void (*GxB_unary_function) (void *, const void *) ;
// GrB_UnaryOp_new creates a user-defined unary op, with an automatic
// detection of the operator name.
#undef GrB_UnaryOp_new
#undef GrM_UnaryOp_new
GB_PUBLIC
GrB_Info GRB (UnaryOp_new) // create a new user-defined unary operator
(
GrB_UnaryOp *unaryop, // handle for the new unary operator
GxB_unary_function function, // pointer to the unary function
GrB_Type ztype, // type of output z
GrB_Type xtype // type of input x
) ;
#define GrB_UnaryOp_new(op,f,z,x) \
GxB_UnaryOp_new(op,f,z,x, GB_STR(f), NULL)
#define GrM_UnaryOp_new(op,f,z,x) \
GxM_UnaryOp_new(op,f,z,x, GB_STR(f), NULL)
// GxB_UnaryOp_new creates a named user-defined unary op.
GB_PUBLIC
GrB_Info GxB_UnaryOp_new // create a new user-defined unary operator
(
GrB_UnaryOp *unaryop, // handle for the new unary operator
GxB_unary_function function, // pointer to the unary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x
const char *unop_name, // name of the user function
const char *unop_defn // definition of the user function
) ;
// GB_UnaryOp_new is historical: use GxB_UnaryOp_new instead
GB_PUBLIC
GrB_Info GB_UnaryOp_new // not user-callable
(
GrB_UnaryOp *unaryop, // handle for the new unary operator
GxB_unary_function function, // pointer to the unary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x
const char *unop_name // name of the user function
) ;
// GxB_UnaryOp_ztype is historical. Use GxB_UnaryOp_ztype_name instead.
GB_PUBLIC
GrB_Info GxB_UnaryOp_ztype // return the type of z
(
GrB_Type *ztype, // return type of output z
GrB_UnaryOp unaryop // unary operator
) ;
GB_PUBLIC
GrB_Info GxB_UnaryOp_ztype_name // return the type_name of z
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_UnaryOp unaryop // unary operator
) ;
// GxB_UnaryOp_xtype is historical. Use GxB_UnaryOp_xtype_name instead.
GB_PUBLIC
GrB_Info GxB_UnaryOp_xtype // return the type of x
(
GrB_Type *xtype, // return type of input x
GrB_UnaryOp unaryop // unary operator
) ;
GB_PUBLIC
GrB_Info GxB_UnaryOp_xtype_name // return the type_name of x
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_UnaryOp unaryop // unary operator
) ;
GB_PUBLIC
GrB_Info GrB_UnaryOp_free // free a user-created unary operator
(
GrB_UnaryOp *unaryop // handle of unary operator to free
) ;
//==============================================================================
// GrB_BinaryOp: binary operators
//==============================================================================
// GrB_BinaryOp: a function z=f(x,y). The function f must have the signature:
// void f (void *z, const void *x, const void *y) ;
// The pointers are void * but they are always of pointers to objects of type
// ztype, xtype, and ytype, respectively. See Demo/usercomplex.c for examples.
typedef struct GB_BinaryOp_opaque *GrB_BinaryOp ;
//------------------------------------------------------------------------------
// built-in binary operators, z = f(x,y), where x,y,z all have the same type
//------------------------------------------------------------------------------
GB_PUBLIC GrB_BinaryOp
// operators for all 13 types (including complex):
// GxB_PAIR_T and GrB_ONEB_T are identical; the latter was added to the
// v2.0 C API Specification.
// z = x z = y z = 1 z = pow (x,y)
GrB_FIRST_BOOL, GrB_SECOND_BOOL, GrB_ONEB_BOOL, GxB_POW_BOOL,
GrB_FIRST_INT8, GrB_SECOND_INT8, GrB_ONEB_INT8, GxB_POW_INT8,
GrB_FIRST_INT16, GrB_SECOND_INT16, GrB_ONEB_INT16, GxB_POW_INT16,
GrB_FIRST_INT32, GrB_SECOND_INT32, GrB_ONEB_INT32, GxB_POW_INT32,
GrB_FIRST_INT64, GrB_SECOND_INT64, GrB_ONEB_INT64, GxB_POW_INT64,
GrB_FIRST_UINT8, GrB_SECOND_UINT8, GrB_ONEB_UINT8, GxB_POW_UINT8,
GrB_FIRST_UINT16, GrB_SECOND_UINT16, GrB_ONEB_UINT16, GxB_POW_UINT16,
GrB_FIRST_UINT32, GrB_SECOND_UINT32, GrB_ONEB_UINT32, GxB_POW_UINT32,
GrB_FIRST_UINT64, GrB_SECOND_UINT64, GrB_ONEB_UINT64, GxB_POW_UINT64,
GrB_FIRST_FP32, GrB_SECOND_FP32, GrB_ONEB_FP32, GxB_POW_FP32,
GrB_FIRST_FP64, GrB_SECOND_FP64, GrB_ONEB_FP64, GxB_POW_FP64,
// complex:
GxB_FIRST_FC32, GxB_SECOND_FC32, GxB_ONEB_FC32, GxB_POW_FC32,
GxB_FIRST_FC64, GxB_SECOND_FC64, GxB_ONEB_FC64, GxB_POW_FC64,
// z = x+y z = x-y z = x*y z = x/y
GrB_PLUS_BOOL, GrB_MINUS_BOOL, GrB_TIMES_BOOL, GrB_DIV_BOOL,
GrB_PLUS_INT8, GrB_MINUS_INT8, GrB_TIMES_INT8, GrB_DIV_INT8,
GrB_PLUS_INT16, GrB_MINUS_INT16, GrB_TIMES_INT16, GrB_DIV_INT16,
GrB_PLUS_INT32, GrB_MINUS_INT32, GrB_TIMES_INT32, GrB_DIV_INT32,
GrB_PLUS_INT64, GrB_MINUS_INT64, GrB_TIMES_INT64, GrB_DIV_INT64,
GrB_PLUS_UINT8, GrB_MINUS_UINT8, GrB_TIMES_UINT8, GrB_DIV_UINT8,
GrB_PLUS_UINT16, GrB_MINUS_UINT16, GrB_TIMES_UINT16, GrB_DIV_UINT16,
GrB_PLUS_UINT32, GrB_MINUS_UINT32, GrB_TIMES_UINT32, GrB_DIV_UINT32,
GrB_PLUS_UINT64, GrB_MINUS_UINT64, GrB_TIMES_UINT64, GrB_DIV_UINT64,
GrB_PLUS_FP32, GrB_MINUS_FP32, GrB_TIMES_FP32, GrB_DIV_FP32,
GrB_PLUS_FP64, GrB_MINUS_FP64, GrB_TIMES_FP64, GrB_DIV_FP64,
// complex:
GxB_PLUS_FC32, GxB_MINUS_FC32, GxB_TIMES_FC32, GxB_DIV_FC32,
GxB_PLUS_FC64, GxB_MINUS_FC64, GxB_TIMES_FC64, GxB_DIV_FC64,
// z = y-x z = y/x z = 1 z = any(x,y)
GxB_RMINUS_BOOL, GxB_RDIV_BOOL, GxB_PAIR_BOOL, GxB_ANY_BOOL,
GxB_RMINUS_INT8, GxB_RDIV_INT8, GxB_PAIR_INT8, GxB_ANY_INT8,
GxB_RMINUS_INT16, GxB_RDIV_INT16, GxB_PAIR_INT16, GxB_ANY_INT16,
GxB_RMINUS_INT32, GxB_RDIV_INT32, GxB_PAIR_INT32, GxB_ANY_INT32,
GxB_RMINUS_INT64, GxB_RDIV_INT64, GxB_PAIR_INT64, GxB_ANY_INT64,
GxB_RMINUS_UINT8, GxB_RDIV_UINT8, GxB_PAIR_UINT8, GxB_ANY_UINT8,
GxB_RMINUS_UINT16, GxB_RDIV_UINT16, GxB_PAIR_UINT16, GxB_ANY_UINT16,
GxB_RMINUS_UINT32, GxB_RDIV_UINT32, GxB_PAIR_UINT32, GxB_ANY_UINT32,
GxB_RMINUS_UINT64, GxB_RDIV_UINT64, GxB_PAIR_UINT64, GxB_ANY_UINT64,
GxB_RMINUS_FP32, GxB_RDIV_FP32, GxB_PAIR_FP32, GxB_ANY_FP32,
GxB_RMINUS_FP64, GxB_RDIV_FP64, GxB_PAIR_FP64, GxB_ANY_FP64,
// complex:
GxB_RMINUS_FC32, GxB_RDIV_FC32, GxB_PAIR_FC32, GxB_ANY_FC32,
GxB_RMINUS_FC64, GxB_RDIV_FC64, GxB_PAIR_FC64, GxB_ANY_FC64,
// The GxB_IS* comparators z=f(x,y) return the same type as their
// inputs. Each of them compute z = (x OP y), where x, y, and z all have
// the same type. The value z is either 1 for true or 0 for false, but it
// is a value with the same type as x and y.
// z = (x == y) z = (x != y)
GxB_ISEQ_BOOL, GxB_ISNE_BOOL,
GxB_ISEQ_INT8, GxB_ISNE_INT8,
GxB_ISEQ_INT16, GxB_ISNE_INT16,
GxB_ISEQ_INT32, GxB_ISNE_INT32,
GxB_ISEQ_INT64, GxB_ISNE_INT64,
GxB_ISEQ_UINT8, GxB_ISNE_UINT8,
GxB_ISEQ_UINT16, GxB_ISNE_UINT16,
GxB_ISEQ_UINT32, GxB_ISNE_UINT32,
GxB_ISEQ_UINT64, GxB_ISNE_UINT64,
GxB_ISEQ_FP32, GxB_ISNE_FP32,
GxB_ISEQ_FP64, GxB_ISNE_FP64,
// complex:
GxB_ISEQ_FC32, GxB_ISNE_FC32,
GxB_ISEQ_FC64, GxB_ISNE_FC64,
// z = (x > y) z = (x < y) z = (x >= y) z = (x <= y)
GxB_ISGT_BOOL, GxB_ISLT_BOOL, GxB_ISGE_BOOL, GxB_ISLE_BOOL,
GxB_ISGT_INT8, GxB_ISLT_INT8, GxB_ISGE_INT8, GxB_ISLE_INT8,
GxB_ISGT_INT16, GxB_ISLT_INT16, GxB_ISGE_INT16, GxB_ISLE_INT16,
GxB_ISGT_INT32, GxB_ISLT_INT32, GxB_ISGE_INT32, GxB_ISLE_INT32,
GxB_ISGT_INT64, GxB_ISLT_INT64, GxB_ISGE_INT64, GxB_ISLE_INT64,
GxB_ISGT_UINT8, GxB_ISLT_UINT8, GxB_ISGE_UINT8, GxB_ISLE_UINT8,
GxB_ISGT_UINT16, GxB_ISLT_UINT16, GxB_ISGE_UINT16, GxB_ISLE_UINT16,
GxB_ISGT_UINT32, GxB_ISLT_UINT32, GxB_ISGE_UINT32, GxB_ISLE_UINT32,
GxB_ISGT_UINT64, GxB_ISLT_UINT64, GxB_ISGE_UINT64, GxB_ISLE_UINT64,
GxB_ISGT_FP32, GxB_ISLT_FP32, GxB_ISGE_FP32, GxB_ISLE_FP32,
GxB_ISGT_FP64, GxB_ISLT_FP64, GxB_ISGE_FP64, GxB_ISLE_FP64,
// z = min(x,y) z = max (x,y)
GrB_MIN_BOOL, GrB_MAX_BOOL,
GrB_MIN_INT8, GrB_MAX_INT8,
GrB_MIN_INT16, GrB_MAX_INT16,
GrB_MIN_INT32, GrB_MAX_INT32,
GrB_MIN_INT64, GrB_MAX_INT64,
GrB_MIN_UINT8, GrB_MAX_UINT8,
GrB_MIN_UINT16, GrB_MAX_UINT16,
GrB_MIN_UINT32, GrB_MAX_UINT32,
GrB_MIN_UINT64, GrB_MAX_UINT64,
GrB_MIN_FP32, GrB_MAX_FP32,
GrB_MIN_FP64, GrB_MAX_FP64,
// Binary operators for each of the 11 real types:
// The operators convert non-boolean types internally to boolean and return
// a value 1 or 0 in the same type, for true or false. Each computes z =
// ((x != 0) OP (y != 0)), where x, y, and z all the same type. These
// operators are useful as multiplicative operators when combined with
// non-boolean monoids of the same type.
// z = (x || y) z = (x && y) z = (x != y)
GxB_LOR_BOOL, GxB_LAND_BOOL, GxB_LXOR_BOOL,
GxB_LOR_INT8, GxB_LAND_INT8, GxB_LXOR_INT8,
GxB_LOR_INT16, GxB_LAND_INT16, GxB_LXOR_INT16,
GxB_LOR_INT32, GxB_LAND_INT32, GxB_LXOR_INT32,
GxB_LOR_INT64, GxB_LAND_INT64, GxB_LXOR_INT64,
GxB_LOR_UINT8, GxB_LAND_UINT8, GxB_LXOR_UINT8,
GxB_LOR_UINT16, GxB_LAND_UINT16, GxB_LXOR_UINT16,
GxB_LOR_UINT32, GxB_LAND_UINT32, GxB_LXOR_UINT32,
GxB_LOR_UINT64, GxB_LAND_UINT64, GxB_LXOR_UINT64,
GxB_LOR_FP32, GxB_LAND_FP32, GxB_LXOR_FP32,
GxB_LOR_FP64, GxB_LAND_FP64, GxB_LXOR_FP64,
// Binary operators that operate only on boolean types: LOR, LAND, LXOR,
// and LXNOR. The naming convention differs (_BOOL is not appended to the
// name). They are the same as GxB_LOR_BOOL, GxB_LAND_BOOL, and
// GxB_LXOR_BOOL, and GrB_EQ_BOOL, respectively.
// z = (x || y) z = (x && y) z = (x != y) z = (x == y)
GrB_LOR, GrB_LAND, GrB_LXOR, GrB_LXNOR,
// Operators for floating-point reals:
// z = atan2(x,y) z = hypot(x,y) z = fmod(x,y) z = remainder(x,y)
GxB_ATAN2_FP32, GxB_HYPOT_FP32, GxB_FMOD_FP32, GxB_REMAINDER_FP32,
GxB_ATAN2_FP64, GxB_HYPOT_FP64, GxB_FMOD_FP64, GxB_REMAINDER_FP64,
// z = ldexp(x,y) z = copysign (x,y)
GxB_LDEXP_FP32, GxB_COPYSIGN_FP32,
GxB_LDEXP_FP64, GxB_COPYSIGN_FP64,
// Bitwise operations on signed and unsigned integers: note that
// bitwise operations on signed integers can lead to different results,
// depending on your compiler; results are implementation-defined.
// z = (x | y) z = (x & y) z = (x ^ y) z = ~(x ^ y)
GrB_BOR_INT8, GrB_BAND_INT8, GrB_BXOR_INT8, GrB_BXNOR_INT8,
GrB_BOR_INT16, GrB_BAND_INT16, GrB_BXOR_INT16, GrB_BXNOR_INT16,
GrB_BOR_INT32, GrB_BAND_INT32, GrB_BXOR_INT32, GrB_BXNOR_INT32,
GrB_BOR_INT64, GrB_BAND_INT64, GrB_BXOR_INT64, GrB_BXNOR_INT64,
GrB_BOR_UINT8, GrB_BAND_UINT8, GrB_BXOR_UINT8, GrB_BXNOR_UINT8,
GrB_BOR_UINT16, GrB_BAND_UINT16, GrB_BXOR_UINT16, GrB_BXNOR_UINT16,
GrB_BOR_UINT32, GrB_BAND_UINT32, GrB_BXOR_UINT32, GrB_BXNOR_UINT32,
GrB_BOR_UINT64, GrB_BAND_UINT64, GrB_BXOR_UINT64, GrB_BXNOR_UINT64,
// z = bitget(x,y) z = bitset(x,y) z = bitclr(x,y)
GxB_BGET_INT8, GxB_BSET_INT8, GxB_BCLR_INT8,
GxB_BGET_INT16, GxB_BSET_INT16, GxB_BCLR_INT16,
GxB_BGET_INT32, GxB_BSET_INT32, GxB_BCLR_INT32,
GxB_BGET_INT64, GxB_BSET_INT64, GxB_BCLR_INT64,
GxB_BGET_UINT8, GxB_BSET_UINT8, GxB_BCLR_UINT8,
GxB_BGET_UINT16, GxB_BSET_UINT16, GxB_BCLR_UINT16,
GxB_BGET_UINT32, GxB_BSET_UINT32, GxB_BCLR_UINT32,
GxB_BGET_UINT64, GxB_BSET_UINT64, GxB_BCLR_UINT64 ;
//------------------------------------------------------------------------------
// z=f(x,y) where z and x have the same type, but y is GrB_INT8
//------------------------------------------------------------------------------
// z = bitshift (x,y) computes z = x left-shifted by y bits if y >= 0, or z
// = x right-shifted by (-y) bits if y < 0. z is equal to x if y is zero.
// z and x have the same type, as given by the suffix on the operator name.
// Since y must be signed, it cannot have the same type as x when x is
// unsigned; it is always GrB_INT8 for all 8 versions of this operator.
// The GxB_BSHIFT_* operators compute the arithmetic shift, and produce the
// same results as the bitshift.m function, for all possible inputs.
GB_PUBLIC GrB_BinaryOp
// z = bitshift(x,y)
GxB_BSHIFT_INT8,
GxB_BSHIFT_INT16,
GxB_BSHIFT_INT32,
GxB_BSHIFT_INT64,
GxB_BSHIFT_UINT8,
GxB_BSHIFT_UINT16,
GxB_BSHIFT_UINT32,
GxB_BSHIFT_UINT64 ;
//------------------------------------------------------------------------------
// z=f(x,y) where z is BOOL and the type of x,y is given by the suffix
//------------------------------------------------------------------------------
GB_PUBLIC GrB_BinaryOp
// Six comparators z=f(x,y) return their result as boolean, but
// where x and y have the same type. The suffix in their names refers to
// the type of x and y since z is always boolean. If used as multiply
// operators in a semiring, they can only be combined with boolean monoids.
// The _BOOL versions of these operators give the same results as their
// IS*_BOOL counterparts. GrB_EQ_BOOL and GrB_LXNOR are identical.
// z = (x == y) z = (x != y) z = (x > y) z = (x < y)
GrB_EQ_BOOL, GrB_NE_BOOL, GrB_GT_BOOL, GrB_LT_BOOL,
GrB_EQ_INT8, GrB_NE_INT8, GrB_GT_INT8, GrB_LT_INT8,
GrB_EQ_INT16, GrB_NE_INT16, GrB_GT_INT16, GrB_LT_INT16,
GrB_EQ_INT32, GrB_NE_INT32, GrB_GT_INT32, GrB_LT_INT32,
GrB_EQ_INT64, GrB_NE_INT64, GrB_GT_INT64, GrB_LT_INT64,
GrB_EQ_UINT8, GrB_NE_UINT8, GrB_GT_UINT8, GrB_LT_UINT8,
GrB_EQ_UINT16, GrB_NE_UINT16, GrB_GT_UINT16, GrB_LT_UINT16,
GrB_EQ_UINT32, GrB_NE_UINT32, GrB_GT_UINT32, GrB_LT_UINT32,
GrB_EQ_UINT64, GrB_NE_UINT64, GrB_GT_UINT64, GrB_LT_UINT64,
GrB_EQ_FP32, GrB_NE_FP32, GrB_GT_FP32, GrB_LT_FP32,
GrB_EQ_FP64, GrB_NE_FP64, GrB_GT_FP64, GrB_LT_FP64,
// complex:
GxB_EQ_FC32, GxB_NE_FC32,
GxB_EQ_FC64, GxB_NE_FC64,
// z = (x >= y) z = (x <= y)
GrB_GE_BOOL, GrB_LE_BOOL,
GrB_GE_INT8, GrB_LE_INT8,
GrB_GE_INT16, GrB_LE_INT16,
GrB_GE_INT32, GrB_LE_INT32,
GrB_GE_INT64, GrB_LE_INT64,
GrB_GE_UINT8, GrB_LE_UINT8,
GrB_GE_UINT16, GrB_LE_UINT16,
GrB_GE_UINT32, GrB_LE_UINT32,
GrB_GE_UINT64, GrB_LE_UINT64,
GrB_GE_FP32, GrB_LE_FP32,
GrB_GE_FP64, GrB_LE_FP64 ;
//------------------------------------------------------------------------------
// z=f(x,y) where z is complex and the type of x,y is given by the suffix
//------------------------------------------------------------------------------
GB_PUBLIC GrB_BinaryOp
// z = cmplx (x,y)
GxB_CMPLX_FP32,
GxB_CMPLX_FP64 ;
//==============================================================================
// positional GrB_UnaryOp and GrB_BinaryOp operators
//==============================================================================
// Positional operators do not depend on the value of an entry, but its row or
// column index in the matrix instead. For example, for an entry A(i,j),
// first_i(A(i,j),y) is equal to i. These operators are useful for returning
// node id's as the result of a semiring operation. If used as a mask, zero
// has a special value, and thus z=first_i1(A(i,j),j) returns i+1 instead of i.
// This can be useful when using a positional operator to construct a mask
// matrix or vector for another GraphBLAS operation. It is also essential for
// the @GrB interface, since the user view of matrix indices in @GrB is
// 1-based, not 0-based.
// When applied to a vector, j is always equal to 0. For a GxB_SCALAR,
// both i and j are always zero.
// GraphBLAS defines a GrB_Index as uint64_t, but these operators return a
// GrB_INT32 or GrB_INT64 type, which is more flexible to use because the
// result of this operator can be negated, to flag an entry for example. The
// value -1 can be used to denote "no node" or "no position". GrB_INT32 is
// useful for graphs smaller than 2^31 nodes. If the row or column index
// exceeds INT32_MAX, the result is determined by the typecast from the
// 64-bit index to the smaller 32-bit index.
// Positional operators cannot be used to construct monoids. They can be used
// as multiplicative operators in semirings, and as operators for GrB_eWise*,
// and GrB_apply (bind first or second). For the latter, the operator cannot
// depend on the bound scalar.
// When used as multiplicative operators in a semiring, FIRSTJ and SECONDI
// are identical. If C(i,j) += t is computed where t = A(i,k)*B(k,j), then
// t = k in both cases. Likewise, FIRSTJ1 and SECONDI1 are identical.
GB_PUBLIC GrB_BinaryOp
GxB_FIRSTI_INT32, GxB_FIRSTI_INT64, // z = first_i(A(i,j),y) == i
GxB_FIRSTI1_INT32, GxB_FIRSTI1_INT64, // z = first_i1(A(i,j),y) == i+1
GxB_FIRSTJ_INT32, GxB_FIRSTJ_INT64, // z = first_j(A(i,j),y) == j
GxB_FIRSTJ1_INT32, GxB_FIRSTJ1_INT64, // z = first_j1(A(i,j),y) == j+1
GxB_SECONDI_INT32, GxB_SECONDI_INT64, // z = second_i(x,B(i,j)) == i
GxB_SECONDI1_INT32, GxB_SECONDI1_INT64, // z = second_i1(x,B(i,j)) == i+1
GxB_SECONDJ_INT32, GxB_SECONDJ_INT64, // z = second_j(x,B(i,j)) == j
GxB_SECONDJ1_INT32, GxB_SECONDJ1_INT64 ; // z = second_j1(x,B(i,j)) == j+1
GB_PUBLIC GrB_UnaryOp
GxB_POSITIONI_INT32, GxB_POSITIONI_INT64, // z=position_i(A(i,j)) == i
GxB_POSITIONI1_INT32, GxB_POSITIONI1_INT64, // z=position_i1(A(i,j)) == i+1
GxB_POSITIONJ_INT32, GxB_POSITIONJ_INT64, // z=position_j(A(i,j)) == j
GxB_POSITIONJ1_INT32, GxB_POSITIONJ1_INT64 ;// z=position_j1(A(i,j)) == j+1
//==============================================================================
// special GrB_BinaryOp for build methods only
//==============================================================================
// In GrB*build* methods, passing dup as NULL means that no duplicates are
// tolerated. If duplicates appear, an error is returned. If dup is a binary
// operator, it is applied to reduce duplicates to a single value. The
// GxB_IGNORE_DUP is a special case. It is not an operator, but an indication
// that any duplicates are to be ignored.
GB_PUBLIC GrB_BinaryOp GxB_IGNORE_DUP ;
//==============================================================================
// About boolean and bitwise binary operators
//==============================================================================
// Some of the boolean operators compute the same thing with different names.
// For example, x*y and x&&y give the same results for boolean x and y.
// Operations such as x < y when x and y are boolean are treated as if true=1
// and false=0. Below is the truth table for all binary operators with boolean
// inputs. This table is defined by how C typecasts boolean values for
// non-boolean operations. For example, if x, y, and z are boolean, x = true,
// and y = true, then z = x + y = true + true = true. DIV (x/y) is defined
// below. RDIV (y/x) is shown as \ in the table; it is the same as 2nd.
// x y 1st 2nd min max + - * / or and xor eq ne > < ge le \ pow pair
// 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 1 1
// 0 1 0 1 0 1 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1
// 1 0 1 0 0 1 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1
// 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1
// GraphBLAS includes a GrB_DIV_BOOL operator in its specification, but does
// not define what boolean "division" means. SuiteSparse:GraphBLAS makes the
// following interpretation.
// GraphBLAS does not generate exceptions for divide-by-zero. Floating-point
// divide-by-zero follows the IEEE 754 standard: 1/0 is +Inf, -1/0 is -Inf, and
// 0/0 is NaN. For integer division by zero, if x is positive, x/0 is the
// largest integer, -x/0 is the integer minimum (zero for unsigned integers),
// and 0/0 is zero. For example, for int8, 1/0 is 127, and -1/0 is -128. For
// uint8, 1/0 is 255 and 0/0 is zero.
// Boolean division is treated as if it were an unsigned integer type with
// true=1 and false=0, and with the max and min value being 1 and 0. As a
// result, GrB_IDENTITY_BOOL, GrB_AINV_BOOL, and GrB_MINV_BOOL all give the
// same result (z = x).
// With this convention for boolean "division", there are 11 unique binary
// operators that are purely boolean. Other named *_BOOL operators are
// redundant but are included in GraphBLAS so that the name space of operators
// is complete. Below is a list of all operators and their equivalents.
// x: 0 0 1 1
// y: 0 1 0 1
// z: see below
//
// z = 0 0 0 0 0 (zero function, not predefined)
// z = (x && y) 0 0 0 1 AND, MIN, TIMES
// z = (x > y) 0 0 1 0 GT, ISGT, and set diff (x\y)
// z = x 0 0 1 1 FIRST, DIV
//
// z = (x < y) 0 1 0 0 LT, ISLT, and set diff (y\x)
// z = y 0 1 0 1 SECOND, RDIV
// z = (x != y) 0 1 1 0 XOR, MINUS, RMINUS, NE, ISNE
// z = (x || y) 0 1 1 1 OR, MAX, PLUS
//
// z = ~(x || y) 1 0 0 0 (nor(x,y) function, not predefined)
// z = (x == y) 1 0 0 1 LXNOR, EQ, ISEQ
// z = ~y 1 0 1 0 (not(y), not predefined)
// z = (x >= y) 1 0 1 1 GE, ISGE, POW, and "x implies y"
//
// z = ~x 1 1 0 0 (not(x), not predefined)
// z = (x <= y) 1 1 0 1 LE, ISLE, and "y implies x"
// z = ~(x && y) 1 1 1 0 (nand(x,y) function, not predefined)
// z = 1 1 1 1 1 PAIR, ONEB
//
// z = any(x,y) 0 . . 1 ANY (pick x or y arbitrarily)
// Four more that have no _BOOL suffix are also redundant with the operators
// of the form GxB_*_BOOL (GrB_LOR, GrB_LAND, GrB_LXOR, and GrB_LXNOR).
// Note that the boolean binary operator space is not complete. Five other
// boolean functions could be pre-defined as well: z = 0, nor(x,y),
// nand(x,y), not(x), and not(y).
// Four of the possible 16 bitwise operators are pre-defined: BOR, BAND,
// BXOR, and BXNOR. This assumes that the computations for each bit are
// entirely independent (so BSHIFT would not fit in the table above).
//------------------------------------------------------------------------------
// methods for binary operators
//------------------------------------------------------------------------------
typedef void (*GxB_binary_function) (void *, const void *, const void *) ;
// GrB_BinaryOp_new creates a user-defined binary op, with an automatic
// detection of the operator name.
#undef GrB_BinaryOp_new
#undef GrM_BinaryOp_new
GB_PUBLIC
GrB_Info GRB (BinaryOp_new)
(
GrB_BinaryOp *binaryop, // handle for the new binary operator
GxB_binary_function function, // pointer to the binary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x
GrB_Type ytype // type of input y
) ;
#define GrB_BinaryOp_new(op,f,z,x,y) \
GxB_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL)
#define GrM_BinaryOp_new(op,f,z,x,y) \
GxM_BinaryOp_new(op,f,z,x,y, GB_STR(f), NULL)
// GxB_BinaryOp_new creates a named user-defined binary op.
GB_PUBLIC
GrB_Info GxB_BinaryOp_new
(
GrB_BinaryOp *op, // handle for the new binary operator
GxB_binary_function function, // pointer to the binary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x
GrB_Type ytype, // type of input y
const char *binop_name, // name of the user function
const char *binop_defn // definition of the user function
) ;
// GB_BinaryOp_new is historical: use GxB_BinaryOp_new instead
GB_PUBLIC
GrB_Info GB_BinaryOp_new // not user-callable
(
GrB_BinaryOp *binaryop, // handle for the new binary operator
GxB_binary_function function, // pointer to the binary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x
GrB_Type ytype, // type of input y
const char *binop_name // name of the user function
) ;
// NOTE: GxB_BinaryOp_ztype is historical. Use GxB_BinaryOp_ztype_name instead.
GB_PUBLIC
GrB_Info GxB_BinaryOp_ztype // return the type of z
(
GrB_Type *ztype, // return type of output z
GrB_BinaryOp binaryop // binary operator to query
) ;
GB_PUBLIC
GrB_Info GxB_BinaryOp_ztype_name // return the type_name of z
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_BinaryOp binaryop // binary operator to query
) ;
// NOTE: GxB_BinaryOp_xtype is historical. Use GxB_BinaryOp_xtype_name instead.
GB_PUBLIC
GrB_Info GxB_BinaryOp_xtype // return the type of x
(
GrB_Type *xtype, // return type of input x
GrB_BinaryOp binaryop // binary operator to query
) ;
GB_PUBLIC
GrB_Info GxB_BinaryOp_xtype_name // return the type_name of x
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_BinaryOp binaryop // binary operator to query
) ;
// NOTE: GxB_BinaryOp_ytype is historical. Use GxB_BinaryOp_ytype_name instead.
GB_PUBLIC
GrB_Info GxB_BinaryOp_ytype // return the type of y
(
GrB_Type *ytype, // return type of input y
GrB_BinaryOp binaryop // binary operator to query
) ;
GB_PUBLIC
GrB_Info GxB_BinaryOp_ytype_name // return the type_name of y
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_BinaryOp binaryop // binary operator to query
) ;
GB_PUBLIC
GrB_Info GrB_BinaryOp_free // free a user-created binary operator
(
GrB_BinaryOp *binaryop // handle of binary operator to free
) ;
//==============================================================================
// GxB_SelectOp: select operators (historical)
//==============================================================================
// GrB_IndexUnaryOp should be used instead of GxB_SelectOp.
// GxB_SelectOp is an operator used by GxB_select to select entries from an
// input matrix A that are kept in the output C. If an entry A(i,j) in the
// matrix A, of size nrows-by-ncols, has the value aij, then it calls the
// select function as result = f (i, j, aij, thunk). If the function returns
// true, the entry is kept in the output C. If f returns false, the entry is
// not kept in C. The type of x for the GxB_SelectOp operator may be any of
// the 11 built-in types, or any user-defined type. It may also be GrB_NULL,
// to indicate that the function is type-generic and does not depend at all on
// the value aij. In this case, x is passed to f as a NULL pointer.
// The optional Thunk parameter to GxB_select is a GrB_Scalar. For built-in
// select operators (TRIL, TRIU, DIAG, and OFFDIAG), Thunk must have any
// built-in type, and thunk = (int64_t) Thunk is used to specify the diagonal
// for these operators. Thunk may be NULL, in which case its value is treated
// as zero, if it has a built-in type. The value of Thunk (if present) is not
// modified by any built-in select operator.
// For user-defined select operators, Thunk is not typecasted at all. If
// the user operator is defined with a non-NULL Thunk input, then it must
// be non-NULL and of the same type, when calling GxB_select.
// GxB_SelectOp: a function z=f(i,j,x,thunk) for the GxB_Select operation.
// The function f must have the signature:
// bool f (GrB_Index i, GrB_Index j, const void *x, const void *thunk) ;
// The values of i and j are guaranteed to be in the range 0 to
// GrB_INDEX_MAX, and they can be safely typecasted to int64_t then negated,
// if desired, without any risk of integer overflow.
typedef struct GB_SelectOp_opaque *GxB_SelectOp ;
//------------------------------------------------------------------------------
// built-in select operators (historical)
//------------------------------------------------------------------------------
// GxB_select (C, Mask, accum, op, A, Thunk, desc) always returns a matrix C of
// the same size as A (or A' if GrB_TRAN is in the descriptor).
GB_PUBLIC GxB_SelectOp
GxB_TRIL, // C=tril(A,thunk): returns true if ((j-i) <= thunk)
GxB_TRIU, // C=triu(A,thunk): returns true if ((j-i) >= thunk)
GxB_DIAG, // C=diag(A,thunk): returns true if ((j-i) == thunk)
GxB_OFFDIAG, // C=A-diag(A,thunk): returns true if ((j-i) != thunk)
GxB_NONZERO, // C=A(A ~= 0)
GxB_EQ_ZERO, // C=A(A == 0)
GxB_GT_ZERO, // C=A(A > 0)
GxB_GE_ZERO, // C=A(A >= 0)
GxB_LT_ZERO, // C=A(A < 0)
GxB_LE_ZERO, // C=A(A <= 0)
GxB_NE_THUNK, // C=A(A ~= thunk)
GxB_EQ_THUNK, // C=A(A == thunk)
GxB_GT_THUNK, // C=A(A > thunk)
GxB_GE_THUNK, // C=A(A >= thunk)
GxB_LT_THUNK, // C=A(A < thunk)
GxB_LE_THUNK ; // C=A(A <= thunk)
// For GxB_TRIL, GxB_TRIU, GxB_DIAG, and GxB_OFFDIAG, the parameter Thunk is a
// GrB_Scalar of any built-in type. If GrB_NULL, or empty, Thunk is treated as
// zero. Otherwise, the single entry is typecasted as (int64_t) Thunk.
// These select operators do not depend on the values of A, but just their
// position, and they work on matrices of any type.
// For GxB_*ZERO, the result depends only on the value of A(i,j). The Thunk
// parameter to GxB_select is ignored and may be GrB_NULL.
// The operators GxB_TRIL, GxB_TRIU, GxB_DIAG, GxB_OFFDIAG, GxB_NONZERO,
// GxB_EQ_ZERO, GxB_NE_THUNK, and GxB_EQ_THUNK work on all built-in types and
// all user-defined types.
// GxB_GT_*, GxB_GE_*, GxB_LT_*, and GxB_LE_* only work on the 11 built-in
// types (not complex). They cannot be used for user-defined types.
//------------------------------------------------------------------------------
// select operators: (historical)
//------------------------------------------------------------------------------
// User-defined GxB_SelectOps are historical. New code should use
// GrB_IndexUnaryOp_new instead.
typedef bool (*GxB_select_function) // return true if A(i,j) is kept
(
GrB_Index i, // row index of A(i,j)
GrB_Index j, // column index of A(i,j)
const void *x, // value of A(i,j)
const void *thunk // optional input for select function
) ;
#undef GxB_SelectOp_new
#undef GxM_SelectOp_new
GB_PUBLIC
GrB_Info GXB (SelectOp_new) // create a new user-defined select operator
(
GxB_SelectOp *selectop, // handle for the new select operator
GxB_select_function function,// pointer to the select function
GrB_Type xtype, // type of input x, or NULL if type-generic
GrB_Type ttype // type of thunk, or NULL if not used
) ;
#define GxB_SelectOp_new(op,f,x,t) GB_SelectOp_new (op,f,x,t, GB_STR(f))
#define GxM_SelectOp_new(op,f,x,t) GM_SelectOp_new (op,f,x,t, GB_STR(f))
// GB_SelectOp_new should not be called directly, but only through the
// GxB_SelectOp_new macro (but use GrB_IndexUnaryOp_new instead).
GB_PUBLIC
GrB_Info GB_SelectOp_new // not user-callable
(
GxB_SelectOp *selectop, // handle for the new select operator
GxB_select_function function,// pointer to the select function
GrB_Type xtype, // type of input x
GrB_Type ttype, // type of thunk, or NULL if not used
const char *name // name of the underlying function
) ;
// GxB_SelectOp_xtype is historical. Use a GrB_IndexUnaryOp instead.
GB_PUBLIC
GrB_Info GxB_SelectOp_xtype // return the type of x
(
GrB_Type *xtype, // return type of input x
GxB_SelectOp selectop // select operator
) ;
// GxB_SelectOp_ttype is historical. Use a GrB_IndexUnaryOp instead.
GB_PUBLIC
GrB_Info GxB_SelectOp_ttype // return the type of thunk
(
GrB_Type *ttype, // return type of input thunk
GxB_SelectOp selectop // select operator
) ;
GB_PUBLIC
GrB_Info GxB_SelectOp_free // free a user-created select operator
(
GxB_SelectOp *selectop // handle of select operator to free
) ;
//==============================================================================
// GrB_IndexUnaryOp: a unary operator that depends on the row/col indices
//==============================================================================
// The indexop has the form z = f(aij, i, j, y) where aij is the numerical
// value of the A(i,j) entry, i and j are its row and column index, and y
// is a scalar. For vectors, it has the form z = f(vi, i, 0, y).
typedef struct GB_IndexUnaryOp_opaque *GrB_IndexUnaryOp ;
typedef void (*GxB_index_unary_function)
(
void *z, // output value z, of type ztype
const void *x, // input value x of type xtype; value of v(i) or A(i,j)
GrB_Index i, // row index of A(i,j)
GrB_Index j, // column index of A(i,j), or zero for v(i)
const void *y // input scalar y
) ;
// GrB_IndexUnaryOp_new creates a user-defined unary op, with an automatic
// detection of the operator name.
#undef GrB_IndexUnaryOp_new
#undef GrM_IndexUnaryOp_new
GB_PUBLIC
GrB_Info GRB (IndexUnaryOp_new) // create a new user-defined IndexUnary op
(
GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator
GxB_index_unary_function function, // pointer to IndexUnary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x (the A(i,j) entry)
GrB_Type ytype // type of input y (the scalar)
) ;
#define GrB_IndexUnaryOp_new(op,f,z,x,y) \
GxB_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL)
#define GrM_IndexUnaryOp_new(op,f,z,x,y) \
GxM_IndexUnaryOp_new(op,f,z,x,y, GB_STR(f), NULL)
GB_PUBLIC
GrB_Info GxB_IndexUnaryOp_new // create a named user-created IndexUnaryOp
(
GrB_IndexUnaryOp *op, // handle for the new IndexUnary operator
GxB_index_unary_function function, // pointer to index_unary function
GrB_Type ztype, // type of output z
GrB_Type xtype, // type of input x (the A(i,j) entry)
GrB_Type ytype, // type of input y (the scalar)
const char *idxop_name, // name of the user function
const char *idxop_defn // definition of the user function
) ;
GB_PUBLIC
GrB_Info GxB_IndexUnaryOp_ztype_name // return the type_name of z
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_IndexUnaryOp op // IndexUnary operator
) ;
// For TRIL, TRIU, DIAG, OFFDIAG, COLLE, COLGT, ROWLE, and ROWGT,
// the xtype_name is an empty string (""), since these functions do not depend
// on the type of the matrix input.
GB_PUBLIC
GrB_Info GxB_IndexUnaryOp_xtype_name // return the type_name of x
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_IndexUnaryOp op // select operator
) ;
GB_PUBLIC
GrB_Info GxB_IndexUnaryOp_ytype_name // return the type_name of the scalary y
(
char *type_name, // user array of size GxB_MAX_NAME_LEN
const GrB_IndexUnaryOp op // select operator
) ;
GB_PUBLIC
GrB_Info GrB_IndexUnaryOp_free // free a user-created IndexUnaryOp
(
GrB_IndexUnaryOp *op // handle of IndexUnary to free
) ;
//------------------------------------------------------------------------------
// built-in IndexUnaryOps
//------------------------------------------------------------------------------
// To facilitate computations with negative integers, the indices i and j are
// of type int64_t. The scalar y has the type corresponding to the suffix
// of the name of the operator.
GB_PUBLIC GrB_IndexUnaryOp
//--------------------------------------------------------------------------
// Result has the integer type INT32 or INT64, the same as the suffix
//--------------------------------------------------------------------------
// These operators work on any data type, including user-defined.
// ROWINDEX: (i+y): row index plus y
GrB_ROWINDEX_INT32, GrB_ROWINDEX_INT64,
// COLINDEX: (j+y): col index plus y
GrB_COLINDEX_INT32, GrB_COLINDEX_INT64,
// DIAGINDEX: (j-(i+y)): diagonal index plus y
GrB_DIAGINDEX_INT32, GrB_DIAGINDEX_INT64,
//--------------------------------------------------------------------------
// Result is bool, depending only on the indices i,j, and y
//--------------------------------------------------------------------------
// These operators work on any data type, including user-defined.
// The scalar y is int64.
// TRIL: (j <= (i+y)): lower triangular part
GrB_TRIL,
// TRIU: (j >= (i+y)): upper triangular part
GrB_TRIU,
// DIAG: (j == (i+y)): diagonal
GrB_DIAG,
// OFFDIAG: (j != (i+y)): offdiagonal
GrB_OFFDIAG,
// COLLE: (j <= y): columns 0:y
GrB_COLLE,
// COLGT: (j > y): columns y+1:ncols-1
GrB_COLGT,
// ROWLE: (i <= y): rows 0:y
GrB_ROWLE,
// ROWGT: (i > y): rows y+1:nrows-1
GrB_ROWGT,
//--------------------------------------------------------------------------
// Result is bool, depending only on the value aij
//--------------------------------------------------------------------------
// These operators work on matrices and vectors of any built-in type,
// including complex types. aij and the scalar y have the same type as the
// operator suffix.
// VALUEEQ: (aij == y)
GrB_VALUEEQ_INT8, GrB_VALUEEQ_UINT8, GrB_VALUEEQ_FP32, GrB_VALUEEQ_BOOL,
GrB_VALUEEQ_INT16, GrB_VALUEEQ_UINT16, GrB_VALUEEQ_FP64,
GrB_VALUEEQ_INT32, GrB_VALUEEQ_UINT32, GxB_VALUEEQ_FC32,
GrB_VALUEEQ_INT64, GrB_VALUEEQ_UINT64, GxB_VALUEEQ_FC64,
// VALUENE: (aij != y)
GrB_VALUENE_INT8, GrB_VALUENE_UINT8, GrB_VALUENE_FP32, GrB_VALUENE_BOOL,
GrB_VALUENE_INT16, GrB_VALUENE_UINT16, GrB_VALUENE_FP64,
GrB_VALUENE_INT32, GrB_VALUENE_UINT32, GxB_VALUENE_FC32,
GrB_VALUENE_INT64, GrB_VALUENE_UINT64, GxB_VALUENE_FC64,
// These operators work on matrices and vectors of any real (non-complex)
// built-in type.
// VALUELT: (aij < y)
GrB_VALUELT_INT8, GrB_VALUELT_UINT8, GrB_VALUELT_FP32, GrB_VALUELT_BOOL,
GrB_VALUELT_INT16, GrB_VALUELT_UINT16, GrB_VALUELT_FP64,
GrB_VALUELT_INT32, GrB_VALUELT_UINT32,
GrB_VALUELT_INT64, GrB_VALUELT_UINT64,
// VALUELE: (aij <= y)
GrB_VALUELE_INT8, GrB_VALUELE_UINT8, GrB_VALUELE_FP32, GrB_VALUELE_BOOL,
GrB_VALUELE_INT16, GrB_VALUELE_UINT16, GrB_VALUELE_FP64,
GrB_VALUELE_INT32, GrB_VALUELE_UINT32,
GrB_VALUELE_INT64, GrB_VALUELE_UINT64,
// VALUEGT: (aij > y)
GrB_VALUEGT_INT8, GrB_VALUEGT_UINT8, GrB_VALUEGT_FP32, GrB_VALUEGT_BOOL,
GrB_VALUEGT_INT16, GrB_VALUEGT_UINT16, GrB_VALUEGT_FP64,
GrB_VALUEGT_INT32, GrB_VALUEGT_UINT32,
GrB_VALUEGT_INT64, GrB_VALUEGT_UINT64,
// VALUEGE: (aij >= y)
GrB_VALUEGE_INT8, GrB_VALUEGE_UINT8, GrB_VALUEGE_FP32, GrB_VALUEGE_BOOL,
GrB_VALUEGE_INT16, GrB_VALUEGE_UINT16, GrB_VALUEGE_FP64,
GrB_VALUEGE_INT32, GrB_VALUEGE_UINT32,
GrB_VALUEGE_INT64, GrB_VALUEGE_UINT64 ;
//==============================================================================
// GrB_Monoid
//==============================================================================
// A monoid is an associative operator z=op(x,y) where all three types of z, x,
// and y are identical. The monoid also has an identity element, such that
// op(x,identity) = op(identity,x) = x.
typedef struct GB_Monoid_opaque *GrB_Monoid ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_BOOL // create a new boolean monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
bool identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_INT8 // create a new int8 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int8_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_UINT8 // create a new uint8 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint8_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_INT16 // create a new int16 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int16_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_UINT16 // create a new uint16 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint16_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_INT32 // create a new int32 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int32_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_UINT32 // create a new uint32 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint32_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_INT64 // create a new int64 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int64_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_UINT64 // create a new uint64 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint64_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_FP32 // create a new float monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
float identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_FP64 // create a new double monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
double identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_new_FC32 // create a new float complex monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
GxB_FC32_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_new_FC64 // create a new double complex monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
GxB_FC64_t identity // identity value of the monoid
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_new_UDT // create a monoid with a user-defined type
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
void *identity // identity value of the monoid
) ;
// Type-generic method for creating a new monoid:
/*
GB_PUBLIC
GrB_Info GrB_Monoid_new // create a monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
<type> identity // identity value of the monoid
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Monoid_new(monoid,op,identity) \
_Generic \
( \
(identity), \
GB_CASES (, GrB, Monoid_new) \
) \
(monoid, op, identity)
#endif
// GxB_Monoid_terminal_new is identical to GrB_Monoid_new, except that a
// terminal value can be specified. The terminal may be NULL, which indicates
// no terminal value (and in this case, it is identical to GrB_Monoid_new).
// The terminal value, if not NULL, must have the same type as the identity.
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_BOOL // create a new boolean monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
bool identity, // identity value of the monoid
bool terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_INT8 // create a new int8 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int8_t identity, // identity value of the monoid
int8_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_UINT8 // create a new uint8 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint8_t identity, // identity value of the monoid
uint8_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_INT16 // create a new int16 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int16_t identity, // identity value of the monoid
int16_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_UINT16 // create a new uint16 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint16_t identity, // identity value of the monoid
uint16_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_INT32 // create a new int32 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int32_t identity, // identity value of the monoid
int32_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_UINT32 // create a new uint32 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint32_t identity, // identity value of the monoid
uint32_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_INT64 // create a new int64 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
int64_t identity, // identity value of the monoid
int64_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_UINT64 // create a new uint64 monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
uint64_t identity, // identity value of the monoid
uint64_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_FP32 // create a new float monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
float identity, // identity value of the monoid
float terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_FP64 // create a new double monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
double identity, // identity value of the monoid
double terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_FC32 // create a new float complex monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
GxB_FC32_t identity, // identity value of the monoid
GxB_FC32_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_FC64 // create a new double complex monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
GxB_FC64_t identity, // identity value of the monoid
GxB_FC64_t terminal // terminal value of the monoid
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new_UDT // create a monoid with a user type
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
void *identity, // identity value of the monoid
void *terminal // terminal value of the monoid
) ;
// Type-generic method for creating a new monoid with a terminal value:
/*
GB_PUBLIC
GrB_Info GxB_Monoid_terminal_new // create a monoid
(
GrB_Monoid *monoid, // handle of monoid to create
GrB_BinaryOp op, // binary operator of the monoid
<type> identity, // identity value of the monoid
<type> terminal // terminal value of the monoid
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GxB_Monoid_terminal_new(monoid,op,identity,terminal) \
_Generic \
( \
(identity), \
GB_CASES (, GxB, Monoid_terminal_new) \
) \
(monoid, op, identity, terminal)
#endif
GB_PUBLIC
GrB_Info GxB_Monoid_operator // return the monoid operator
(
GrB_BinaryOp *op, // returns the binary op of the monoid
GrB_Monoid monoid // monoid to query
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_identity // return the monoid identity
(
void *identity, // returns the identity of the monoid
GrB_Monoid monoid // monoid to query
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_terminal // return the monoid terminal
(
bool *has_terminal, // true if the monoid has a terminal value
void *terminal, // returns the terminal of the monoid,
// unmodified if has_terminal is false
GrB_Monoid monoid // monoid to query
) ;
GB_PUBLIC
GrB_Info GrB_Monoid_free // free a user-created monoid
(
GrB_Monoid *monoid // handle of monoid to free
) ;
//==============================================================================
// GrB_Semiring
//==============================================================================
typedef struct GB_Semiring_opaque *GrB_Semiring ;
GB_PUBLIC
GrB_Info GrB_Semiring_new // create a semiring
(
GrB_Semiring *semiring, // handle of semiring to create
GrB_Monoid add, // add monoid of the semiring
GrB_BinaryOp multiply // multiply operator of the semiring
) ;
GB_PUBLIC
GrB_Info GxB_Semiring_add // return the add monoid of a semiring
(
GrB_Monoid *add, // returns add monoid of the semiring
GrB_Semiring semiring // semiring to query
) ;
GB_PUBLIC
GrB_Info GxB_Semiring_multiply // return multiply operator of a semiring
(
GrB_BinaryOp *multiply, // returns multiply operator of the semiring
GrB_Semiring semiring // semiring to query
) ;
GB_PUBLIC
GrB_Info GrB_Semiring_free // free a user-created semiring
(
GrB_Semiring *semiring // handle of semiring to free
) ;
//==============================================================================
// GrB_Scalar: a GraphBLAS scalar
//==============================================================================
// GxB_Scalar has become GrB_Scalar. The older name GxB_Scalar is kept as
// historical, but GrB_Scalar should be used instead.
typedef struct GB_Scalar_opaque *GxB_Scalar ; // historical: use GrB_Scalar
typedef struct GB_Scalar_opaque *GrB_Scalar ; // use this instead
// These methods create, free, copy, and clear a GrB_Scalar. The nvals,
// and type methods return basic information about a GrB_Scalar.
GB_PUBLIC
GrB_Info GrB_Scalar_new // create a new GrB_Scalar with no entry
(
GrB_Scalar *s, // handle of GrB_Scalar to create
GrB_Type type // type of GrB_Scalar to create
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_dup // make an exact copy of a GrB_Scalar
(
GrB_Scalar *s, // handle of output GrB_Scalar to create
const GrB_Scalar t // input GrB_Scalar to copy
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_clear // clear a GrB_Scalar of its entry
( // type remains unchanged.
GrB_Scalar s // GrB_Scalar to clear
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_nvals // get the number of entries in a GrB_Scalar
(
GrB_Index *nvals, // GrB_Scalar has nvals entries (0 or 1)
const GrB_Scalar s // GrB_Scalar to query
) ;
// NOTE: GxB_Scalar_type is historical. Use GxB_Scalar_type_name instead.
GB_PUBLIC
GrB_Info GxB_Scalar_type // get the type of a GrB_Scalar
(
GrB_Type *type, // returns the type of the GrB_Scalar
const GrB_Scalar s // GrB_Scalar to query
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_type_name // return the name of the type of a scalar
(
char *type_name, // name of the type (char array of size at least
// GxB_MAX_NAME_LEN, owned by the user application).
const GrB_Scalar s // GrB_Scalar to query
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_memoryUsage // return # of bytes used for a scalar
(
size_t *size, // # of bytes used by the scalar s
const GrB_Scalar s // GrB_Scalar to query
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_free // free a GrB_Scalar
(
GrB_Scalar *s // handle of GrB_Scalar to free
) ;
// historical names identical to GrB_Scalar_methods above:
GB_PUBLIC GrB_Info GxB_Scalar_new (GrB_Scalar *s, GrB_Type type) ;
GB_PUBLIC GrB_Info GxB_Scalar_dup (GrB_Scalar *s, const GrB_Scalar t) ;
GB_PUBLIC GrB_Info GxB_Scalar_clear (GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_nvals (GrB_Index *nvals, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_free (GrB_Scalar *s) ;
//------------------------------------------------------------------------------
// GrB_Scalar_setElement
//------------------------------------------------------------------------------
// Set a single GrB_Scalar s, from a user scalar x: s = x, typecasting from the
// type of x to the type of w as needed.
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_BOOL // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
bool x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_INT8 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
int8_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_UINT8 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
uint8_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_INT16 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
int16_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_UINT16 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
uint16_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_INT32 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
int32_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_UINT32 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
uint32_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_INT64 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
int64_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_UINT64 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
uint64_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_FP32 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
float x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_FP64 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
double x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_setElement_FC32 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
GxB_FC32_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_setElement_FC64 // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
GxB_FC64_t x // user scalar to assign to s
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_setElement_UDT // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
void *x // user scalar to assign to s
) ;
// historical names identical to GrB_Scalar_methods above:
GB_PUBLIC GrB_Info GxB_Scalar_setElement_BOOL (GrB_Scalar s, bool x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_INT8 (GrB_Scalar s, int8_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_INT16 (GrB_Scalar s, int16_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_INT32 (GrB_Scalar s, int32_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_INT64 (GrB_Scalar s, int64_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_UINT8 (GrB_Scalar s, uint8_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_UINT16 (GrB_Scalar s, uint16_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_UINT32 (GrB_Scalar s, uint32_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_UINT64 (GrB_Scalar s, uint64_t x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_FP32 (GrB_Scalar s, float x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_FP64 (GrB_Scalar s, double x) ;
GB_PUBLIC GrB_Info GxB_Scalar_setElement_UDT (GrB_Scalar s, void *x) ;
// Type-generic version: x can be any supported C type or void * for a
// user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Scalar_setElement // s = x
(
GrB_Scalar s, // GrB_Scalar to modify
<type> x // user scalar to assign to s
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Scalar_setElement(s,x) \
_Generic \
( \
(x), \
GB_CASES (, GrB, Scalar_setElement) \
) \
(s, x)
#define GxB_Scalar_setElement(s,x) GrB_Scalar_setElement (s, x)
#endif
//------------------------------------------------------------------------------
// GrB_Scalar_extractElement
//------------------------------------------------------------------------------
// Extract a single entry from a GrB_Scalar, x = s, typecasting from the type
// of s to the type of x as needed.
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_BOOL // x = s
(
bool *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_INT8 // x = s
(
int8_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_UINT8 // x = s
(
uint8_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_INT16 // x = s
(
int16_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_UINT16 // x = s
(
uint16_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_INT32 // x = s
(
int32_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_UINT32 // x = s
(
uint32_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_INT64 // x = s
(
int64_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_UINT64 // x = s
(
uint64_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_FP32 // x = s
(
float *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_FP64 // x = s
(
double *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_extractElement_FC32 // x = s
(
GxB_FC32_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_extractElement_FC64 // x = s
(
GxB_FC64_t *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement_UDT // x = s
(
void *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
// historical names identical to GrB_Scalar_methods above:
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_BOOL (bool *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_INT8 (int8_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_INT16 (int16_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_INT32 (int32_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_INT64 (int64_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_UINT8 (uint8_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_UINT16 (uint16_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_UINT32 (uint32_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_UINT64 (uint64_t *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_FP32 (float *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_FP64 (double *x, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GxB_Scalar_extractElement_UDT (void *x, const GrB_Scalar s) ;
// Type-generic version: x can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Scalar_extractElement // x = s
(
<type> *x, // user scalar extracted
const GrB_Scalar s // GrB_Scalar to extract an entry from
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Scalar_extractElement(x,s) \
_Generic \
( \
(x), \
GB_CASES (*, GrB, Scalar_extractElement) \
) \
(x, s)
#define GxB_Scalar_extractElement(x,s) GrB_Scalar_extractElement (x, s)
#endif
//==============================================================================
// GrB_Vector: a GraphBLAS vector
//==============================================================================
typedef struct GB_Vector_opaque *GrB_Vector ;
// These methods create, free, copy, and clear a vector. The size, nvals,
// and type methods return basic information about a vector.
GB_PUBLIC
GrB_Info GrB_Vector_new // create a new vector with no entries
(
GrB_Vector *v, // handle of vector to create
GrB_Type type, // type of vector to create
GrB_Index n // vector dimension is n-by-1
// (n must be <= GrB_INDEX_MAX+1)
) ;
GB_PUBLIC
GrB_Info GrB_Vector_dup // make an exact copy of a vector
(
GrB_Vector *w, // handle of output vector to create
const GrB_Vector u // input vector to copy
) ;
GB_PUBLIC
GrB_Info GrB_Vector_clear // clear a vector of all entries;
( // type and dimension remain unchanged.
GrB_Vector v // vector to clear
) ;
GB_PUBLIC
GrB_Info GrB_Vector_size // get the dimension of a vector
(
GrB_Index *n, // vector dimension is n-by-1
const GrB_Vector v // vector to query
) ;
GB_PUBLIC
GrB_Info GrB_Vector_nvals // get the number of entries in a vector
(
GrB_Index *nvals, // vector has nvals entries
const GrB_Vector v // vector to query
) ;
// NOTE: GxB_Vector_type is historical. Use GxB_Vector_type_name instead.
GB_PUBLIC
GrB_Info GxB_Vector_type // get the type of a vector
(
GrB_Type *type, // returns the type of the vector
const GrB_Vector v // vector to query
) ;
GB_PUBLIC
GrB_Info GxB_Vector_type_name // return the name of the type of a vector
(
char *type_name, // name of the type (char array of size at least
// GxB_MAX_NAME_LEN, owned by the user application).
const GrB_Vector v // vector to query
) ;
GB_PUBLIC
GrB_Info GxB_Vector_memoryUsage // return # of bytes used for a vector
(
size_t *size, // # of bytes used by the vector v
const GrB_Vector v // vector to query
) ;
GB_PUBLIC
GrB_Info GxB_Vector_iso // return iso status of a vector
(
bool *iso, // true if the vector is iso-valued
const GrB_Vector v // vector to query
) ;
GB_PUBLIC
GrB_Info GrB_Vector_free // free a vector
(
GrB_Vector *v // handle of vector to free
) ;
//------------------------------------------------------------------------------
// GrB_Vector_build
//------------------------------------------------------------------------------
// GrB_Vector_build: w = sparse (I,1,X), but using any
// associative operator to assemble duplicate entries.
GB_PUBLIC
GrB_Info GrB_Vector_build_BOOL // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const bool *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_INT8 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const int8_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_UINT8 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const uint8_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_INT16 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const int16_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_UINT16 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const uint16_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_INT32 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const int32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_UINT32 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const uint32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_INT64 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const int64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_UINT64 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const uint64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_FP32 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const float *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_FP64 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const double *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Vector_build_FC32 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const GxB_FC32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Vector_build_FC64 // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const GxB_FC64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Vector_build_UDT // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const void *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Vector_build_Scalar // build a vector from (i,scalar) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
GrB_Scalar scalar, // value for all tuples
GrB_Index nvals // number of tuples
) ;
// Type-generic version: X can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Vector_build // build a vector from (I,X) tuples
(
GrB_Vector w, // vector to build
const GrB_Index *I, // array of row indices of tuples
const <type> *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Vector_build(w,I,X,nvals,dup) \
_Generic \
( \
(X), \
GB_CASES (*, GrB, Vector_build) \
) \
(w, I, ((const void *) (X)), nvals, dup)
#endif
//------------------------------------------------------------------------------
// GrB_Vector_setElement
//------------------------------------------------------------------------------
// Set a single scalar in a vector, w(i) = x, typecasting from the type of x to
// the type of w as needed.
GB_PUBLIC
GrB_Info GrB_Vector_setElement_BOOL // w(i) = x
(
GrB_Vector w, // vector to modify
bool x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_INT8 // w(i) = x
(
GrB_Vector w, // vector to modify
int8_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_UINT8 // w(i) = x
(
GrB_Vector w, // vector to modify
uint8_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_INT16 // w(i) = x
(
GrB_Vector w, // vector to modify
int16_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_UINT16 // w(i) = x
(
GrB_Vector w, // vector to modify
uint16_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_INT32 // w(i) = x
(
GrB_Vector w, // vector to modify
int32_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_UINT32 // w(i) = x
(
GrB_Vector w, // vector to modify
uint32_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_INT64 // w(i) = x
(
GrB_Vector w, // vector to modify
int64_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_UINT64 // w(i) = x
(
GrB_Vector w, // vector to modify
uint64_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_FP32 // w(i) = x
(
GrB_Vector w, // vector to modify
float x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_FP64 // w(i) = x
(
GrB_Vector w, // vector to modify
double x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GxB_Vector_setElement_FC32 // w(i) = x
(
GrB_Vector w, // vector to modify
GxB_FC32_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GxB_Vector_setElement_FC64 // w(i) = x
(
GrB_Vector w, // vector to modify
GxB_FC64_t x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_UDT // w(i) = x
(
GrB_Vector w, // vector to modify
void *x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_setElement_Scalar // w(i) = x
(
GrB_Vector w, // vector to modify
GrB_Scalar x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
// Type-generic version: x can be any supported C type or void * for a
// user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Vector_setElement // w(i) = x
(
GrB_Vector w, // vector to modify
<type> x, // scalar to assign to w(i)
GrB_Index i // row index
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Vector_setElement(w,x,i) \
_Generic \
( \
(x), \
GB_CASES (, GrB, Vector_setElement), \
default: GrB_Vector_setElement_Scalar \
) \
(w, x, i)
#endif
//------------------------------------------------------------------------------
// GrB_Vector_extractElement
//------------------------------------------------------------------------------
// Extract a single entry from a vector, x = v(i), typecasting from the type of
// v to the type of x as needed.
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_BOOL // x = v(i)
(
bool *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_INT8 // x = v(i)
(
int8_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_UINT8 // x = v(i)
(
uint8_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_INT16 // x = v(i)
(
int16_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_UINT16 // x = v(i)
(
uint16_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_INT32 // x = v(i)
(
int32_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_UINT32 // x = v(i)
(
uint32_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_INT64 // x = v(i)
(
int64_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_UINT64 // x = v(i)
(
uint64_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_FP32 // x = v(i)
(
float *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_FP64 // x = v(i)
(
double *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GxB_Vector_extractElement_FC32 // x = v(i)
(
GxB_FC32_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GxB_Vector_extractElement_FC64 // x = v(i)
(
GxB_FC64_t *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_UDT // x = v(i)
(
void *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractElement_Scalar // x = v(i)
(
GrB_Scalar x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
// Type-generic version: x can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Vector_extractElement // x = v(i)
(
<type> *x, // scalar extracted
const GrB_Vector v, // vector to extract an entry from
GrB_Index i // row index
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Vector_extractElement(x,v,i) \
_Generic \
( \
(x), \
GB_CASES (*, GrB, Vector_extractElement), \
default: GrB_Vector_extractElement_Scalar \
) \
(x, v, i)
#endif
// GxB_Vector_isStoredElement determines if v(i) is present in the structure
// of the vector v, as a stored element. It does not return the value. It
// returns GrB_SUCCESS if the element is present, or GrB_NO_VALUE otherwise.
GB_PUBLIC
GrB_Info GxB_Vector_isStoredElement // determine if v(i) is a stored element
(
const GrB_Vector v, // vector to check
GrB_Index i // row index
) ;
//------------------------------------------------------------------------------
// GrB_Vector_removeElement
//------------------------------------------------------------------------------
// GrB_Vector_removeElement (v,i) removes the element v(i) from the vector v.
GB_PUBLIC
GrB_Info GrB_Vector_removeElement
(
GrB_Vector v, // vector to remove an element from
GrB_Index i // index
) ;
//------------------------------------------------------------------------------
// GrB_Vector_extractTuples
//------------------------------------------------------------------------------
// Extracts all tuples from a vector, like [I,~,X] = find (v). If
// any parameter I and/or X is NULL, then that component is not extracted. For
// example, to extract just the row indices, pass I as non-NULL, and X as NULL.
// This is like [I,~,~] = find (v).
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_BOOL // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
bool *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_INT8 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
int8_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_UINT8 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
uint8_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_INT16 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
int16_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_UINT16 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
uint16_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_INT32 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
int32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_UINT32 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
uint32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_INT64 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
int64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_UINT64 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
uint64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_FP32 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
float *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_FP64 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
double *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GxB_Vector_extractTuples_FC32 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
GxB_FC32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GxB_Vector_extractTuples_FC64 // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
GxB_FC64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples_UDT // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
void *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
// Type-generic version: X can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Vector_extractTuples // [I,~,X] = find (v)
(
GrB_Index *I, // array for returning row indices of tuples
<type> *X, // array for returning values of tuples
GrB_Index *nvals, // I, X size on input; # tuples on output
const GrB_Vector v // vector to extract tuples from
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Vector_extractTuples(I,X,nvals,v) \
_Generic \
( \
(X), \
GB_CASES (*, GrB, Vector_extractTuples) \
) \
(I, X, nvals, v)
#endif
//==============================================================================
// GrB_Matrix: a GraphBLAS matrix
//==============================================================================
typedef struct GB_Matrix_opaque *GrB_Matrix ;
// These methods create, free, copy, and clear a matrix. The nrows, ncols,
// nvals, and type methods return basic information about a matrix.
GB_PUBLIC
GrB_Info GrB_Matrix_new // create a new matrix with no entries
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // matrix dimension is nrows-by-ncols
GrB_Index ncols // (nrows and ncols must be <= GrB_INDEX_MAX+1)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_dup // make an exact copy of a matrix
(
GrB_Matrix *C, // handle of output matrix to create
const GrB_Matrix A // input matrix to copy
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_clear // clear a matrix of all entries;
( // type and dimensions remain unchanged
GrB_Matrix A // matrix to clear
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_nrows // get the number of rows of a matrix
(
GrB_Index *nrows, // matrix has nrows rows
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_ncols // get the number of columns of a matrix
(
GrB_Index *ncols, // matrix has ncols columns
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_nvals // get the number of entries in a matrix
(
GrB_Index *nvals, // matrix has nvals entries
const GrB_Matrix A // matrix to query
) ;
// NOTE: GxB_Matrix_type is historical. Use GxB_Matrix_type_name instead.
GB_PUBLIC
GrB_Info GxB_Matrix_type // get the type of a matrix
(
GrB_Type *type, // returns the type of the matrix
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_type_name // return the name of the type of a matrix
(
char *type_name, // name of the type (char array of size at least
// GxB_MAX_NAME_LEN, owned by the user application).
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_memoryUsage // return # of bytes used for a matrix
(
size_t *size, // # of bytes used by the matrix A
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_iso // return iso status of a matrix
(
bool *iso, // true if the matrix is iso-valued
const GrB_Matrix A // matrix to query
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_free // free a matrix
(
GrB_Matrix *A // handle of matrix to free
) ;
//------------------------------------------------------------------------------
// GrB_Matrix_build
//------------------------------------------------------------------------------
// GrB_Matrix_build: C = sparse (I,J,X), but using any
// associative operator to assemble duplicate entries.
GB_PUBLIC
GrB_Info GrB_Matrix_build_BOOL // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const bool *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_INT8 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const int8_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_UINT8 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const uint8_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_INT16 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const int16_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_UINT16 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const uint16_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_INT32 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const int32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_UINT32 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const uint32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_INT64 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const int64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_UINT64 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const uint64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_FP32 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const float *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_FP64 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const double *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_build_FC32 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const GxB_FC32_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_build_FC64 // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const GxB_FC64_t *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_build_UDT // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const void *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_build_Scalar // build a matrix from (I,J,scalar) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
GrB_Scalar scalar, // value for all tuples
GrB_Index nvals // number of tuples
) ;
// Type-generic version: X can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Matrix_build // build a matrix from (I,J,X) tuples
(
GrB_Matrix C, // matrix to build
const GrB_Index *I, // array of row indices of tuples
const GrB_Index *J, // array of column indices of tuples
const <type> *X, // array of values of tuples
GrB_Index nvals, // number of tuples
const GrB_BinaryOp dup // binary function to assemble duplicates
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_build(C,I,J,X,nvals,dup) \
_Generic \
( \
(X), \
GB_CASES (*, GrB, Matrix_build) \
) \
(C, I, J, ((const void *) (X)), nvals, dup)
#endif
//------------------------------------------------------------------------------
// GrB_Matrix_setElement
//------------------------------------------------------------------------------
// Set a single entry in a matrix, C(i,j) = x, typecasting
// from the type of x to the type of C, as needed.
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_BOOL // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
bool x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_INT8 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
int8_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_UINT8 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
uint8_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_INT16 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
int16_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_UINT16 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
uint16_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_INT32 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
int32_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_UINT32 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
uint32_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_INT64 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
int64_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_UINT64 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
uint64_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_FP32 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
float x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_FP64 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
double x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_setElement_FC32 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
GxB_FC32_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_setElement_FC64 // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
GxB_FC64_t x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_UDT // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
void *x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_setElement_Scalar // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
GrB_Scalar x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
// Type-generic version: x can be any supported C type or void * for a
// user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Matrix_setElement // C (i,j) = x
(
GrB_Matrix C, // matrix to modify
<type> x, // scalar to assign to C(i,j)
GrB_Index i, // row index
GrB_Index j // column index
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_setElement(C,x,i,j) \
_Generic \
( \
(x), \
GB_CASES (, GrB, Matrix_setElement), \
default: GrB_Matrix_setElement_Scalar \
) \
(C, x, i, j)
#endif
//------------------------------------------------------------------------------
// GrB_Matrix_extractElement
//------------------------------------------------------------------------------
// Extract a single entry from a matrix, x = A(i,j), typecasting from the type
// of A to the type of x, as needed.
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_BOOL // x = A(i,j)
(
bool *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_INT8 // x = A(i,j)
(
int8_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_UINT8 // x = A(i,j)
(
uint8_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_INT16 // x = A(i,j)
(
int16_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_UINT16 // x = A(i,j)
(
uint16_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_INT32 // x = A(i,j)
(
int32_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_UINT32 // x = A(i,j)
(
uint32_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_INT64 // x = A(i,j)
(
int64_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_UINT64 // x = A(i,j)
(
uint64_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_FP32 // x = A(i,j)
(
float *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_FP64 // x = A(i,j)
(
double *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_extractElement_FC32 // x = A(i,j)
(
GxB_FC32_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_extractElement_FC64 // x = A(i,j)
(
GxB_FC64_t *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_UDT // x = A(i,j)
(
void *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement_Scalar // x = A(i,j)
(
GrB_Scalar x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
// Type-generic version: x can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Matrix_extractElement // x = A(i,j)
(
<type> *x, // extracted scalar
const GrB_Matrix A, // matrix to extract a scalar from
GrB_Index i, // row index
GrB_Index j // column index
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_extractElement(x,A,i,j) \
_Generic \
( \
(x), \
GB_CASES (*, GrB, Matrix_extractElement), \
default: GrB_Matrix_extractElement_Scalar \
) \
(x, A, i, j)
#endif
// GxB_Matrix_isStoredElement determines if A(i,j) is present in the structure
// of the matrix A, as a stored element. It does not return the value. It
// returns GrB_SUCCESS if the element is present, or GrB_NO_VALUE otherwise.
GB_PUBLIC
GrB_Info GxB_Matrix_isStoredElement // determine if A(i,j) is a stored element
(
const GrB_Matrix A, // matrix to check
GrB_Index i, // row index
GrB_Index j // column index
) ;
//------------------------------------------------------------------------------
// GrB_Matrix_removeElement
//------------------------------------------------------------------------------
// GrB_Matrix_removeElement (A,i,j) removes the entry A(i,j) from the matrix A.
GB_PUBLIC
GrB_Info GrB_Matrix_removeElement
(
GrB_Matrix C, // matrix to remove entry from
GrB_Index i, // row index
GrB_Index j // column index
) ;
//------------------------------------------------------------------------------
// GrB_Matrix_extractTuples
//------------------------------------------------------------------------------
// Extracts all tuples from a matrix, like [I,J,X] = find (A). If
// any parameter I, J and/or X is NULL, then that component is not extracted.
// For example, to extract just the row and col indices, pass I and J as
// non-NULL, and X as NULL. This is like [I,J,~] = find (A).
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_BOOL // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
bool *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_INT8 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
int8_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_UINT8 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
uint8_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_INT16 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
int16_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_UINT16 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
uint16_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_INT32 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
int32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_UINT32 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
uint32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_INT64 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
int64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_UINT64 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
uint64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_FP32 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
float *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_FP64 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
double *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_extractTuples_FC32 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
GxB_FC32_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_extractTuples_FC64 // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
GxB_FC64_t *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples_UDT // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
void *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
// Type-generic version: X can be a pointer to any supported C type or void *
// for a user-defined type.
/*
GB_PUBLIC
GrB_Info GrB_Matrix_extractTuples // [I,J,X] = find (A)
(
GrB_Index *I, // array for returning row indices of tuples
GrB_Index *J, // array for returning col indices of tuples
<type> *X, // array for returning values of tuples
GrB_Index *nvals, // I,J,X size on input; # tuples on output
const GrB_Matrix A // matrix to extract tuples from
) ;
*/
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_extractTuples(I,J,X,nvals,A) \
_Generic \
( \
(X), \
GB_CASES (*, GrB, Matrix_extractTuples) \
) \
(I, J, X, nvals, A)
#endif
//------------------------------------------------------------------------------
// GxB_Matrix_concat and GxB_Matrix_split
//------------------------------------------------------------------------------
// GxB_Matrix_concat concatenates an array of matrices (Tiles) into a single
// GrB_Matrix C.
// Tiles is an m-by-n dense array of matrices held in row-major format, where
// Tiles [i*n+j] is the (i,j)th tile, and where m > 0 and n > 0 must hold. Let
// A{i,j} denote the (i,j)th tile. The matrix C is constructed by
// concatenating these tiles together, as:
// C = [ A{0,0} A{0,1} A{0,2} ... A{0,n-1}
// A{1,0} A{1,1} A{1,2} ... A{1,n-1}
// ...
// A{m-1,0} A{m-1,1} A{m-1,2} ... A{m-1,n-1} ]
// On input, the matrix C must already exist. Any existing entries in C are
// discarded. C must have dimensions nrows by ncols where nrows is the sum of
// # of rows in the matrices A{i,0} for all i, and ncols is the sum of the # of
// columns in the matrices A{0,j} for all j. All matrices in any given tile
// row i must have the same number of rows (that is, nrows(A{i,0}) must equal
// nrows(A{i,j}) for all j), and all matrices in any given tile column j must
// have the same number of columns (that is, ncols(A{0,j}) must equal
// ncols(A{i,j}) for all i).
// The type of C is unchanged, and all matrices A{i,j} are typecasted into the
// type of C. Any settings made to C by GxB_Matrix_Option_set (format by row
// or by column, bitmap switch, hyper switch, and sparsity control) are
// unchanged.
GB_PUBLIC
GrB_Info GxB_Matrix_concat // concatenate a 2D array of matrices
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix *Tiles, // 2D row-major array of size m-by-n
const GrB_Index m,
const GrB_Index n,
const GrB_Descriptor desc // unused, except threading control
) ;
// GxB_Matrix_split does the opposite of GxB_Matrix_concat. It splits a single
// input matrix A into a 2D array of tiles. On input, the Tiles array must be
// a non-NULL pointer to a previously allocated array of size at least m*n
// where both m and n must be > 0. The Tiles_nrows array has size m, and
// Tiles_ncols has size n. The (i,j)th tile has dimension
// Tiles_nrows[i]-by-Tiles_ncols[j]. The sum of Tiles_nrows [0:m-1] must equal
// the number of rows of A, and the sum of Tiles_ncols [0:n-1] must equal the
// number of columns of A. The type of each tile is the same as the type of A;
// no typecasting is done.
GB_PUBLIC
GrB_Info GxB_Matrix_split // split a matrix into 2D array of matrices
(
GrB_Matrix *Tiles, // 2D row-major array of size m-by-n
const GrB_Index m,
const GrB_Index n,
const GrB_Index *Tile_nrows, // array of size m
const GrB_Index *Tile_ncols, // array of size n
const GrB_Matrix A, // input matrix to split
const GrB_Descriptor desc // unused, except threading control
) ;
//------------------------------------------------------------------------------
// GxB_Matrix_diag, GxB_Vector_diag, GrB_Matrix_diag
//------------------------------------------------------------------------------
// GrB_Matrix_diag constructs a new matrix from a vector. Let n be the length
// of the v vector, from GrB_Vector_size (&n, v). If k = 0, then C is an
// n-by-n diagonal matrix with the entries from v along the main diagonal of C,
// with C(i,i) = v(i). If k is nonzero, C is square with dimension n+abs(k).
// If k is positive, it denotes diagonals above the main diagonal, with
// C(i,i+k) = v(i). If k is negative, it denotes diagonals below the main
// diagonal of C, with C(i-k,i) = v(i). C is constructed with the same type
// as v.
GB_PUBLIC
GrB_Info GrB_Matrix_diag // build a diagonal matrix from a vector
(
GrB_Matrix *C, // output matrix
const GrB_Vector v, // input vector
int64_t k
) ;
// GrB_Matrix_diag is like GxB_Matrix_diag (&C, v, k, NULL), except that C must
// already exist on input, of the correct size. Any existing entries in C are
// discarded. The type of C is preserved, so that if the type of C and v
// differ, the entries are typecasted into the type of C. Any settings made to
// C by GxB_Matrix_Option_set (format by row or by column, bitmap switch, hyper
// switch, and sparsity control) are unchanged.
GB_PUBLIC
GrB_Info GxB_Matrix_diag // construct a diagonal matrix from a vector
(
GrB_Matrix C, // output matrix
const GrB_Vector v, // input vector
int64_t k,
const GrB_Descriptor desc // to specify # of threads
) ;
// GxB_Vector_diag extracts a vector v from an input matrix A, which may be
// rectangular. If k = 0, the main diagonal of A is extracted; k > 0 denotes
// diagonals above the main diagonal of A, and k < 0 denotes diagonals below
// the main diagonal of A. Let A have dimension m-by-n. If k is in the range
// 0 to n-1, then v has length min(m,n-k). If k is negative and in the range
// -1 to -m+1, then v has length min(m+k,n). If k is outside these ranges,
// v has length 0 (this is not an error).
// v must already exist on input, of the correct length; that is
// GrB_Vector_size (&len,v) must return len = 0 if k >= n or k <= -m, len =
// min(m,n-k) if k is in the range 0 to n-1, and len = min(m+k,n) if k is in
// the range -1 to -m+1. Any existing entries in v are discarded. The type of
// v is preserved, so that if the type of A and v differ, the entries are
// typecasted into the type of v. Any settings made to v by
// GxB_Vector_Option_set (bitmap switch and sparsity control) are unchanged.
GB_PUBLIC
GrB_Info GxB_Vector_diag // extract a diagonal from a matrix, as a vector
(
GrB_Vector v, // output vector
const GrB_Matrix A, // input matrix
int64_t k,
const GrB_Descriptor desc // unused, except threading control
) ;
//==============================================================================
// SuiteSparse:GraphBLAS options
//==============================================================================
// The following options modify how SuiteSparse:GraphBLAS stores and operates
// on its matrices. The GxB_*Option* methods allow the user to suggest how the
// internal representation of a matrix, or all matrices, should be held. These
// options have no effect on the result (except for minor roundoff differences
// for floating-point types). They only affect the time and memory usage of the
// computations.
// GxB_Matrix_Option_set: sets an option for a specific matrix
// GxB_Matrix_Option_get: queries the current option of a specific matrix
// GxB_Vector_Option_set: sets an option for a specific vector
// GxB_Vector_Option_get: queries the current option of a specific vector
// GxB_Global_Option_set: sets an option for all future matrices
// GxB_Global_Option_get: queries current option for all future matrices
#define GxB_HYPER 0 // (historical, use GxB_HYPER_SWITCH)
typedef enum // for global options or matrix options
{
//------------------------------------------------------------
// for GxB_Matrix_Option_get/set and GxB_Global_Option_get/set:
//------------------------------------------------------------
GxB_HYPER_SWITCH = 0, // defines switch to hypersparse (a double value)
GxB_BITMAP_SWITCH = 34, // defines switch to bitmap (a double value)
GxB_FORMAT = 1, // defines CSR/CSC format: GxB_BY_ROW or GxB_BY_COL
//------------------------------------------------------------
// for GxB_Global_Option_get only:
//------------------------------------------------------------
GxB_MODE = 2, // mode passed to GrB_init (blocking or non-blocking)
GxB_LIBRARY_NAME = 8, // name of the library (char *)
GxB_LIBRARY_VERSION = 9, // library version (3 int's)
GxB_LIBRARY_DATE = 10, // date of the library (char *)
GxB_LIBRARY_ABOUT = 11, // about the library (char *)
GxB_LIBRARY_URL = 12, // URL for the library (char *)
GxB_LIBRARY_LICENSE = 13, // license of the library (char *)
GxB_LIBRARY_COMPILE_DATE = 14, // date library was compiled (char *)
GxB_LIBRARY_COMPILE_TIME = 15, // time library was compiled (char *)
GxB_API_VERSION = 16, // API version (3 int's)
GxB_API_DATE = 17, // date of the API (char *)
GxB_API_ABOUT = 18, // about the API (char *)
GxB_API_URL = 19, // URL for the API (char *)
GxB_COMPILER_VERSION = 23, // compiler version (3 int's)
GxB_COMPILER_NAME = 24, // compiler name (char *)
GxB_LIBRARY_OPENMP = 25, // library compiled with OpenMP
//------------------------------------------------------------
// for GxB_Global_Option_get/set only:
//------------------------------------------------------------
GxB_GLOBAL_NTHREADS = GxB_NTHREADS, // max number of threads to use
// If <= GxB_DEFAULT, then GraphBLAS selects the number
// of threads automatically.
GxB_GLOBAL_CHUNK = GxB_CHUNK, // chunk size for small problems.
// If <= GxB_DEFAULT, then the default is used.
GxB_BURBLE = 99, // diagnostic output (bool *)
GxB_PRINTF = 101, // printf function diagnostic output
GxB_FLUSH = 102, // flush function diagnostic output
GxB_MEMORY_POOL = 103, // memory pool control
GxB_PRINT_1BASED = 104, // print matrices as 0-based or 1-based
//------------------------------------------------------------
// for GxB_Matrix_Option_get only:
//------------------------------------------------------------
GxB_SPARSITY_STATUS = 33, // hyper, sparse, bitmap or full (1,2,4,8)
GxB_IS_HYPER = 6, // historical; use GxB_SPARSITY_STATUS
//------------------------------------------------------------
// for GxB_Matrix_Option_get/set only:
//------------------------------------------------------------
GxB_SPARSITY_CONTROL = 32, // sparsity control: 0 to 15; see below
//------------------------------------------------------------
// GPU and options (DRAFT: do not use)
//------------------------------------------------------------
GxB_GLOBAL_GPU_CONTROL = GxB_GPU_CONTROL,
GxB_GLOBAL_GPU_CHUNK = GxB_GPU_CHUNK,
} GxB_Option_Field ;
// GxB_FORMAT can be by row or by column:
typedef enum
{
GxB_BY_ROW = 0, // CSR: compressed sparse row format
GxB_BY_COL = 1, // CSC: compressed sparse column format
GxB_NO_FORMAT = -1 // format not defined
}
GxB_Format_Value ;
// The default format is by row. These constants are defined as GB_PUBLIC
// const, so that if SuiteSparse:GraphBLAS is recompiled with a different
// default format, and the application is relinked but not recompiled, it will
// acquire the new default values.
GB_PUBLIC const GxB_Format_Value GxB_FORMAT_DEFAULT ;
// the default hyper_switch parameter
GB_PUBLIC const double GxB_HYPER_DEFAULT ;
// GxB_SPARSITY_CONTROL can be any sum or bitwise OR of these 4 values:
#define GxB_HYPERSPARSE 1 // store matrix in hypersparse form
#define GxB_SPARSE 2 // store matrix as sparse form (compressed vector)
#define GxB_BITMAP 4 // store matrix as a bitmap
#define GxB_FULL 8 // store matrix as full; all entries must be present
// size of b array for GxB_set/get (GxB_BITMAP_SWITCH, b)
#define GxB_NBITMAP_SWITCH 8 // size of bitmap_switch parameter array
// any sparsity value:
#define GxB_ANY_SPARSITY (GxB_HYPERSPARSE + GxB_SPARSE + GxB_BITMAP + GxB_FULL)
// the default sparsity control is any format:
#define GxB_AUTO_SPARSITY GxB_ANY_SPARSITY
// GxB_Matrix_Option_set (A, GxB_SPARSITY_CONTROL, scontrol) provides hints
// about which data structure GraphBLAS should use for the matrix A:
//
// GxB_AUTO_SPARSITY: GraphBLAS selects automatically.
// GxB_HYPERSPARSE: always hypersparse, taking O(nvals(A)) space.
// GxB_SPARSE: always in a sparse struture: compressed-sparse row/column,
// taking O(nrows+nvals(A)) space if stored by row, or
// O(ncols+nvals(A)) if stored by column.
// GxB_BITMAP: always in a bitmap struture, taking O(nrows*ncols) space.
// GxB_FULL: always in a full structure, taking O(nrows*ncols) space,
// unless not all entries are present, in which case the bitmap
// storage is used.
//
// These options can be summed. For example, to allow a matrix to be sparse
// or hypersparse, but not bitmap or full, use GxB_SPARSE + GxB_HYPERSPARSE.
// Since GxB_FULL can only be used when all entries are present, matrices with
// the just GxB_FULL control setting are stored in bitmap form if any entries
// are not present.
//
// Only the least 4 bits of the sparsity control are considered, so the
// formats can be bitwise negated. For example, to allow for any format
// except full, use ~GxB_FULL.
//
// GxB_Matrix_Option_get (A, GxB_SPARSITY_STATUS, &sparsity) returns the
// current data structure currently used for the matrix A (either hypersparse,
// sparse, bitmap, or full).
//
// GxB_Matrix_Option_get (A, GxB_SPARSITY_CONTROL, &scontrol) returns the hint
// for how A should be stored (hypersparse, sparse, bitmap, or full, or any
// combination).
// GxB_HYPER_SWITCH:
// If the matrix or vector structure can be sparse or hypersparse, the
// GxB_HYPER_SWITCH parameter controls when each of these structures are
// used. The parameter is not used if the matrix or vector is full or
// bitmap.
//
// Let k be the actual number of non-empty vectors (with at least one
// entry). This value k is not dependent on whether or not the matrix is
// stored in hypersparse structure. Let n be the number of vectors (the #
// of columns if CSC, or rows if CSR). Let h be the value of the
// GxB_HYPER_SWITCH setting of the matrix.
//
// If a matrix is currently hypersparse, it can be converted to
// non-hypersparse if (n <= 1 || k > 2*n*h). Otherwise it stays
// hypersparse. If (n <= 1) the matrix is always stored as
// non-hypersparse.
//
// If currently non-hypersparse, it can be converted to hypersparse if (n
// > 1 && k <= n*h). Otherwise, it stays non-hypersparse. If (n <= 1)
// the matrix always remains non-hypersparse.
//
// Setting GxB_HYPER_SWITCH to GxB_ALWAYS_HYPER or GxB_NEVER_HYPER ensures
// a matrix always stays hypersparse, or always stays non-hypersparse,
// respectively.
GB_PUBLIC const double GxB_ALWAYS_HYPER, GxB_NEVER_HYPER ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_set // set an option in a matrix
(
GrB_Matrix A, // matrix to modify
GxB_Option_Field field, // option to change
... // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_set_INT32 // set an option in a matrix
(
GrB_Matrix A, // matrix to modify
GxB_Option_Field field, // option to change
int32_t value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_set_FP64 // set an option in a matrix
(
GrB_Matrix A, // matrix to modify
GxB_Option_Field field, // option to change
double value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_get // gets the current option of a matrix
(
GrB_Matrix A, // matrix to query
GxB_Option_Field field, // option to query
... // return value of the matrix option
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_get_INT32 // gets the current option of a matrix
(
GrB_Matrix A, // matrix to query
GxB_Option_Field field, // option to query
int32_t *value // return value of the matrix option
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_Option_get_FP64 // gets the current option of a matrix
(
GrB_Matrix A, // matrix to query
GxB_Option_Field field, // option to query
double *value // return value of the matrix option
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_set // set an option in a vector
(
GrB_Vector A, // vector to modify
GxB_Option_Field field, // option to change
... // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_set_INT32 // set an option in a vector
(
GrB_Vector v, // vector to modify
GxB_Option_Field field, // option to change
int32_t value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_set_FP64 // set an option in a vector
(
GrB_Vector v, // vector to modify
GxB_Option_Field field, // option to change
double value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_get // gets the current option of a vector
(
GrB_Vector A, // vector to query
GxB_Option_Field field, // option to query
... // return value of the vector option
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_get_INT32 // gets the current option of a vector
(
GrB_Vector v, // vector to query
GxB_Option_Field field, // option to query
int32_t *value // return value of the vector option
) ;
GB_PUBLIC
GrB_Info GxB_Vector_Option_get_FP64 // gets the current option of a vector
(
GrB_Vector v, // vector to query
GxB_Option_Field field, // option to query
double *value // return value of the vector option
) ;
// GxB_Global_Option_set controls the global defaults used when a new matrix is
// created. GrB_init defines the following initial settings:
//
// GxB_Global_Option_set (GxB_HYPER_SWITCH, GxB_HYPER_DEFAULT) ;
// GxB_Global_Option_set (GxB_BITMAP_SWITCH, NULL) ;
// GxB_Global_Option_set (GxB_FORMAT, GxB_FORMAT_DEFAULT) ;
//
// The compile-time constants GxB_HYPER_DEFAULT and GxB_FORMAT_DEFAULT are
// equal to 0.0625 and GxB_BY_ROW, by default. That is, by default, all new
// matrices are held by row in CSR format. If a matrix has fewer than n/16
// columns, it can be converted to hypersparse structure. If it has more than
// n/8 columns, it can be converted to a sparse structure. Modifying these
// global settings via GxB_Global_Option_set has no effect on matrices already
// created.
GB_PUBLIC
GrB_Info GxB_Global_Option_set // set a global default option
(
GxB_Option_Field field, // option to change
... // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_set_INT32 // set a global default option
(
GxB_Option_Field field, // option to change
int32_t value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_set_FP64 // set a global default option
(
GxB_Option_Field field, // option to change
double value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_set_FP64_ARRAY // set a global default option
(
GxB_Option_Field field, // option to change
double *value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_set_INT64_ARRAY // set a global default option
(
GxB_Option_Field field, // option to change
int64_t *value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_set_FUNCTION // set a global default option
(
GxB_Option_Field field, // option to change
void *value // value to change it to
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get // gets the current global default option
(
GxB_Option_Field field, // option to query
... // return value of the global option
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get_INT32 // gets the current global option
(
GxB_Option_Field field, // option to query
int32_t *value // return value of the global option
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get_FP64 // gets the current global option
(
GxB_Option_Field field, // option to query
double *value // return value of the global option
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get_INT64 // gets the current global option
(
GxB_Option_Field field, // option to query
int64_t *value // return value of the global option
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get_CHAR // gets the current global option
(
GxB_Option_Field field, // option to query
char **value // return value of the global option
) ;
GB_PUBLIC
GrB_Info GxB_Global_Option_get_FUNCTION // gets the current global option
(
GxB_Option_Field field, // option to query
void **value // return value of the global option
) ;
//------------------------------------------------------------------------------
// GxB_set and GxB_get
//------------------------------------------------------------------------------
// The simplest way to set/get a value of a GrB_Descriptor is with
// the generic GxB_set and GxB_get functions:
// GxB_set (desc, field, value) ;
// GxB_get (desc, field, &value) ;
// GxB_set and GxB_get are generic methods that and set or query the options in
// a GrB_Matrix, a GrB_Descriptor, or in the global options. They can be used
// with the following syntax. Note that GxB_NTHREADS can be used for both the
// global nthreads_max, and for the # of threads in the descriptor.
// To set/get the global options:
//
// GxB_set (GxB_HYPER_SWITCH, double h) ;
// GxB_set (GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ;
// GxB_set (GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ;
// GxB_get (GxB_HYPER_SWITCH, double *h) ;
//
// double b [GxB_NBITMAP_SWITCH] ;
// GxB_set (GxB_BITMAP_SWITCH, b) ;
// GxB_set (GxB_BITMAP_SWITCH, NULL) ; // set defaults
// GxB_get (GxB_BITMAP_SWITCH, b) ;
//
// GxB_set (GxB_FORMAT, GxB_BY_ROW) ;
// GxB_set (GxB_FORMAT, GxB_BY_COL) ;
// GxB_get (GxB_FORMAT, GxB_Format_Value *s) ;
//
// GxB_set (GxB_NTHREADS, nthreads_max) ;
// GxB_get (GxB_NTHREADS, int *nthreads_max) ;
//
// GxB_set (GxB_CHUNK, double chunk) ;
// GxB_get (GxB_CHUNK, double *chunk) ;
//
// GxB_set (GxB_BURBLE, bool burble) ;
// GxB_get (GxB_BURBLE, bool *burble) ;
//
// GxB_set (GxB_PRINTF, void *printf_function) ;
// GxB_get (GxB_PRINTF, void **printf_function) ;
//
// GxB_set (GxB_FLUSH, void *flush_function) ;
// GxB_get (GxB_FLUSH, void **flush_function) ;
//
// int64_t free_pool_limit [64] ;
// GxB_set (GxB_MEMORY_POOL, free_pool_limit) ;
// GxB_set (GxB_MEMORY_POOL, NULL) ; // set defaults
// GxB_get (GxB_MEMORY_POOL, free_pool_limit) ;
// To get global options that can be queried but not modified:
//
// GxB_get (GxB_MODE, GrB_Mode *mode) ;
// To set/get a matrix option:
//
// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, double h) ;
// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_ALWAYS_HYPER) ;
// GxB_set (GrB_Matrix A, GxB_HYPER_SWITCH, GxB_NEVER_HYPER) ;
// GxB_get (GrB_Matrix A, GxB_HYPER_SWITCH, double *h) ;
//
// GxB_set (GrB_Matrix A, GxB_BITMAP_SWITCH, double b) ;
// GxB_get (GrB_Matrix A, GxB_BITMAP_SWITCH, double *b) ;
//
// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_ROW) ;
// GxB_set (GrB_Matrix A, GxB_FORMAT, GxB_BY_COL) ;
// GxB_get (GrB_Matrix A, GxB_FORMAT, GxB_Format_Value *s) ;
//
// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ;
// GxB_set (GrB_Matrix A, GxB_SPARSITY_CONTROL, scontrol) ;
// GxB_get (GrB_Matrix A, GxB_SPARSITY_CONTROL, int *scontrol) ;
//
// GxB_get (GrB_Matrix A, GxB_SPARSITY_STATUS, int *sparsity) ;
// To set/get a vector option or status:
//
// GxB_set (GrB_Vector v, GxB_BITMAP_SWITCH, double b) ;
// GxB_get (GrB_Vector v, GxB_BITMAP_SWITCH, double *b) ;
//
// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_ROW) ;
// GxB_set (GrB_Vector v, GxB_FORMAT, GxB_BY_COL) ;
// GxB_get (GrB_Vector v, GxB_FORMAT, GxB_Format_Value *s) ;
//
// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, GxB_AUTO_SPARSITY) ;
// GxB_set (GrB_Vector v, GxB_SPARSITY_CONTROL, scontrol) ;
// GxB_get (GrB_Vector v, GxB_SPARSITY_CONTROL, int *scontrol) ;
//
// GxB_get (GrB_Vector v, GxB_SPARSITY_STATUS, int *sparsity) ;
// To set/get a descriptor field:
//
// GxB_set (GrB_Descriptor d, GrB_OUTP, GxB_DEFAULT) ;
// GxB_set (GrB_Descriptor d, GrB_OUTP, GrB_REPLACE) ;
// GxB_get (GrB_Descriptor d, GrB_OUTP, GrB_Desc_Value *v) ;
//
// GxB_set (GrB_Descriptor d, GrB_MASK, GxB_DEFAULT) ;
// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP) ;
// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_STRUCTURE) ;
// GxB_set (GrB_Descriptor d, GrB_MASK, GrB_COMP + GrB_STRUCTURE) ;
// GxB_get (GrB_Descriptor d, GrB_MASK, GrB_Desc_Value *v) ;
//
// GxB_set (GrB_Descriptor d, GrB_INP0, GxB_DEFAULT) ;
// GxB_set (GrB_Descriptor d, GrB_INP0, GrB_TRAN) ;
// GxB_get (GrB_Descriptor d, GrB_INP0, GrB_Desc_Value *v) ;
//
// GxB_set (GrB_Descriptor d, GrB_INP1, GxB_DEFAULT) ;
// GxB_set (GrB_Descriptor d, GrB_INP1, GrB_TRAN) ;
// GxB_get (GrB_Descriptor d, GrB_INP1, GrB_Desc_Value *v) ;
//
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_DEFAULT) ;
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_GUSTAVSON) ;
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_HASH) ;
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_SAXPY) ;
// GxB_set (GrB_Descriptor d, GxB_AxB_METHOD, GxB_AxB_DOT) ;
// GxB_get (GrB_Descriptor d, GrB_AxB_METHOD, GrB_Desc_Value *v) ;
//
// GxB_set (GrB_Descriptor d, GxB_NTHREADS, nthreads) ;
// GxB_get (GrB_Descriptor d, GxB_NTHREADS, int *nthreads) ;
//
// GxB_set (GrB_Descriptor d, GxB_CHUNK, double chunk) ;
// GxB_get (GrB_Descriptor d, GxB_CHUNK, double *chunk) ;
//
// GxB_set (GrB_Descriptor d, GxB_SORT, int sort) ;
// GxB_get (GrB_Descriptor d, GxB_SORT, int *sort) ;
//
// GxB_set (GrB_Descriptor d, GxB_COMPRESSION, int method) ;
// GxB_get (GrB_Descriptor d, GxB_COMPRESSION, int *method) ;
//
// GxB_set (GrB_Descriptor d, GxB_IMPORT, int method) ;
// GxB_get (GrB_Descriptor d, GxB_IMPORT, int *method) ;
#if GxB_STDC_VERSION >= 201112L
#define GxB_set(arg1,...) \
_Generic \
( \
(arg1), \
int : GxB_Global_Option_set , \
GxB_Option_Field : GxB_Global_Option_set , \
GrB_Vector : GxB_Vector_Option_set , \
GrB_Matrix : GxB_Matrix_Option_set , \
GrB_Descriptor : GxB_Desc_set \
) \
(arg1, __VA_ARGS__)
#define GxB_get(arg1,...) \
_Generic \
( \
(arg1), \
const int : GxB_Global_Option_get , \
int : GxB_Global_Option_get , \
const GxB_Option_Field : GxB_Global_Option_get , \
GxB_Option_Field : GxB_Global_Option_get , \
const GrB_Vector : GxB_Vector_Option_get , \
GrB_Vector : GxB_Vector_Option_get , \
const GrB_Matrix : GxB_Matrix_Option_get , \
GrB_Matrix : GxB_Matrix_Option_get , \
const GrB_Descriptor : GxB_Desc_get , \
GrB_Descriptor : GxB_Desc_get \
) \
(arg1, __VA_ARGS__)
#endif
//==============================================================================
// GrB_free: free any GraphBLAS object
//==============================================================================
// for null and invalid objects
#define GrB_NULL NULL
#define GrB_INVALID_HANDLE NULL
#if GxB_STDC_VERSION >= 201112L
#define GrB_free(object) \
_Generic \
( \
(object), \
GrB_Type *: GrB_Type_free , \
GrB_UnaryOp *: GrB_UnaryOp_free , \
GrB_BinaryOp *: GrB_BinaryOp_free , \
GxB_SelectOp *: GxB_SelectOp_free , \
GrB_IndexUnaryOp *: GrB_IndexUnaryOp_free , \
GrB_Monoid *: GrB_Monoid_free , \
GrB_Semiring *: GrB_Semiring_free , \
GrB_Scalar *: GrB_Scalar_free , \
GrB_Vector *: GrB_Vector_free , \
GrB_Matrix *: GrB_Matrix_free , \
GrB_Descriptor *: GrB_Descriptor_free , \
GxB_Iterator *: GxB_Iterator_free \
) \
(object)
#endif
//==============================================================================
// GrB_wait: finish computations
//==============================================================================
typedef enum
{
GrB_COMPLETE = 0, // establishes a happens-before relation
GrB_MATERIALIZE = 1 // object is complete
}
GrB_WaitMode ;
// Finish all pending work in a specific object.
GB_PUBLIC GrB_Info GrB_Type_wait (GrB_Type type , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_UnaryOp_wait (GrB_UnaryOp op , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_BinaryOp_wait (GrB_BinaryOp op , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GxB_SelectOp_wait (GxB_SelectOp op , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_IndexUnaryOp_wait (GrB_IndexUnaryOp op , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Monoid_wait (GrB_Monoid monoid , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Semiring_wait (GrB_Semiring semiring, GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Descriptor_wait (GrB_Descriptor desc , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Scalar_wait (GrB_Scalar s , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Vector_wait (GrB_Vector v , GrB_WaitMode waitmode) ;
GB_PUBLIC GrB_Info GrB_Matrix_wait (GrB_Matrix A , GrB_WaitMode waitmode) ;
// GrB_wait (object,waitmode) polymorphic function:
#if GxB_STDC_VERSION >= 201112L
#define GrB_wait(object,waitmode) \
_Generic \
( \
(object), \
GrB_Type : GrB_Type_wait , \
GrB_UnaryOp : GrB_UnaryOp_wait , \
GrB_BinaryOp : GrB_BinaryOp_wait , \
GxB_SelectOp : GxB_SelectOp_wait , \
GrB_IndexUnaryOp : GrB_IndexUnaryOp_wait , \
GrB_Monoid : GrB_Monoid_wait , \
GrB_Semiring : GrB_Semiring_wait , \
GrB_Scalar : GrB_Scalar_wait , \
GrB_Vector : GrB_Vector_wait , \
GrB_Matrix : GrB_Matrix_wait , \
GrB_Descriptor : GrB_Descriptor_wait \
) \
(object, waitmode)
#endif
// NOTE: GxB_Scalar_wait is historical; use GrB_Scalar_wait instead
GB_PUBLIC GrB_Info GxB_Scalar_wait (GrB_Scalar *s) ;
//==============================================================================
// GrB_error: error handling
//==============================================================================
// Each GraphBLAS method and operation returns a GrB_Info error code.
// GrB_error returns additional information on the error in a thread-safe
// null-terminated string. The string returned by GrB_error is owned by
// the GraphBLAS library and must not be free'd.
GB_PUBLIC GrB_Info GrB_Type_error (const char **error, const GrB_Type type) ;
GB_PUBLIC GrB_Info GrB_UnaryOp_error (const char **error, const GrB_UnaryOp op) ;
GB_PUBLIC GrB_Info GrB_BinaryOp_error (const char **error, const GrB_BinaryOp op) ;
GB_PUBLIC GrB_Info GxB_SelectOp_error (const char **error, const GxB_SelectOp op) ;
GB_PUBLIC GrB_Info GrB_IndexUnaryOp_error (const char **error, const GrB_IndexUnaryOp op) ;
GB_PUBLIC GrB_Info GrB_Monoid_error (const char **error, const GrB_Monoid monoid) ;
GB_PUBLIC GrB_Info GrB_Semiring_error (const char **error, const GrB_Semiring semiring) ;
GB_PUBLIC GrB_Info GrB_Scalar_error (const char **error, const GrB_Scalar s) ;
GB_PUBLIC GrB_Info GrB_Vector_error (const char **error, const GrB_Vector v) ;
GB_PUBLIC GrB_Info GrB_Matrix_error (const char **error, const GrB_Matrix A) ;
GB_PUBLIC GrB_Info GrB_Descriptor_error (const char **error, const GrB_Descriptor d) ;
// GxB_Scalar_error is historical: use GrB_Scalar_error instead
GB_PUBLIC GrB_Info GxB_Scalar_error (const char **error, const GrB_Scalar s) ;
// GrB_error (error,object) polymorphic function:
#if GxB_STDC_VERSION >= 201112L
#define GrB_error(error,object) \
_Generic \
( \
(object), \
const GrB_Type : GrB_Type_error , \
GrB_Type : GrB_Type_error , \
const GrB_UnaryOp : GrB_UnaryOp_error , \
GrB_UnaryOp : GrB_UnaryOp_error , \
const GrB_BinaryOp : GrB_BinaryOp_error , \
GrB_BinaryOp : GrB_BinaryOp_error , \
const GxB_SelectOp : GxB_SelectOp_error , \
GxB_SelectOp : GxB_SelectOp_error , \
const GrB_IndexUnaryOp : GrB_IndexUnaryOp_error , \
GrB_IndexUnaryOp : GrB_IndexUnaryOp_error , \
const GrB_Monoid : GrB_Monoid_error , \
GrB_Monoid : GrB_Monoid_error , \
const GrB_Semiring : GrB_Semiring_error , \
GrB_Semiring : GrB_Semiring_error , \
const GrB_Scalar : GrB_Scalar_error , \
GrB_Scalar : GrB_Scalar_error , \
const GrB_Vector : GrB_Vector_error , \
GrB_Vector : GrB_Vector_error , \
const GrB_Matrix : GrB_Matrix_error , \
GrB_Matrix : GrB_Matrix_error , \
const GrB_Descriptor : GrB_Descriptor_error , \
GrB_Descriptor : GrB_Descriptor_error \
) \
(error, object)
#endif
//==============================================================================
// GrB_mxm, vxm, mxv: matrix multiplication over a semiring
//==============================================================================
GB_PUBLIC
GrB_Info GrB_mxm // C<Mask> = accum (C, A*B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Semiring semiring, // defines '+' and '*' for A*B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_vxm // w'<Mask> = accum (w, u'*A)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Semiring semiring, // defines '+' and '*' for u'*A
const GrB_Vector u, // first input: vector u
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for w, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_mxv // w<Mask> = accum (w, A*u)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Semiring semiring, // defines '+' and '*' for A*B
const GrB_Matrix A, // first input: matrix A
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w, mask, and A
) ;
//==============================================================================
// GrB_eWiseMult: element-wise matrix and vector operations, set intersection
//==============================================================================
// GrB_eWiseMult computes C<Mask> = accum (C, A.*B), where ".*" is the Hadamard
// product, and where pairs of elements in two matrices (or vectors) are
// pairwise "multiplied" with C(i,j) = mult (A(i,j),B(i,j)).
GB_PUBLIC
GrB_Info GrB_Vector_eWiseMult_Semiring // w<Mask> = accum (w, u.*v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Semiring semiring, // defines '.*' for t=u.*v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_eWiseMult_Monoid // w<Mask> = accum (w, u.*v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Monoid monoid, // defines '.*' for t=u.*v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_eWiseMult_BinaryOp // w<Mask> = accum (w, u.*v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp mult, // defines '.*' for t=u.*v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseMult_Semiring // C<Mask> = accum (C, A.*B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Semiring semiring, // defines '.*' for T=A.*B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseMult_Monoid // C<Mask> = accum (C, A.*B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Monoid monoid, // defines '.*' for T=A.*B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseMult_BinaryOp // C<Mask> = accum (C, A.*B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp mult, // defines '.*' for T=A.*B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
// All 6 of the above type-specific functions are captured in a single
// type-generic function, GrB_eWiseMult:
#if GxB_STDC_VERSION >= 201112L
#define GrB_eWiseMult(C,Mask,accum,op,A,B,desc) \
_Generic \
( \
(C), \
GrB_Matrix : \
_Generic \
( \
(op), \
const GrB_Semiring : GrB_Matrix_eWiseMult_Semiring , \
GrB_Semiring : GrB_Matrix_eWiseMult_Semiring , \
const GrB_Monoid : GrB_Matrix_eWiseMult_Monoid , \
GrB_Monoid : GrB_Matrix_eWiseMult_Monoid , \
const GrB_BinaryOp : GrB_Matrix_eWiseMult_BinaryOp , \
GrB_BinaryOp : GrB_Matrix_eWiseMult_BinaryOp \
), \
GrB_Vector : \
_Generic \
( \
(op), \
const GrB_Semiring : GrB_Vector_eWiseMult_Semiring , \
GrB_Semiring : GrB_Vector_eWiseMult_Semiring , \
const GrB_Monoid : GrB_Vector_eWiseMult_Monoid , \
GrB_Monoid : GrB_Vector_eWiseMult_Monoid , \
const GrB_BinaryOp : GrB_Vector_eWiseMult_BinaryOp , \
GrB_BinaryOp : GrB_Vector_eWiseMult_BinaryOp \
) \
) \
(C, Mask, accum, op, A, B, desc)
#endif
//==============================================================================
// GrB_eWiseAdd: element-wise matrix and vector operations, set union
//==============================================================================
// GrB_eWiseAdd computes C<Mask> = accum (C, A+B), where pairs of elements in
// two matrices (or two vectors) are pairwise "added".
GB_PUBLIC
GrB_Info GrB_Vector_eWiseAdd_Semiring // w<mask> = accum (w, u+v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Semiring semiring, // defines '+' for t=u+v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_eWiseAdd_Monoid // w<mask> = accum (w, u+v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Monoid monoid, // defines '+' for t=u+v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_eWiseAdd_BinaryOp // w<mask> = accum (w, u+v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp add, // defines '+' for t=u+v
const GrB_Vector u, // first input: vector u
const GrB_Vector v, // second input: vector v
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseAdd_Semiring // C<Mask> = accum (C, A+B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Semiring semiring, // defines '+' for T=A+B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseAdd_Monoid // C<Mask> = accum (C, A+B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Monoid monoid, // defines '+' for T=A+B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_eWiseAdd_BinaryOp // C<Mask> = accum (C, A+B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp add, // defines '+' for T=A+B
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
#if GxB_STDC_VERSION >= 201112L
#define GrB_eWiseAdd(C,Mask,accum,op,A,B,desc) \
_Generic \
( \
(C), \
GrB_Matrix : \
_Generic \
( \
(op), \
const GrB_Semiring : GrB_Matrix_eWiseAdd_Semiring , \
GrB_Semiring : GrB_Matrix_eWiseAdd_Semiring , \
const GrB_Monoid : GrB_Matrix_eWiseAdd_Monoid , \
GrB_Monoid : GrB_Matrix_eWiseAdd_Monoid , \
const GrB_BinaryOp : GrB_Matrix_eWiseAdd_BinaryOp , \
GrB_BinaryOp : GrB_Matrix_eWiseAdd_BinaryOp \
), \
GrB_Vector : \
_Generic \
( \
(op), \
const GrB_Semiring : GrB_Vector_eWiseAdd_Semiring , \
GrB_Semiring : GrB_Vector_eWiseAdd_Semiring , \
const GrB_Monoid : GrB_Vector_eWiseAdd_Monoid , \
GrB_Monoid : GrB_Vector_eWiseAdd_Monoid , \
const GrB_BinaryOp : GrB_Vector_eWiseAdd_BinaryOp , \
GrB_BinaryOp : GrB_Vector_eWiseAdd_BinaryOp \
) \
) \
(C, Mask, accum, op, A, B, desc)
#endif
//==============================================================================
// GxB_eWiseUnion: a variant of GrB_eWiseAdd
//==============================================================================
// GxB_eWiseUnion is a variant of eWiseAdd. The methods create a result with
// the same sparsity structure. They differ when an entry is present in A but
// not B, or in B but not A.
// eWiseAdd does the following, for a matrix, where "+" is the add binary op:
// if A(i,j) and B(i,j) are both present:
// C(i,j) = A(i,j) + B(i,j)
// else if A(i,j) is present but not B(i,j)
// C(i,j) = A(i,j)
// else if B(i,j) is present but not A(i,j)
// C(i,j) = B(i,j)
// by contrast, eWiseUnion always applies the operator:
// if A(i,j) and B(i,j) are both present:
// C(i,j) = A(i,j) + B(i,j)
// else if A(i,j) is present but not B(i,j)
// C(i,j) = A(i,j) + beta
// else if B(i,j) is present but not A(i,j)
// C(i,j) = alpha + B(i,j)
GB_PUBLIC
GrB_Info GxB_Vector_eWiseUnion // w<mask> = accum (w, u+v)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp add, // defines '+' for t=u+v
const GrB_Vector u, // first input: vector u
const GrB_Scalar alpha,
const GrB_Vector v, // second input: vector v
const GrB_Scalar beta,
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_eWiseUnion // C<M> = accum (C, A+B)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp add, // defines '+' for T=A+B
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar alpha,
const GrB_Matrix B, // second input: matrix B
const GrB_Scalar beta,
const GrB_Descriptor desc // descriptor for C, M, A, and B
) ;
#if GxB_STDC_VERSION >= 201112L
#define GxB_eWiseUnion(C,Mask,accum,op,A,alpha,B,beta,desc) \
_Generic \
( \
(C), \
const GrB_Matrix : GxB_Matrix_eWiseUnion , \
GrB_Matrix : GxB_Matrix_eWiseUnion , \
const GrB_Vector : GxB_Vector_eWiseUnion , \
GrB_Vector : GxB_Vector_eWiseUnion \
) \
(C, Mask, accum, op, A, alpha, B, beta, desc)
#endif
//==============================================================================
// GrB_extract: extract a submatrix or subvector
//==============================================================================
// Extract entries from a matrix or vector; T = A(I,J). This (like most
// GraphBLAS methods) is then followed by C<Mask>=accum(C,T).
// To extract all rows of a matrix or vector, as in A (:,J), use I=GrB_ALL as
// the input argument. For all columns of a matrix, use J=GrB_ALL.
GB_PUBLIC const uint64_t *GrB_ALL ;
// To extract a range of rows and columns, I and J can be a list of 2 or 3
// indices that defines a range (begin:end) or a strided range (begin:inc:end).
// To specify the colon syntax I = begin:end, the array I has size at least 2,
// where I [GxB_BEGIN] = begin and I [GxB_END] = end. The parameter ni is then
// passed as the special value GxB_RANGE. To specify the colon syntax I =
// begin:inc:end, the array I has size at least three, with the values begin,
// end, and inc (in that order), and then pass in the value ni = GxB_STRIDE.
// The same can be done for the list J and its size, nj.
// These special values of ni and nj can be used for GrB_assign,
// GrB_extract, and GxB_subassign.
#define GxB_RANGE (INT64_MAX)
#define GxB_STRIDE (INT64_MAX-1)
#define GxB_BACKWARDS (INT64_MAX-2)
// for the strided range begin:inc:end, I [GxB_BEGIN] is the value of begin, I
// [GxB_END] is the value end, I [GxB_INC] is the magnitude of the stride. If
// the stride is negative, use ni = GxB_BACKWARDS.
#define GxB_BEGIN (0)
#define GxB_END (1)
#define GxB_INC (2)
// For example, the notation 10:-2:1 defines a sequence [10 8 6 4 2].
// The end point of the sequence (1) need not appear in the sequence, if
// the last increment goes past it. To specify the same in GraphBLAS,
// use:
// GrB_Index I [3], ni = GxB_BACKWARDS ;
// I [GxB_BEGIN ] = 10 ; // the start of the sequence
// I [GxB_INC ] = 2 ; // the magnitude of the increment
// I [GxB_END ] = 1 ; // the end of the sequence
GB_PUBLIC
GrB_Info GrB_Vector_extract // w<mask> = accum (w, u(I))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Vector u, // first input: vector u
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_extract // C<Mask> = accum (C, A(I,J))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Matrix A, // first input: matrix A
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C, Mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Col_extract // w<mask> = accum (w, A(I,j))
(
GrB_Vector w, // input/output matrix for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Matrix A, // first input: matrix A
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
GrB_Index j, // column index
const GrB_Descriptor desc // descriptor for w, mask, and A
) ;
//------------------------------------------------------------------------------
// GrB_extract: generic matrix/vector extraction
//------------------------------------------------------------------------------
// GrB_extract is a generic interface to the following functions:
// GrB_Vector_extract (w,mask,acc,u,I,ni,d) // w<m> = acc (w, u(I))
// GrB_Col_extract (w,mask,acc,A,I,ni,j,d) // w<m> = acc (w, A(I,j))
// GrB_Matrix_extract (C,Mask,acc,A,I,ni,J,nj,d) // C<Mask> = acc (C, A(I,J))
#if GxB_STDC_VERSION >= 201112L
#define GrB_extract(arg1,Mask,accum,arg4,...) \
_Generic \
( \
(arg1), \
GrB_Vector : \
_Generic \
( \
(arg4), \
const GrB_Vector : GrB_Vector_extract , \
GrB_Vector : GrB_Vector_extract , \
const GrB_Matrix : GrB_Col_extract , \
GrB_Matrix : GrB_Col_extract \
), \
GrB_Matrix : GrB_Matrix_extract \
) \
(arg1, Mask, accum, arg4, __VA_ARGS__)
#endif
//==============================================================================
// GxB_subassign: matrix and vector subassign: C(I,J)<Mask> = accum (C(I,J), A)
//==============================================================================
// Assign entries in a matrix or vector; C(I,J) = A.
// Each GxB_subassign function is very similar to its corresponding GrB_assign
// function in the spec, but they differ in two ways: (1) the mask in
// GxB_subassign has the same size as w(I) for vectors and C(I,J) for matrices,
// and (2) they differ in the GrB_REPLACE option. See the user guide for
// details.
// In GraphBLAS notation, the two methods can be described as follows:
// matrix and vector subassign: C(I,J)<Mask> = accum (C(I,J), A)
// matrix and vector assign: C<Mask>(I,J) = accum (C(I,J), A)
// --- assign ------------------------------------------------------------------
//
// GrB_Matrix_assign C<M>(I,J) += A M same size as matrix C.
// A is |I|-by-|J|
//
// GrB_Vector_assign w<m>(I) += u m same size as column vector w.
// u is |I|-by-1
//
// GrB_Row_assign C<m'>(i,J) += u' m is a column vector the same
// size as a row of C.
// u is |J|-by-1, i is a scalar.
//
// GrB_Col_assign C<m>(I,j) += u m is a column vector the same
// size as a column of C.
// u is |I|-by-1, j is a scalar.
//
// --- subassign ---------------------------------------------------------------
//
// GxB_Matrix_subassign C(I,J)<M> += A M same size as matrix A.
// A is |I|-by-|J|
//
// GxB_Vector_subassign w(I)<m> += u m same size as column vector u.
// u is |I|-by-1
//
// GxB_Row_subassign C(i,J)<m'> += u' m same size as column vector u.
// u is |J|-by-1, i is a scalar.
//
// GxB_Col_subassign C(I,j)<m> += u m same size as column vector u.
// u is |I|-by-1, j is a scalar.
GB_PUBLIC
GrB_Info GxB_Vector_subassign // w(I)<mask> = accum (w(I),u)
(
GrB_Vector w, // input/output matrix for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w(I),t)
const GrB_Vector u, // first input: vector u
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign // C(I,J)<Mask> = accum (C(I,J),A)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),T)
const GrB_Matrix A, // first input: matrix A
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J), Mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Col_subassign // C(I,j)<mask> = accum (C(I,j),u)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Vector mask, // optional mask for C(I,j), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(C(I,j),t)
const GrB_Vector u, // input vector
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
GrB_Index j, // column index
const GrB_Descriptor desc // descriptor for C(I,j) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Row_subassign // C(i,J)<mask'> = accum (C(i,J),u')
(
GrB_Matrix C, // input/output matrix for results
const GrB_Vector mask, // optional mask for C(i,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(C(i,J),t)
const GrB_Vector u, // input vector
GrB_Index i, // row index
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(i,J) and mask
) ;
//------------------------------------------------------------------------------
// GxB_Vector_subassign_[SCALAR]: scalar expansion assignment to subvector
//------------------------------------------------------------------------------
// Assigns a single scalar to a subvector, w(I)<mask> = accum(w(I),x). The
// scalar x is implicitly expanded into a vector u of size ni-by-1, with each
// entry in u equal to x, and then w(I)<mask> = accum(w(I),u) is done.
GB_PUBLIC
GrB_Info GxB_Vector_subassign_BOOL // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w(I),x)
bool x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_INT8 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int8_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_UINT8 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint8_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_INT16 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int16_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_UINT16 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint16_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_INT32 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_UINT32 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_INT64 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_UINT64 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_FP32 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
float x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_FP64 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
double x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_FC32 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GxB_FC32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_FC64 // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GxB_FC64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_UDT // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
void *x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_subassign_Scalar // w(I)<mask> = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w(I), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GrB_Scalar x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w(I) and mask
) ;
//------------------------------------------------------------------------------
// GxB_Matrix_subassign_[SCALAR]: scalar expansion assignment to submatrix
//------------------------------------------------------------------------------
// Assigns a single scalar to a submatrix, C(I,J)<Mask> = accum(C(I,J),x). The
// scalar x is implicitly expanded into a matrix A of size ni-by-nj, with each
// entry in A equal to x, and then C(I,J)<Mask> = accum(C(I,J),A) is done.
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_BOOL // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
bool x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_INT8 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int8_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_UINT8 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint8_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_INT16 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int16_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_UINT16 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint16_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_INT32 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_UINT32 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_INT64 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_UINT64 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_FP32 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
float x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_FP64 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
double x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_FC32 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GxB_FC32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_FC64 // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GxB_FC64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_UDT // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
void *x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_subassign_Scalar // C(I,J)<Mask> = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C(I,J), unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GrB_Scalar x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(I,J) and Mask
) ;
//------------------------------------------------------------------------------
// GxB_subassign: generic submatrix/subvector assignment
//------------------------------------------------------------------------------
// GxB_subassign is a generic function that provides access to all specific
// GxB_*_subassign* functions:
// GxB_Vector_subassign (w,m,acc,u,I,ni,d) // w(I)<m> = acc(w(I),u)
// GxB_Matrix_subassign (C,M,acc,A,I,ni,J,nj,d) // C(I,J)<M> = acc(C(I,J),A)
// GxB_Col_subassign (C,m,acc,u,I,ni,j,d) // C(I,j)<m> = acc(C(I,j),u)
// GxB_Row_subassign (C,m,acc,u,i,J,nj,d) // C(i,J)<m'> = acc(C(i,J),u')
// GxB_Vector_subassign_T (w,m,acc,x,I,ni,d) // w(I)<m> = acc(w(I),x)
// GxB_Matrix_subassign_T (C,M,acc,x,I,ni,J,nj,d) // C(I,J)<M> = acc(C(I,J),x)
#if GxB_STDC_VERSION >= 201112L
#define GxB_subassign(arg1,Mask,accum,arg4,arg5,...) \
_Generic \
( \
(arg1), \
GrB_Vector : \
_Generic \
( \
(arg4), \
GB_CASES (, GxB, Vector_subassign) , \
const GrB_Scalar : GxB_Vector_subassign_Scalar, \
GrB_Scalar : GxB_Vector_subassign_Scalar, \
default: GxB_Vector_subassign \
), \
default: \
_Generic \
( \
(arg4), \
GB_CASES (, GxB, Matrix_subassign) , \
const GrB_Scalar : GxB_Matrix_subassign_Scalar, \
GrB_Scalar : GxB_Matrix_subassign_Scalar, \
const GrB_Vector : \
_Generic \
( \
(arg5), \
const GrB_Index *: GxB_Col_subassign , \
GrB_Index *: GxB_Col_subassign , \
default: GxB_Row_subassign \
), \
GrB_Vector : \
_Generic \
( \
(arg5), \
const GrB_Index *: GxB_Col_subassign , \
GrB_Index *: GxB_Col_subassign , \
default: GxB_Row_subassign \
), \
default: GxB_Matrix_subassign \
) \
) \
(arg1, Mask, accum, arg4, arg5, __VA_ARGS__)
#endif
//==============================================================================
// GrB_assign: matrix and vector assign: C<Mask>(I,J) = accum (C(I,J), A)
//==============================================================================
// Assign entries in a matrix or vector; C(I,J) = A.
// Each of these can be used with their generic name, GrB_assign.
GB_PUBLIC
GrB_Info GrB_Vector_assign // w<mask>(I) = accum (w(I),u)
(
GrB_Vector w, // input/output matrix for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w(I),t)
const GrB_Vector u, // first input: vector u
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign // C<Mask>(I,J) = accum (C(I,J),A)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),T)
const GrB_Matrix A, // first input: matrix A
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C, Mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Col_assign // C<mask>(I,j) = accum (C(I,j),u)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Vector mask, // optional mask for C(:,j), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(C(I,j),t)
const GrB_Vector u, // input vector
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
GrB_Index j, // column index
const GrB_Descriptor desc // descriptor for C(:,j) and mask
) ;
GB_PUBLIC
GrB_Info GrB_Row_assign // C<mask'>(i,J) = accum (C(i,J),u')
(
GrB_Matrix C, // input/output matrix for results
const GrB_Vector mask, // optional mask for C(i,:), unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(C(i,J),t)
const GrB_Vector u, // input vector
GrB_Index i, // row index
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C(i,:) and mask
) ;
//------------------------------------------------------------------------------
// GrB_Vector_assign_[SCALAR]: scalar expansion assignment to subvector
//------------------------------------------------------------------------------
// Assigns a single scalar to a subvector, w<mask>(I) = accum(w(I),x). The
// scalar x is implicitly expanded into a vector u of size ni-by-1, with each
// entry in u equal to x, and then w<mask>(I) = accum(w(I),u) is done.
GB_PUBLIC
GrB_Info GrB_Vector_assign_BOOL // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w(I),x)
bool x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_INT8 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int8_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_UINT8 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint8_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_INT16 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int16_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_UINT16 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint16_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_INT32 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_UINT32 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_INT64 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
int64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_UINT64 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
uint64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_FP32 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
float x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_FP64 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
double x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_assign_FC32 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GxB_FC32_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_assign_FC64 // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GxB_FC64_t x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_UDT // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
void *x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_assign_Scalar // w<mask>(I) = accum (w(I),x)
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(w(I),x)
GrB_Scalar x, // scalar to assign to w(I)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Descriptor desc // descriptor for w and mask
) ;
//------------------------------------------------------------------------------
// GrB_Matrix_assign_[SCALAR]: scalar expansion assignment to submatrix
//------------------------------------------------------------------------------
// Assigns a single scalar to a submatrix, C<Mask>(I,J) = accum(C(I,J),x). The
// scalar x is implicitly expanded into a matrix A of size ni-by-nj, with each
// entry in A equal to x, and then C<Mask>(I,J) = accum(C(I,J),A) is done.
GB_PUBLIC
GrB_Info GrB_Matrix_assign_BOOL // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
bool x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_INT8 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int8_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_UINT8 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint8_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_INT16 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int16_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_UINT16 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint16_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_INT32 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_UINT32 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_INT64 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
int64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_UINT64 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
uint64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_FP32 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
float x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_FP64 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
double x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_assign_FC32 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GxB_FC32_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_assign_FC64 // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GxB_FC64_t x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_UDT // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
void *x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_assign_Scalar // C<Mask>(I,J) = accum (C(I,J),x)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C(I,J),x)
GrB_Scalar x, // scalar to assign to C(I,J)
const GrB_Index *I, // row indices
GrB_Index ni, // number of row indices
const GrB_Index *J, // column indices
GrB_Index nj, // number of column indices
const GrB_Descriptor desc // descriptor for C and Mask
) ;
//------------------------------------------------------------------------------
// GrB_assign: generic submatrix/subvector assignment
//------------------------------------------------------------------------------
// GrB_assign is a generic function that provides access to all specific
// GrB_*_assign* functions:
// GrB_Vector_assign_T (w,m,acc,x,I,ni,d) // w<m>(I) = acc(w(I),x)
// GrB_Vector_assign (w,m,acc,u,I,ni,d) // w<m>(I) = acc(w(I),u)
// GrB_Matrix_assign_T (C,M,acc,x,I,ni,J,nj,d) // C<M>(I,J) = acc(C(I,J),x)
// GrB_Col_assign (C,m,acc,u,I,ni,j,d) // C<m>(I,j) = acc(C(I,j),u)
// GrB_Row_assign (C,m,acc,u,i,J,nj,d) // C<m'>(i,J) = acc(C(i,J),u')
// GrB_Matrix_assign (C,M,acc,A,I,ni,J,nj,d) // C<M>(I,J) = acc(C(I,J),A)
#if GxB_STDC_VERSION >= 201112L
#define GrB_assign(arg1,Mask,accum,arg4,arg5,...) \
_Generic \
( \
(arg1), \
GrB_Vector : \
_Generic \
( \
(arg4), \
GB_CASES (, GrB, Vector_assign) , \
const GrB_Scalar : GrB_Vector_assign_Scalar , \
GrB_Scalar : GrB_Vector_assign_Scalar , \
default: GrB_Vector_assign \
), \
default: \
_Generic \
( \
(arg4), \
GB_CASES (, GrB, Matrix_assign) , \
const GrB_Scalar : GrB_Matrix_assign_Scalar , \
GrB_Scalar : GrB_Matrix_assign_Scalar , \
const GrB_Vector : \
_Generic \
( \
(arg5), \
const GrB_Index *: GrB_Col_assign , \
GrB_Index *: GrB_Col_assign , \
default: GrB_Row_assign \
), \
GrB_Vector : \
_Generic \
( \
(arg5), \
const GrB_Index *: GrB_Col_assign , \
GrB_Index *: GrB_Col_assign , \
default: GrB_Row_assign \
), \
default: GrB_Matrix_assign \
) \
) \
(arg1, Mask, accum, arg4, arg5, __VA_ARGS__)
#endif
//==============================================================================
// GrB_apply: matrix and vector apply
//==============================================================================
// Apply a unary, index_unary, or binary operator to entries in a matrix or
// vector, C<M> = accum (C, op (A)).
GB_PUBLIC
GrB_Info GrB_Vector_apply // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_UnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply // C<Mask> = accum (C, op(A)) or op(A')
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_UnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
//-------------------------------------------
// vector apply: binaryop variants (bind 1st)
//-------------------------------------------
// Apply a binary operator to the entries in a vector, binding the first
// input to a scalar x, w<mask> = accum (w, op (x,u)).
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_Scalar // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Scalar x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
// historical: identical to GxB_Vector_apply_BinaryOp1st
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp1st // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Scalar x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_BOOL // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
bool x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_INT8 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
int8_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_INT16 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
int16_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_INT32 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
int32_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_INT64 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
int64_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_UINT8 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
uint8_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_UINT16 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
uint16_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_UINT32 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
uint32_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_UINT64 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
uint64_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_FP32 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
float x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_FP64 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
double x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp1st_FC32 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
GxB_FC32_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp1st_FC64 // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
GxB_FC64_t x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp1st_UDT // w<mask> = accum (w, op(x,u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const void *x, // first input: scalar x
const GrB_Vector u, // second input: vector u
const GrB_Descriptor desc // descriptor for w and mask
) ;
//-------------------------------------------
// vector apply: binaryop variants (bind 2nd)
//-------------------------------------------
// Apply a binary operator to the entries in a vector, binding the second
// input to a scalar y, w<mask> = accum (w, op (u,y)).
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_Scalar // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
// historical: identical to GrB_Vector_apply_BinaryOp2nd_Scalar
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp2nd // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_BOOL // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_INT8 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_INT16 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_INT32 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_INT64 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_UINT8 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_UINT16 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_UINT32 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_UINT64 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_FP32 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_FP64 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp2nd_FC32 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_BinaryOp2nd_FC64 // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_BinaryOp2nd_UDT // w<mask> = accum (w, op(u,y))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
//-------------------------------------------
// vector apply: IndexUnaryOp variants
//-------------------------------------------
// Apply a GrB_IndexUnaryOp to the entries in a vector
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_Scalar // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_BOOL // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_INT8 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_INT16 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_INT32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_INT64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_UINT8 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_UINT16 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_UINT32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_UINT64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_FP32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_FP64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_IndexOp_FC32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_apply_IndexOp_FC64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_apply_IndexOp_UDT // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
//-------------------------------------------
// matrix apply: binaryop variants (bind 1st)
//-------------------------------------------
// Apply a binary operator to the entries in a matrix, binding the first input
// to a scalar x, C<Mask> = accum (C, op (x,A)), or op(x,A').
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_Scalar // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Scalar x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
// historical: identical to GrB_Matrix_apply_BinaryOp1st_Scalar
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp1st // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Scalar x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_BOOL // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
bool x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_INT8 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
int8_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_INT16 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
int16_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_INT32 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
int32_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_INT64 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
int64_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_UINT8 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
uint8_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_UINT16 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
uint16_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_UINT32 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
uint32_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_UINT64 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
uint64_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_FP32 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
float x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_FP64 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
double x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp1st_FC32 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
GxB_FC32_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp1st_FC64 // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
GxB_FC64_t x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp1st_UDT // C<M>=accum(C,op(x,A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const void *x, // first input: scalar x
const GrB_Matrix A, // second input: matrix A
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
//-------------------------------------------
// matrix apply: binaryop variants (bind 2nd)
//-------------------------------------------
// Apply a binary operator to the entries in a matrix, binding the second input
// to a scalar y, C<Mask> = accum (C, op (A,y)), or op(A',y).
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_Scalar // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
// historical: identical to GrB_Matrix_apply_BinaryOp2nd_Scalar
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp2nd // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_BOOL // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_INT8 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_INT16 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_INT32 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_INT64 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_UINT8 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_UINT16 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_UINT32 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_UINT64 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_FP32 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_FP64 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp2nd_FC32 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_BinaryOp2nd_FC64 // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_BinaryOp2nd_UDT // C<M>=accum(C,op(A,y))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
//-------------------------------------------
// matrix apply: IndexUnaryOp variants
//-------------------------------------------
// Apply a GrB_IndexUnaryOp to the entries in a matrix.
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_Scalar // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_BOOL // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_INT8 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_INT16 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_INT32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_INT64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_UINT8 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_UINT16 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_UINT32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_UINT64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_FP32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_FP64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_IndexOp_FC32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_apply_IndexOp_FC64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_apply_IndexOp_UDT // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
//------------------------------------------------------------------------------
// GrB_apply: generic matrix/vector apply
//------------------------------------------------------------------------------
// GrB_apply is a generic function for applying a unary operator to a matrix
// or vector and provides access to these functions:
// GrB_Vector_apply (w,mask,acc,op,u,d) // w<mask> = accum (w, op(u))
// GrB_Matrix_apply (C,Mask,acc,op,A,d) // C<Mask> = accum (C, op(A))
// GrB_Vector_apply (w,m,acc,unop ,u,d)
// GrB_Vector_apply_BinaryOp1st_TYPE (w,m,acc,binop,x,u,d)
// GrB_Vector_apply_BinaryOp2nd_TYPE (w,m,acc,binop,u,y,d)
// GrB_Vector_apply_IndexOp_TYPE (w,m,acc,idxop,u,y,d)
// GrB_Matrix_apply (C,M,acc,unop ,A,d)
// GrB_Matrix_apply_BinaryOp1st_TYPE (C,M,acc,binop,x,A,d)
// GrB_Matrix_apply_BinaryOp2nd_TYPE (C,M,acc,binop,A,y,d)
// GrB_Matrix_apply_IndexOp_TYPE (C,M,acc,idxop,A,y,d)
#if GxB_STDC_VERSION >= 201112L
#define GB_BIND(kind,x,y,...) \
_Generic \
( \
(x), \
const GrB_Scalar: GB_CONCAT ( GrB,_,kind,_apply_BinaryOp1st_Scalar), \
GrB_Scalar: GB_CONCAT ( GrB,_,kind,_apply_BinaryOp1st_Scalar), \
GB_CASES (, GrB, GB_CONCAT ( kind, _apply_BinaryOp1st,, )) , \
default: \
_Generic \
( \
(y), \
GB_CASES (, GrB, GB_CONCAT ( kind , _apply_BinaryOp2nd,, )), \
default: GB_CONCAT ( GrB,_,kind,_apply_BinaryOp2nd_Scalar) \
) \
)
#define GB_IDXOP(kind,A,y,...) \
_Generic \
( \
(y), \
GB_CASES (, GrB, GB_CONCAT ( kind, _apply_IndexOp,, )), \
default: GB_CONCAT ( GrB, _, kind, _apply_IndexOp_Scalar) \
)
#define GrB_apply(C,Mask,accum,op,...) \
_Generic \
( \
(C), \
GrB_Vector : \
_Generic \
( \
(op), \
GrB_UnaryOp : GrB_Vector_apply , \
GrB_BinaryOp : GB_BIND (Vector, __VA_ARGS__), \
GrB_IndexUnaryOp : GB_IDXOP (Vector, __VA_ARGS__) \
), \
GrB_Matrix : \
_Generic \
( \
(op), \
GrB_UnaryOp : GrB_Matrix_apply , \
GrB_BinaryOp : GB_BIND (Matrix, __VA_ARGS__), \
GrB_IndexUnaryOp : GB_IDXOP (Matrix, __VA_ARGS__) \
) \
) \
(C, Mask, accum, op, __VA_ARGS__)
#endif
//==============================================================================
// GrB_select: matrix and vector selection using an IndexUnaryOp
//==============================================================================
//-------------------------------------------
// vector select using an IndexUnaryOp
//-------------------------------------------
GB_PUBLIC
GrB_Info GrB_Vector_select_Scalar // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_BOOL // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_INT8 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_INT16 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_INT32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_INT64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_UINT8 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_UINT16 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_UINT32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_UINT64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_FP32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_FP64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_select_FC32 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Vector_select_FC64 // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GrB_Vector_select_UDT // w<mask> = accum (w, op(u))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for w and mask
) ;
//-------------------------------------------
// matrix select using an IndexUnaryOp
//-------------------------------------------
GB_PUBLIC
GrB_Info GrB_Matrix_select_Scalar // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_BOOL // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
bool y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_INT8 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_INT16 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_INT32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_INT64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
int64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_UINT8 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint8_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_UINT16 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint16_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_UINT32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_UINT64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
uint64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_FP32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
float y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_FP64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
double y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_select_FC32 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC32_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_select_FC64 // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
GxB_FC64_t y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_select_UDT // C<M>=accum(C,op(A))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_IndexUnaryOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const void *y, // second input: scalar y
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
// GrB_select is a generic method that applies an IndexUnaryOp to
// a matrix or vector, using any type of the scalar y.
// GrB_Vector_select_TYPE (w,m,acc,idxop,u,y,d)
// GrB_Matrix_select_TYPE (C,M,acc,idxop,A,y,d)
#if GxB_STDC_VERSION >= 201112L
#define GrB_select(C,Mask,accum,op,x,y,d) \
_Generic \
( \
(C), \
GrB_Vector : \
_Generic \
( \
(y), \
GB_CASES (, GrB, Vector_select), \
default: GrB_Vector_select_Scalar \
), \
GrB_Matrix : \
_Generic \
( \
(y), \
GB_CASES (, GrB, Matrix_select), \
default: GrB_Matrix_select_Scalar \
) \
) \
(C, Mask, accum, op, x, y, d)
#endif
//==============================================================================
// GxB_select: matrix and vector selection (historical)
//==============================================================================
// GrB_select and with the GrB_IndexUnaryOp operators should be used instead.
GB_PUBLIC
GrB_Info GxB_Vector_select // w<mask> = accum (w, op(u,k))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GxB_SelectOp op, // operator to apply to the entries
const GrB_Vector u, // first input: vector u
const GrB_Scalar Thunk, // optional input for the select operator
const GrB_Descriptor desc // descriptor for w and mask
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_select // C<Mask> = accum (C, op(A,k)) or op(A',k)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GxB_SelectOp op, // operator to apply to the entries
const GrB_Matrix A, // first input: matrix A
const GrB_Scalar Thunk, // optional input for the select operator
const GrB_Descriptor desc // descriptor for C, mask, and A
) ;
#if GxB_STDC_VERSION >= 201112L
#define GxB_select(C,Mask,accum,op,A,Thunk,desc) \
_Generic \
( \
(C), \
GrB_Vector : GxB_Vector_select , \
GrB_Matrix : GxB_Matrix_select \
) \
(C, Mask, accum, op, A, Thunk, desc)
#endif
//==============================================================================
// GrB_reduce: matrix and vector reduction
//==============================================================================
// Reduce the entries in a matrix to a vector, a column vector t such that
// t(i) = sum (A (i,:)), and where "sum" is a commutative and associative
// monoid with an identity value. A can be transposed, which reduces down the
// columns instead of the rows.
// For GrB_Matrix_reduce_BinaryOp, the GrB_BinaryOp op must correspond to a
// known built-in monoid:
//
// operator data-types (all built-in)
// ---------------------- ---------------------------
// MIN, MAX INT*, UINT*, FP*
// TIMES, PLUS INT*, UINT*, FP*, FC*
// ANY INT*, UINT*, FP*, FC*, BOOL
// LOR, LAND, LXOR, EQ BOOL
// BOR, BAND, BXOR, BXNOR UINT*
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_Monoid // w<mask> = accum (w,reduce(A))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_Monoid monoid, // reduce operator for t=reduce(A)
const GrB_Matrix A, // first input: matrix A
const GrB_Descriptor desc // descriptor for w, mask, and A
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_BinaryOp // w<mask> = accum (w,reduce(A))
(
GrB_Vector w, // input/output vector for results
const GrB_Vector mask, // optional mask for w, unused if NULL
const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
const GrB_BinaryOp op, // reduce operator for t=reduce(A)
const GrB_Matrix A, // first input: matrix A
const GrB_Descriptor desc // descriptor for w, mask, and A
) ;
//------------------------------------------------------------------------------
// reduce a vector to a scalar
//------------------------------------------------------------------------------
// Reduce entries in a vector to a scalar, c = accum (c, reduce_to_scalar(u))
GB_PUBLIC
GrB_Info GrB_Vector_reduce_BOOL // c = accum (c, reduce_to_scalar (u))
(
bool *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_INT8 // c = accum (c, reduce_to_scalar (u))
(
int8_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_UINT8 // c = accum (c, reduce_to_scalar (u))
(
uint8_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_INT16 // c = accum (c, reduce_to_scalar (u))
(
int16_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_UINT16 // c = accum (c, reduce_to_scalar (u))
(
uint16_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_INT32 // c = accum (c, reduce_to_scalar (u))
(
int32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_UINT32 // c = accum (c, reduce_to_scalar (u))
(
uint32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_INT64 // c = accum (c, reduce_to_scalar (u))
(
int64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_UINT64 // c = accum (c, reduce_to_scalar (u))
(
uint64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_FP32 // c = accum (c, reduce_to_scalar (u))
(
float *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_FP64 // c = accum (c, reduce_to_scalar (u))
(
double *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_reduce_FC32 // c = accum (c, reduce_to_scalar (u))
(
GxB_FC32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_reduce_FC64 // c = accum (c, reduce_to_scalar (u))
(
GxB_FC64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_UDT // c = accum (c, reduce_to_scalar (u))
(
void *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_Monoid_Scalar // c = accum(c,reduce_to_scalar(u))
(
GrB_Scalar c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Vector_reduce_BinaryOp_Scalar
(
GrB_Scalar c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_BinaryOp op, // binary op to do the reduction
const GrB_Vector u, // vector to reduce
const GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// reduce a matrix to a scalar
//------------------------------------------------------------------------------
// Reduce entries in a matrix to a scalar, c = accum (c, reduce_to_scalar(A))
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_BOOL // c = accum (c, reduce_to_scalar (A))
(
bool *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_INT8 // c = accum (c, reduce_to_scalar (A))
(
int8_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_UINT8 // c = accum (c, reduce_to_scalar (A))
(
uint8_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_INT16 // c = accum (c, reduce_to_scalar (A))
(
int16_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_UINT16 // c = accum (c, reduce_to_scalar (A))
(
uint16_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_INT32 // c = accum (c, reduce_to_scalar (A))
(
int32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_UINT32 // c = accum (c, reduce_to_scalar (A))
(
uint32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_INT64 // c = accum (c, reduce_to_scalar (A))
(
int64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_UINT64 // c = accum (c, reduce_to_scalar (A))
(
uint64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_FP32 // c = accum (c, reduce_to_scalar (A))
(
float *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_FP64 // c = accum (c, reduce_to_scalar (A))
(
double *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_reduce_FC32 // c = accum (c, reduce_to_scalar (A))
(
GxB_FC32_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_reduce_FC64 // c = accum (c, reduce_to_scalar (A))
(
GxB_FC64_t *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_UDT // c = accum (c, reduce_to_scalar (A))
(
void *c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_Monoid_Scalar // c = accum(c,reduce_to_scalar(A))
(
GrB_Scalar c, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_Monoid monoid, // monoid to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_reduce_BinaryOp_Scalar
(
GrB_Scalar S, // result scalar
const GrB_BinaryOp accum, // optional accum for c=accum(c,t)
const GrB_BinaryOp op, // binary op to do the reduction
const GrB_Matrix A, // matrix to reduce
const GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// GrB_reduce: generic matrix/vector reduction to a vector or scalar
//------------------------------------------------------------------------------
// GrB_reduce is a generic function that provides access to all GrB_*reduce*
// functions:
// reduce matrix to vector:
// GrB_Matrix_reduce_Monoid (w,mask,acc,mo,A,d) // w<mask> = acc (w,reduce(A))
// GrB_Matrix_reduce_BinaryOp (w,mask,acc,op,A,d) // w<mask> = acc (w,reduce(A))
// reduce matrix to scalar:
// GrB_Vector_reduce_[SCALAR] (c,acc,monoid,u,d) // c = acc (c,reduce(u))
// GrB_Matrix_reduce_[SCALAR] (c,acc,monoid,A,d) // c = acc (c,reduce(A))
// GrB_Vector_reduce_Monoid_Scalar (s,acc,monoid,u,d) // s = acc (s,reduce(u))
// GrB_Matrix_reduce_Monoid_Scalar (s,acc,monoid,A,d) // s = acc (s,reduce(A))
// GrB_Vector_reduce_BinaryOp_Scalar (s,acc,op,u,d) // s = acc (s,reduce(u))
// GrB_Matrix_reduce_BinaryOp_Scalar (s,acc,op,A,d) // s = acc (s,reduce(A))
#if GxB_STDC_VERSION >= 201112L
#define GB_REDUCE_TO_SCALAR(kind,c,op) \
_Generic \
( \
(c), \
GB_CASES (*, GrB, GB_CONCAT ( kind, _reduce,, )), \
default: \
_Generic \
( \
(op), \
const GrB_BinaryOp : \
GB_CONCAT (GrB,_,kind,_reduce_BinaryOp_Scalar),\
GrB_BinaryOp : \
GB_CONCAT (GrB,_,kind,_reduce_BinaryOp_Scalar),\
default: GB_CONCAT (GrB,_,kind,_reduce_Monoid_Scalar) \
) \
)
#define GrB_reduce(arg1,arg2,arg3,arg4,...) \
_Generic \
( \
(arg4), \
const GrB_Vector : GB_REDUCE_TO_SCALAR (Vector, arg1, arg3), \
GrB_Vector : GB_REDUCE_TO_SCALAR (Vector, arg1, arg3), \
const GrB_Matrix : GB_REDUCE_TO_SCALAR (Matrix, arg1, arg3), \
GrB_Matrix : GB_REDUCE_TO_SCALAR (Matrix, arg1, arg3), \
const GrB_Monoid : GrB_Matrix_reduce_Monoid , \
GrB_Monoid : GrB_Matrix_reduce_Monoid , \
const GrB_BinaryOp : GrB_Matrix_reduce_BinaryOp , \
GrB_BinaryOp : GrB_Matrix_reduce_BinaryOp \
) \
(arg1, arg2, arg3, arg4, __VA_ARGS__)
#endif
//==============================================================================
// GrB_transpose: matrix transpose
//==============================================================================
GB_PUBLIC
GrB_Info GrB_transpose // C<Mask> = accum (C, A')
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Matrix A, // first input: matrix A
const GrB_Descriptor desc // descriptor for C, Mask, and A
) ;
//==============================================================================
// GrB_kronecker: Kronecker product
//==============================================================================
// GxB_kron is historical; use GrB_kronecker instead
GB_PUBLIC
GrB_Info GxB_kron // C<Mask> = accum(C,kron(A,B)) (historical)
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix Mask, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // defines '*' for T=kron(A,B)
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, Mask, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_kronecker_BinaryOp // C<M> = accum (C, kron(A,B))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix M, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_BinaryOp op, // defines '*' for T=kron(A,B)
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, M, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_kronecker_Monoid // C<M> = accum (C, kron(A,B))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix M, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Monoid monoid, // defines '*' for T=kron(A,B)
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, M, A, and B
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_kronecker_Semiring // C<M> = accum (C, kron(A,B))
(
GrB_Matrix C, // input/output matrix for results
const GrB_Matrix M, // optional mask for C, unused if NULL
const GrB_BinaryOp accum, // optional accum for Z=accum(C,T)
const GrB_Semiring semiring, // defines '*' for T=kron(A,B)
const GrB_Matrix A, // first input: matrix A
const GrB_Matrix B, // second input: matrix B
const GrB_Descriptor desc // descriptor for C, M, A, and B
) ;
#if GxB_STDC_VERSION >= 201112L
#define GrB_kronecker(C,Mask,accum,op,A,B,desc) \
_Generic \
( \
(op), \
const GrB_Semiring : GrB_Matrix_kronecker_Semiring , \
GrB_Semiring : GrB_Matrix_kronecker_Semiring , \
const GrB_Monoid : GrB_Matrix_kronecker_Monoid , \
GrB_Monoid : GrB_Matrix_kronecker_Monoid , \
const GrB_BinaryOp : GrB_Matrix_kronecker_BinaryOp , \
GrB_BinaryOp : GrB_Matrix_kronecker_BinaryOp \
) \
(C, Mask, accum, op, A, B, desc)
#endif
//==============================================================================
// GrB_Monoid: built-in monoids
//==============================================================================
GB_PUBLIC GrB_Monoid
//--------------------------------------------------------------------------
// 10 MIN monoids: (not for complex types)
//--------------------------------------------------------------------------
// GxB_MIN monoids, historical, use GrB_MIN_MONOID_* instead:
GxB_MIN_INT8_MONOID, // identity: INT8_MAX terminal: INT8_MIN
GxB_MIN_INT16_MONOID, // identity: INT16_MAX terminal: INT16_MIN
GxB_MIN_INT32_MONOID, // identity: INT32_MAX terminal: INT32_MIN
GxB_MIN_INT64_MONOID, // identity: INT64_MAX terminal: INT32_MIN
GxB_MIN_UINT8_MONOID, // identity: UINT8_MAX terminal: 0
GxB_MIN_UINT16_MONOID, // identity: UINT16_MAX terminal: 0
GxB_MIN_UINT32_MONOID, // identity: UINT32_MAX terminal: 0
GxB_MIN_UINT64_MONOID, // identity: UINT64_MAX terminal: 0
GxB_MIN_FP32_MONOID, // identity: INFINITY terminal: -INFINITY
GxB_MIN_FP64_MONOID, // identity: INFINITY terminal: -INFINITY
// preferred names from the v1.3 spec:
GrB_MIN_MONOID_INT8, // identity: INT8_MAX terminal: INT8_MIN
GrB_MIN_MONOID_INT16, // identity: INT16_MAX terminal: INT16_MIN
GrB_MIN_MONOID_INT32, // identity: INT32_MAX terminal: INT32_MIN
GrB_MIN_MONOID_INT64, // identity: INT64_MAX terminal: INT32_MIN
GrB_MIN_MONOID_UINT8, // identity: UINT8_MAX terminal: 0
GrB_MIN_MONOID_UINT16, // identity: UINT16_MAX terminal: 0
GrB_MIN_MONOID_UINT32, // identity: UINT32_MAX terminal: 0
GrB_MIN_MONOID_UINT64, // identity: UINT64_MAX terminal: 0
GrB_MIN_MONOID_FP32, // identity: INFINITY terminal: -INFINITY
GrB_MIN_MONOID_FP64, // identity: INFINITY terminal: -INFINITY
//--------------------------------------------------------------------------
// 10 MAX monoids:
//--------------------------------------------------------------------------
// GxB_MAX monoids, historical, use GrB_MAX_MONOID_* instead:
GxB_MAX_INT8_MONOID, // identity: INT8_MIN terminal: INT8_MAX
GxB_MAX_INT16_MONOID, // identity: INT16_MIN terminal: INT16_MAX
GxB_MAX_INT32_MONOID, // identity: INT32_MIN terminal: INT32_MAX
GxB_MAX_INT64_MONOID, // identity: INT64_MIN terminal: INT64_MAX
GxB_MAX_UINT8_MONOID, // identity: 0 terminal: UINT8_MAX
GxB_MAX_UINT16_MONOID, // identity: 0 terminal: UINT16_MAX
GxB_MAX_UINT32_MONOID, // identity: 0 terminal: UINT32_MAX
GxB_MAX_UINT64_MONOID, // identity: 0 terminal: UINT64_MAX
GxB_MAX_FP32_MONOID, // identity: -INFINITY terminal: INFINITY
GxB_MAX_FP64_MONOID, // identity: -INFINITY terminal: INFINITY
// preferred names from the v1.3 spec:
GrB_MAX_MONOID_INT8, // identity: INT8_MIN terminal: INT8_MAX
GrB_MAX_MONOID_INT16, // identity: INT16_MIN terminal: INT16_MAX
GrB_MAX_MONOID_INT32, // identity: INT32_MIN terminal: INT32_MAX
GrB_MAX_MONOID_INT64, // identity: INT64_MIN terminal: INT64_MAX
GrB_MAX_MONOID_UINT8, // identity: 0 terminal: UINT8_MAX
GrB_MAX_MONOID_UINT16, // identity: 0 terminal: UINT16_MAX
GrB_MAX_MONOID_UINT32, // identity: 0 terminal: UINT32_MAX
GrB_MAX_MONOID_UINT64, // identity: 0 terminal: UINT64_MAX
GrB_MAX_MONOID_FP32, // identity: -INFINITY terminal: INFINITY
GrB_MAX_MONOID_FP64, // identity: -INFINITY terminal: INFINITY
//--------------------------------------------------------------------------
// 12 PLUS monoids:
//--------------------------------------------------------------------------
// GxB_PLUS monoids, historical, use GrB_PLUS_MONOID_* instead:
GxB_PLUS_INT8_MONOID, // identity: 0
GxB_PLUS_INT16_MONOID, // identity: 0
GxB_PLUS_INT32_MONOID, // identity: 0
GxB_PLUS_INT64_MONOID, // identity: 0
GxB_PLUS_UINT8_MONOID, // identity: 0
GxB_PLUS_UINT16_MONOID, // identity: 0
GxB_PLUS_UINT32_MONOID, // identity: 0
GxB_PLUS_UINT64_MONOID, // identity: 0
GxB_PLUS_FP32_MONOID, // identity: 0
GxB_PLUS_FP64_MONOID, // identity: 0
// preferred names from the v1.3 spec:
GrB_PLUS_MONOID_INT8, // identity: 0
GrB_PLUS_MONOID_INT16, // identity: 0
GrB_PLUS_MONOID_INT32, // identity: 0
GrB_PLUS_MONOID_INT64, // identity: 0
GrB_PLUS_MONOID_UINT8, // identity: 0
GrB_PLUS_MONOID_UINT16, // identity: 0
GrB_PLUS_MONOID_UINT32, // identity: 0
GrB_PLUS_MONOID_UINT64, // identity: 0
GrB_PLUS_MONOID_FP32, // identity: 0
GrB_PLUS_MONOID_FP64, // identity: 0
// complex monoids:
GxB_PLUS_FC32_MONOID, // identity: 0
GxB_PLUS_FC64_MONOID, // identity: 0
//--------------------------------------------------------------------------
// 12 TIMES monoids: identity value is 1, int* and uint* are terminal
//--------------------------------------------------------------------------
// GxB_TIMES monoids, historical, use GrB_TIMES_MONOID_* instead:
GxB_TIMES_INT8_MONOID, // identity: 1 terminal: 0
GxB_TIMES_INT16_MONOID, // identity: 1 terminal: 0
GxB_TIMES_INT32_MONOID, // identity: 1 terminal: 0
GxB_TIMES_INT64_MONOID, // identity: 1 terminal: 0
GxB_TIMES_UINT8_MONOID, // identity: 1 terminal: 0
GxB_TIMES_UINT16_MONOID, // identity: 1 terminal: 0
GxB_TIMES_UINT32_MONOID, // identity: 1 terminal: 0
GxB_TIMES_UINT64_MONOID, // identity: 1 terminal: 0
GxB_TIMES_FP32_MONOID, // identity: 1
GxB_TIMES_FP64_MONOID, // identity: 1
// preferred names from the v1.3 spec:
GrB_TIMES_MONOID_INT8, // identity: 1 terminal: 0
GrB_TIMES_MONOID_INT16, // identity: 1 terminal: 0
GrB_TIMES_MONOID_INT32, // identity: 1 terminal: 0
GrB_TIMES_MONOID_INT64, // identity: 1 terminal: 0
GrB_TIMES_MONOID_UINT8, // identity: 1 terminal: 0
GrB_TIMES_MONOID_UINT16, // identity: 1 terminal: 0
GrB_TIMES_MONOID_UINT32, // identity: 1 terminal: 0
GrB_TIMES_MONOID_UINT64, // identity: 1 terminal: 0
GrB_TIMES_MONOID_FP32, // identity: 1
GrB_TIMES_MONOID_FP64, // identity: 1
// complex monoids:
GxB_TIMES_FC32_MONOID, // identity: 1
GxB_TIMES_FC64_MONOID, // identity: 1
//--------------------------------------------------------------------------
// 13 ANY monoids:
//--------------------------------------------------------------------------
GxB_ANY_BOOL_MONOID, // identity: any value terminal: any value
GxB_ANY_INT8_MONOID, // identity: any value terminal: any value
GxB_ANY_INT16_MONOID, // identity: any value terminal: any value
GxB_ANY_INT32_MONOID, // identity: any value terminal: any value
GxB_ANY_INT64_MONOID, // identity: any value terminal: any value
GxB_ANY_UINT8_MONOID, // identity: any value terminal: any value
GxB_ANY_UINT16_MONOID, // identity: any value terminal: any value
GxB_ANY_UINT32_MONOID, // identity: any value terminal: any value
GxB_ANY_UINT64_MONOID, // identity: any value terminal: any value
GxB_ANY_FP32_MONOID, // identity: any value terminal: any value
GxB_ANY_FP64_MONOID, // identity: any value terminal: any value
GxB_ANY_FC32_MONOID, // identity: any value terminal: any value
GxB_ANY_FC64_MONOID, // identity: any value terminal: any value
//--------------------------------------------------------------------------
// 4 Boolean monoids: (see also the GxB_ANY_BOOL_MONOID above)
//--------------------------------------------------------------------------
// GxB_* boolean monoids, historical, use GrB_* instead:
GxB_LOR_BOOL_MONOID, // identity: false terminal: true
GxB_LAND_BOOL_MONOID, // identity: true terminal: false
GxB_LXOR_BOOL_MONOID, // identity: false
GxB_LXNOR_BOOL_MONOID, // identity: true
GxB_EQ_BOOL_MONOID, // (alternative name for GrB_LXNOR_MONOID_BOOL)
// preferred names from the v1.3 spec:
GrB_LOR_MONOID_BOOL, // identity: false terminal: true
GrB_LAND_MONOID_BOOL, // identity: true terminal: false
GrB_LXOR_MONOID_BOOL, // identity: false
GrB_LXNOR_MONOID_BOOL, // identity: true
//--------------------------------------------------------------------------
// 16 Bitwise-or monoids:
//--------------------------------------------------------------------------
// BOR monoids (bitwise or):
GxB_BOR_UINT8_MONOID, // identity: 0 terminal: 0xFF
GxB_BOR_UINT16_MONOID, // identity: 0 terminal: 0xFFFF
GxB_BOR_UINT32_MONOID, // identity: 0 terminal: 0xFFFFFFFF
GxB_BOR_UINT64_MONOID, // identity: 0 terminal: 0xFFFFFFFFFFFFFFFF
// BAND monoids (bitwise and):
GxB_BAND_UINT8_MONOID, // identity: 0xFF terminal: 0
GxB_BAND_UINT16_MONOID, // identity: 0xFFFF terminal: 0
GxB_BAND_UINT32_MONOID, // identity: 0xFFFFFFFF terminal: 0
GxB_BAND_UINT64_MONOID, // identity: 0xFFFFFFFFFFFFFFFF terminal: 0
// BXOR monoids (bitwise xor):
GxB_BXOR_UINT8_MONOID, // identity: 0
GxB_BXOR_UINT16_MONOID, // identity: 0
GxB_BXOR_UINT32_MONOID, // identity: 0
GxB_BXOR_UINT64_MONOID, // identity: 0
// BXNOR monoids (bitwise xnor):
GxB_BXNOR_UINT8_MONOID, // identity: 0xFF
GxB_BXNOR_UINT16_MONOID, // identity: 0xFFFF
GxB_BXNOR_UINT32_MONOID, // identity: 0xFFFFFFFF
GxB_BXNOR_UINT64_MONOID ; // identity: 0xFFFFFFFFFFFFFFFF
//==============================================================================
// GrB_Semiring: built-in semirings
//==============================================================================
// Using built-in types and operators, SuiteSparse:GraphBLAS provides
// 1553 pre-defined, built-in semirings:
// 1000 semirings with a multiply operator TxT -> T where T is non-Boolean,
// from the complete cross product of:
// 5 monoids: MIN, MAX, PLUS, TIMES, ANY
// 20 multiply operators:
// FIRST, SECOND, PAIR (=ONEB), MIN, MAX, PLUS, MINUS, TIMES, DIV,
// RDIV, RMINUS
// ISEQ, ISNE, ISGT, ISLT, ISGE, ISLE,
// LOR, LAND, LXOR
// 10 non-Boolean real types, T
//
// Note that min_pair, max_pair, times_pair are all identical to any_pair.
// These 30 semirings are named below, but are internally remapped to
// their corresponding any_pair semiring.
// 300 semirings with a comparator TxT -> bool, where T is
// non-Boolean, from the complete cross product of:
// 5 Boolean monoids: LAND, LOR, LXOR, EQ (=LXNOR), ANY
// 6 multiply operators: EQ, NE, GT, LT, GE, LE
// 10 non-Boolean real types, T
// 55 semirings with purely Boolean types, bool x bool -> bool, from the
// complete cross product of:
// 5 Boolean monoids LAND, LOR, LXOR, EQ (=LXNOR), ANY
// 11 multiply operators:
// FIRST, SECOND, LOR, LAND, LXOR, EQ (=LXNOR), GT, LT, GE, LE,
// PAIR (=ONEB)
//
// Note that lor_pair, land_pair, and eq_pair are all identical to
// any_pair. These 3 semirings are named below, but are internally
// remapped to any_pair_bool semiring.
// 54 complex semirings: TxT -> T where T is float complex or double complex:
// 3 complex monoids: PLUS, TIMES, ANY
// 9 complex multiply operators:
// FIRST, SECOND, PAIR (=ONEB), PLUS, MINUS, TIMES, DIV, RDIV, RMINUS
// 2 complex types
//
// Note that times_pair is identical to any_pair.
// These 2 semirings are named below, but are internally remapped to
// their corresponding any_pair semiring.
// 64 bitwise semirings: TxT -> T where T is an unsigned integer:
// 4 bitwise monoids: BOR, BAND, BXOR, BXNOR
// 4 bitwise multiply operators: BOR, BAND, BXOR, BXNOR
// 4 unsigned integer types: UINT8, UINT16, UINT32, UINT64
// 80 positional semirings: XxX -> T where T is int64 or int32, and the type of
// X is ignored:
// 5 monoids: MIN, MAX, PLUS, TIMES, ANY
// 8 multiply operators:
// FIRSTI, FIRSTI1, FIRSTJ, FIRSTJ1,
// SECONDI, SECONDI1, SECONDJ, SECONDJ1
// 2 types: int32, int64
// The ANY operator is also valid to use as a multiplicative operator in a
// semiring, but serves no purpose in that case. The ANY operator is meant as
// a fast additive operator for a monoid, that terminates, or short-circuits,
// as soon as any value is found. A valid user semiring can be constructed
// with ANY as the multiply operator, but they are not predefined below.
// Likewise, additional built-in operators can be used as multiplicative
// operators for floating-point semirings (POW, ATAN2, HYPOT, ...) and many
// more semirings can be constructed from bitwise monoids and many integer
// binary (non-bitwise) multiplicative operators, but these are not
// pre-defined.
// In the names below, each semiring has a name of the form GxB_add_mult_T
// where add is the additive monoid, mult is the multiply operator, and T is
// the type. The type T is always the type of x and y for the z=mult(x,y)
// operator. The monoid's three types and the ztype of the mult operator are
// always the same. This is the type T for the first set, and Boolean for
// the second and third sets of semirngs.
// 1553 = 1000 + 300 + 55 + 54 + 64 + 80 semirings are named below, but 35 = 30
// + 3 + 2 are identical to the corresponding any_pair semirings of the same
// type. For positional semirings, the mulitiply ops FIRSTJ and SECONDI are
// identical, as are FIRSTJ1 and SECONDI1. These semirings still appear as
// predefined, for convenience.
GB_PUBLIC GrB_Semiring
//------------------------------------------------------------------------------
// 1000 non-Boolean semirings where all types are the same, given by suffix _T
//------------------------------------------------------------------------------
// semirings with multiply op: z = FIRST (x,y), all types x,y,z the same:
GxB_MIN_FIRST_INT8 , GxB_MAX_FIRST_INT8 , GxB_PLUS_FIRST_INT8 , GxB_TIMES_FIRST_INT8 , GxB_ANY_FIRST_INT8 ,
GxB_MIN_FIRST_INT16 , GxB_MAX_FIRST_INT16 , GxB_PLUS_FIRST_INT16 , GxB_TIMES_FIRST_INT16 , GxB_ANY_FIRST_INT16 ,
GxB_MIN_FIRST_INT32 , GxB_MAX_FIRST_INT32 , GxB_PLUS_FIRST_INT32 , GxB_TIMES_FIRST_INT32 , GxB_ANY_FIRST_INT32 ,
GxB_MIN_FIRST_INT64 , GxB_MAX_FIRST_INT64 , GxB_PLUS_FIRST_INT64 , GxB_TIMES_FIRST_INT64 , GxB_ANY_FIRST_INT64 ,
GxB_MIN_FIRST_UINT8 , GxB_MAX_FIRST_UINT8 , GxB_PLUS_FIRST_UINT8 , GxB_TIMES_FIRST_UINT8 , GxB_ANY_FIRST_UINT8 ,
GxB_MIN_FIRST_UINT16 , GxB_MAX_FIRST_UINT16 , GxB_PLUS_FIRST_UINT16 , GxB_TIMES_FIRST_UINT16 , GxB_ANY_FIRST_UINT16 ,
GxB_MIN_FIRST_UINT32 , GxB_MAX_FIRST_UINT32 , GxB_PLUS_FIRST_UINT32 , GxB_TIMES_FIRST_UINT32 , GxB_ANY_FIRST_UINT32 ,
GxB_MIN_FIRST_UINT64 , GxB_MAX_FIRST_UINT64 , GxB_PLUS_FIRST_UINT64 , GxB_TIMES_FIRST_UINT64 , GxB_ANY_FIRST_UINT64 ,
GxB_MIN_FIRST_FP32 , GxB_MAX_FIRST_FP32 , GxB_PLUS_FIRST_FP32 , GxB_TIMES_FIRST_FP32 , GxB_ANY_FIRST_FP32 ,
GxB_MIN_FIRST_FP64 , GxB_MAX_FIRST_FP64 , GxB_PLUS_FIRST_FP64 , GxB_TIMES_FIRST_FP64 , GxB_ANY_FIRST_FP64 ,
// semirings with multiply op: z = SECOND (x,y), all types x,y,z the same:
GxB_MIN_SECOND_INT8 , GxB_MAX_SECOND_INT8 , GxB_PLUS_SECOND_INT8 , GxB_TIMES_SECOND_INT8 , GxB_ANY_SECOND_INT8 ,
GxB_MIN_SECOND_INT16 , GxB_MAX_SECOND_INT16 , GxB_PLUS_SECOND_INT16 , GxB_TIMES_SECOND_INT16 , GxB_ANY_SECOND_INT16 ,
GxB_MIN_SECOND_INT32 , GxB_MAX_SECOND_INT32 , GxB_PLUS_SECOND_INT32 , GxB_TIMES_SECOND_INT32 , GxB_ANY_SECOND_INT32 ,
GxB_MIN_SECOND_INT64 , GxB_MAX_SECOND_INT64 , GxB_PLUS_SECOND_INT64 , GxB_TIMES_SECOND_INT64 , GxB_ANY_SECOND_INT64 ,
GxB_MIN_SECOND_UINT8 , GxB_MAX_SECOND_UINT8 , GxB_PLUS_SECOND_UINT8 , GxB_TIMES_SECOND_UINT8 , GxB_ANY_SECOND_UINT8 ,
GxB_MIN_SECOND_UINT16 , GxB_MAX_SECOND_UINT16 , GxB_PLUS_SECOND_UINT16 , GxB_TIMES_SECOND_UINT16, GxB_ANY_SECOND_UINT16 ,
GxB_MIN_SECOND_UINT32 , GxB_MAX_SECOND_UINT32 , GxB_PLUS_SECOND_UINT32 , GxB_TIMES_SECOND_UINT32, GxB_ANY_SECOND_UINT32 ,
GxB_MIN_SECOND_UINT64 , GxB_MAX_SECOND_UINT64 , GxB_PLUS_SECOND_UINT64 , GxB_TIMES_SECOND_UINT64, GxB_ANY_SECOND_UINT64 ,
GxB_MIN_SECOND_FP32 , GxB_MAX_SECOND_FP32 , GxB_PLUS_SECOND_FP32 , GxB_TIMES_SECOND_FP32 , GxB_ANY_SECOND_FP32 ,
GxB_MIN_SECOND_FP64 , GxB_MAX_SECOND_FP64 , GxB_PLUS_SECOND_FP64 , GxB_TIMES_SECOND_FP64 , GxB_ANY_SECOND_FP64 ,
// semirings with multiply op: z = PAIR (x,y), all types x,y,z the same:
// (note that min_pair, max_pair, times_pair are all identical to any_pair, and are marked below)
GxB_MIN_PAIR_INT8 /**/, GxB_MAX_PAIR_INT8 /**/, GxB_PLUS_PAIR_INT8 , GxB_TIMES_PAIR_INT8 /**/, GxB_ANY_PAIR_INT8 ,
GxB_MIN_PAIR_INT16 /**/, GxB_MAX_PAIR_INT16 /**/, GxB_PLUS_PAIR_INT16 , GxB_TIMES_PAIR_INT16 /**/, GxB_ANY_PAIR_INT16 ,
GxB_MIN_PAIR_INT32 /**/, GxB_MAX_PAIR_INT32 /**/, GxB_PLUS_PAIR_INT32 , GxB_TIMES_PAIR_INT32 /**/, GxB_ANY_PAIR_INT32 ,
GxB_MIN_PAIR_INT64 /**/, GxB_MAX_PAIR_INT64 /**/, GxB_PLUS_PAIR_INT64 , GxB_TIMES_PAIR_INT64 /**/, GxB_ANY_PAIR_INT64 ,
GxB_MIN_PAIR_UINT8 /**/, GxB_MAX_PAIR_UINT8 /**/, GxB_PLUS_PAIR_UINT8 , GxB_TIMES_PAIR_UINT8 /**/, GxB_ANY_PAIR_UINT8 ,
GxB_MIN_PAIR_UINT16/**/, GxB_MAX_PAIR_UINT16/**/, GxB_PLUS_PAIR_UINT16 , GxB_TIMES_PAIR_UINT16/**/, GxB_ANY_PAIR_UINT16 ,
GxB_MIN_PAIR_UINT32/**/, GxB_MAX_PAIR_UINT32/**/, GxB_PLUS_PAIR_UINT32 , GxB_TIMES_PAIR_UINT32/**/, GxB_ANY_PAIR_UINT32 ,
GxB_MIN_PAIR_UINT64/**/, GxB_MAX_PAIR_UINT64/**/, GxB_PLUS_PAIR_UINT64 , GxB_TIMES_PAIR_UINT64/**/, GxB_ANY_PAIR_UINT64 ,
GxB_MIN_PAIR_FP32 /**/, GxB_MAX_PAIR_FP32 /**/, GxB_PLUS_PAIR_FP32 , GxB_TIMES_PAIR_FP32 /**/, GxB_ANY_PAIR_FP32 ,
GxB_MIN_PAIR_FP64 /**/, GxB_MAX_PAIR_FP64 /**/, GxB_PLUS_PAIR_FP64 , GxB_TIMES_PAIR_FP64 /**/, GxB_ANY_PAIR_FP64 ,
// semirings with multiply op: z = MIN (x,y), all types x,y,z the same:
GxB_MIN_MIN_INT8 , GxB_MAX_MIN_INT8 , GxB_PLUS_MIN_INT8 , GxB_TIMES_MIN_INT8 , GxB_ANY_MIN_INT8 ,
GxB_MIN_MIN_INT16 , GxB_MAX_MIN_INT16 , GxB_PLUS_MIN_INT16 , GxB_TIMES_MIN_INT16 , GxB_ANY_MIN_INT16 ,
GxB_MIN_MIN_INT32 , GxB_MAX_MIN_INT32 , GxB_PLUS_MIN_INT32 , GxB_TIMES_MIN_INT32 , GxB_ANY_MIN_INT32 ,
GxB_MIN_MIN_INT64 , GxB_MAX_MIN_INT64 , GxB_PLUS_MIN_INT64 , GxB_TIMES_MIN_INT64 , GxB_ANY_MIN_INT64 ,
GxB_MIN_MIN_UINT8 , GxB_MAX_MIN_UINT8 , GxB_PLUS_MIN_UINT8 , GxB_TIMES_MIN_UINT8 , GxB_ANY_MIN_UINT8 ,
GxB_MIN_MIN_UINT16 , GxB_MAX_MIN_UINT16 , GxB_PLUS_MIN_UINT16 , GxB_TIMES_MIN_UINT16 , GxB_ANY_MIN_UINT16 ,
GxB_MIN_MIN_UINT32 , GxB_MAX_MIN_UINT32 , GxB_PLUS_MIN_UINT32 , GxB_TIMES_MIN_UINT32 , GxB_ANY_MIN_UINT32 ,
GxB_MIN_MIN_UINT64 , GxB_MAX_MIN_UINT64 , GxB_PLUS_MIN_UINT64 , GxB_TIMES_MIN_UINT64 , GxB_ANY_MIN_UINT64 ,
GxB_MIN_MIN_FP32 , GxB_MAX_MIN_FP32 , GxB_PLUS_MIN_FP32 , GxB_TIMES_MIN_FP32 , GxB_ANY_MIN_FP32 ,
GxB_MIN_MIN_FP64 , GxB_MAX_MIN_FP64 , GxB_PLUS_MIN_FP64 , GxB_TIMES_MIN_FP64 , GxB_ANY_MIN_FP64 ,
// semirings with multiply op: z = MAX (x,y), all types x,y,z the same:
GxB_MIN_MAX_INT8 , GxB_MAX_MAX_INT8 , GxB_PLUS_MAX_INT8 , GxB_TIMES_MAX_INT8 , GxB_ANY_MAX_INT8 ,
GxB_MIN_MAX_INT16 , GxB_MAX_MAX_INT16 , GxB_PLUS_MAX_INT16 , GxB_TIMES_MAX_INT16 , GxB_ANY_MAX_INT16 ,
GxB_MIN_MAX_INT32 , GxB_MAX_MAX_INT32 , GxB_PLUS_MAX_INT32 , GxB_TIMES_MAX_INT32 , GxB_ANY_MAX_INT32 ,
GxB_MIN_MAX_INT64 , GxB_MAX_MAX_INT64 , GxB_PLUS_MAX_INT64 , GxB_TIMES_MAX_INT64 , GxB_ANY_MAX_INT64 ,
GxB_MIN_MAX_UINT8 , GxB_MAX_MAX_UINT8 , GxB_PLUS_MAX_UINT8 , GxB_TIMES_MAX_UINT8 , GxB_ANY_MAX_UINT8 ,
GxB_MIN_MAX_UINT16 , GxB_MAX_MAX_UINT16 , GxB_PLUS_MAX_UINT16 , GxB_TIMES_MAX_UINT16 , GxB_ANY_MAX_UINT16 ,
GxB_MIN_MAX_UINT32 , GxB_MAX_MAX_UINT32 , GxB_PLUS_MAX_UINT32 , GxB_TIMES_MAX_UINT32 , GxB_ANY_MAX_UINT32 ,
GxB_MIN_MAX_UINT64 , GxB_MAX_MAX_UINT64 , GxB_PLUS_MAX_UINT64 , GxB_TIMES_MAX_UINT64 , GxB_ANY_MAX_UINT64 ,
GxB_MIN_MAX_FP32 , GxB_MAX_MAX_FP32 , GxB_PLUS_MAX_FP32 , GxB_TIMES_MAX_FP32 , GxB_ANY_MAX_FP32 ,
GxB_MIN_MAX_FP64 , GxB_MAX_MAX_FP64 , GxB_PLUS_MAX_FP64 , GxB_TIMES_MAX_FP64 , GxB_ANY_MAX_FP64 ,
// semirings with multiply op: z = PLUS (x,y), all types x,y,z the same:
GxB_MIN_PLUS_INT8 , GxB_MAX_PLUS_INT8 , GxB_PLUS_PLUS_INT8 , GxB_TIMES_PLUS_INT8 , GxB_ANY_PLUS_INT8 ,
GxB_MIN_PLUS_INT16 , GxB_MAX_PLUS_INT16 , GxB_PLUS_PLUS_INT16 , GxB_TIMES_PLUS_INT16 , GxB_ANY_PLUS_INT16 ,
GxB_MIN_PLUS_INT32 , GxB_MAX_PLUS_INT32 , GxB_PLUS_PLUS_INT32 , GxB_TIMES_PLUS_INT32 , GxB_ANY_PLUS_INT32 ,
GxB_MIN_PLUS_INT64 , GxB_MAX_PLUS_INT64 , GxB_PLUS_PLUS_INT64 , GxB_TIMES_PLUS_INT64 , GxB_ANY_PLUS_INT64 ,
GxB_MIN_PLUS_UINT8 , GxB_MAX_PLUS_UINT8 , GxB_PLUS_PLUS_UINT8 , GxB_TIMES_PLUS_UINT8 , GxB_ANY_PLUS_UINT8 ,
GxB_MIN_PLUS_UINT16 , GxB_MAX_PLUS_UINT16 , GxB_PLUS_PLUS_UINT16 , GxB_TIMES_PLUS_UINT16 , GxB_ANY_PLUS_UINT16 ,
GxB_MIN_PLUS_UINT32 , GxB_MAX_PLUS_UINT32 , GxB_PLUS_PLUS_UINT32 , GxB_TIMES_PLUS_UINT32 , GxB_ANY_PLUS_UINT32 ,
GxB_MIN_PLUS_UINT64 , GxB_MAX_PLUS_UINT64 , GxB_PLUS_PLUS_UINT64 , GxB_TIMES_PLUS_UINT64 , GxB_ANY_PLUS_UINT64 ,
GxB_MIN_PLUS_FP32 , GxB_MAX_PLUS_FP32 , GxB_PLUS_PLUS_FP32 , GxB_TIMES_PLUS_FP32 , GxB_ANY_PLUS_FP32 ,
GxB_MIN_PLUS_FP64 , GxB_MAX_PLUS_FP64 , GxB_PLUS_PLUS_FP64 , GxB_TIMES_PLUS_FP64 , GxB_ANY_PLUS_FP64 ,
// semirings with multiply op: z = MINUS (x,y), all types x,y,z the same:
GxB_MIN_MINUS_INT8 , GxB_MAX_MINUS_INT8 , GxB_PLUS_MINUS_INT8 , GxB_TIMES_MINUS_INT8 , GxB_ANY_MINUS_INT8 ,
GxB_MIN_MINUS_INT16 , GxB_MAX_MINUS_INT16 , GxB_PLUS_MINUS_INT16 , GxB_TIMES_MINUS_INT16 , GxB_ANY_MINUS_INT16 ,
GxB_MIN_MINUS_INT32 , GxB_MAX_MINUS_INT32 , GxB_PLUS_MINUS_INT32 , GxB_TIMES_MINUS_INT32 , GxB_ANY_MINUS_INT32 ,
GxB_MIN_MINUS_INT64 , GxB_MAX_MINUS_INT64 , GxB_PLUS_MINUS_INT64 , GxB_TIMES_MINUS_INT64 , GxB_ANY_MINUS_INT64 ,
GxB_MIN_MINUS_UINT8 , GxB_MAX_MINUS_UINT8 , GxB_PLUS_MINUS_UINT8 , GxB_TIMES_MINUS_UINT8 , GxB_ANY_MINUS_UINT8 ,
GxB_MIN_MINUS_UINT16 , GxB_MAX_MINUS_UINT16 , GxB_PLUS_MINUS_UINT16 , GxB_TIMES_MINUS_UINT16 , GxB_ANY_MINUS_UINT16 ,
GxB_MIN_MINUS_UINT32 , GxB_MAX_MINUS_UINT32 , GxB_PLUS_MINUS_UINT32 , GxB_TIMES_MINUS_UINT32 , GxB_ANY_MINUS_UINT32 ,
GxB_MIN_MINUS_UINT64 , GxB_MAX_MINUS_UINT64 , GxB_PLUS_MINUS_UINT64 , GxB_TIMES_MINUS_UINT64 , GxB_ANY_MINUS_UINT64 ,
GxB_MIN_MINUS_FP32 , GxB_MAX_MINUS_FP32 , GxB_PLUS_MINUS_FP32 , GxB_TIMES_MINUS_FP32 , GxB_ANY_MINUS_FP32 ,
GxB_MIN_MINUS_FP64 , GxB_MAX_MINUS_FP64 , GxB_PLUS_MINUS_FP64 , GxB_TIMES_MINUS_FP64 , GxB_ANY_MINUS_FP64 ,
// semirings with multiply op: z = TIMES (x,y), all types x,y,z the same:
GxB_MIN_TIMES_INT8 , GxB_MAX_TIMES_INT8 , GxB_PLUS_TIMES_INT8 , GxB_TIMES_TIMES_INT8 , GxB_ANY_TIMES_INT8 ,
GxB_MIN_TIMES_INT16 , GxB_MAX_TIMES_INT16 , GxB_PLUS_TIMES_INT16 , GxB_TIMES_TIMES_INT16 , GxB_ANY_TIMES_INT16 ,
GxB_MIN_TIMES_INT32 , GxB_MAX_TIMES_INT32 , GxB_PLUS_TIMES_INT32 , GxB_TIMES_TIMES_INT32 , GxB_ANY_TIMES_INT32 ,
GxB_MIN_TIMES_INT64 , GxB_MAX_TIMES_INT64 , GxB_PLUS_TIMES_INT64 , GxB_TIMES_TIMES_INT64 , GxB_ANY_TIMES_INT64 ,
GxB_MIN_TIMES_UINT8 , GxB_MAX_TIMES_UINT8 , GxB_PLUS_TIMES_UINT8 , GxB_TIMES_TIMES_UINT8 , GxB_ANY_TIMES_UINT8 ,
GxB_MIN_TIMES_UINT16 , GxB_MAX_TIMES_UINT16 , GxB_PLUS_TIMES_UINT16 , GxB_TIMES_TIMES_UINT16 , GxB_ANY_TIMES_UINT16 ,
GxB_MIN_TIMES_UINT32 , GxB_MAX_TIMES_UINT32 , GxB_PLUS_TIMES_UINT32 , GxB_TIMES_TIMES_UINT32 , GxB_ANY_TIMES_UINT32 ,
GxB_MIN_TIMES_UINT64 , GxB_MAX_TIMES_UINT64 , GxB_PLUS_TIMES_UINT64 , GxB_TIMES_TIMES_UINT64 , GxB_ANY_TIMES_UINT64 ,
GxB_MIN_TIMES_FP32 , GxB_MAX_TIMES_FP32 , GxB_PLUS_TIMES_FP32 , GxB_TIMES_TIMES_FP32 , GxB_ANY_TIMES_FP32 ,
GxB_MIN_TIMES_FP64 , GxB_MAX_TIMES_FP64 , GxB_PLUS_TIMES_FP64 , GxB_TIMES_TIMES_FP64 , GxB_ANY_TIMES_FP64 ,
// semirings with multiply op: z = DIV (x,y), all types x,y,z the same:
GxB_MIN_DIV_INT8 , GxB_MAX_DIV_INT8 , GxB_PLUS_DIV_INT8 , GxB_TIMES_DIV_INT8 , GxB_ANY_DIV_INT8 ,
GxB_MIN_DIV_INT16 , GxB_MAX_DIV_INT16 , GxB_PLUS_DIV_INT16 , GxB_TIMES_DIV_INT16 , GxB_ANY_DIV_INT16 ,
GxB_MIN_DIV_INT32 , GxB_MAX_DIV_INT32 , GxB_PLUS_DIV_INT32 , GxB_TIMES_DIV_INT32 , GxB_ANY_DIV_INT32 ,
GxB_MIN_DIV_INT64 , GxB_MAX_DIV_INT64 , GxB_PLUS_DIV_INT64 , GxB_TIMES_DIV_INT64 , GxB_ANY_DIV_INT64 ,
GxB_MIN_DIV_UINT8 , GxB_MAX_DIV_UINT8 , GxB_PLUS_DIV_UINT8 , GxB_TIMES_DIV_UINT8 , GxB_ANY_DIV_UINT8 ,
GxB_MIN_DIV_UINT16 , GxB_MAX_DIV_UINT16 , GxB_PLUS_DIV_UINT16 , GxB_TIMES_DIV_UINT16 , GxB_ANY_DIV_UINT16 ,
GxB_MIN_DIV_UINT32 , GxB_MAX_DIV_UINT32 , GxB_PLUS_DIV_UINT32 , GxB_TIMES_DIV_UINT32 , GxB_ANY_DIV_UINT32 ,
GxB_MIN_DIV_UINT64 , GxB_MAX_DIV_UINT64 , GxB_PLUS_DIV_UINT64 , GxB_TIMES_DIV_UINT64 , GxB_ANY_DIV_UINT64 ,
GxB_MIN_DIV_FP32 , GxB_MAX_DIV_FP32 , GxB_PLUS_DIV_FP32 , GxB_TIMES_DIV_FP32 , GxB_ANY_DIV_FP32 ,
GxB_MIN_DIV_FP64 , GxB_MAX_DIV_FP64 , GxB_PLUS_DIV_FP64 , GxB_TIMES_DIV_FP64 , GxB_ANY_DIV_FP64 ,
// semirings with multiply op: z = RDIV (x,y), all types x,y,z the same:
GxB_MIN_RDIV_INT8 , GxB_MAX_RDIV_INT8 , GxB_PLUS_RDIV_INT8 , GxB_TIMES_RDIV_INT8 , GxB_ANY_RDIV_INT8 ,
GxB_MIN_RDIV_INT16 , GxB_MAX_RDIV_INT16 , GxB_PLUS_RDIV_INT16 , GxB_TIMES_RDIV_INT16 , GxB_ANY_RDIV_INT16 ,
GxB_MIN_RDIV_INT32 , GxB_MAX_RDIV_INT32 , GxB_PLUS_RDIV_INT32 , GxB_TIMES_RDIV_INT32 , GxB_ANY_RDIV_INT32 ,
GxB_MIN_RDIV_INT64 , GxB_MAX_RDIV_INT64 , GxB_PLUS_RDIV_INT64 , GxB_TIMES_RDIV_INT64 , GxB_ANY_RDIV_INT64 ,
GxB_MIN_RDIV_UINT8 , GxB_MAX_RDIV_UINT8 , GxB_PLUS_RDIV_UINT8 , GxB_TIMES_RDIV_UINT8 , GxB_ANY_RDIV_UINT8 ,
GxB_MIN_RDIV_UINT16 , GxB_MAX_RDIV_UINT16 , GxB_PLUS_RDIV_UINT16 , GxB_TIMES_RDIV_UINT16 , GxB_ANY_RDIV_UINT16 ,
GxB_MIN_RDIV_UINT32 , GxB_MAX_RDIV_UINT32 , GxB_PLUS_RDIV_UINT32 , GxB_TIMES_RDIV_UINT32 , GxB_ANY_RDIV_UINT32 ,
GxB_MIN_RDIV_UINT64 , GxB_MAX_RDIV_UINT64 , GxB_PLUS_RDIV_UINT64 , GxB_TIMES_RDIV_UINT64 , GxB_ANY_RDIV_UINT64 ,
GxB_MIN_RDIV_FP32 , GxB_MAX_RDIV_FP32 , GxB_PLUS_RDIV_FP32 , GxB_TIMES_RDIV_FP32 , GxB_ANY_RDIV_FP32 ,
GxB_MIN_RDIV_FP64 , GxB_MAX_RDIV_FP64 , GxB_PLUS_RDIV_FP64 , GxB_TIMES_RDIV_FP64 , GxB_ANY_RDIV_FP64 ,
// semirings with multiply op: z = RMINUS (x,y), all types x,y,z the same:
GxB_MIN_RMINUS_INT8 , GxB_MAX_RMINUS_INT8 , GxB_PLUS_RMINUS_INT8 , GxB_TIMES_RMINUS_INT8 , GxB_ANY_RMINUS_INT8 ,
GxB_MIN_RMINUS_INT16 , GxB_MAX_RMINUS_INT16 , GxB_PLUS_RMINUS_INT16 , GxB_TIMES_RMINUS_INT16 , GxB_ANY_RMINUS_INT16 ,
GxB_MIN_RMINUS_INT32 , GxB_MAX_RMINUS_INT32 , GxB_PLUS_RMINUS_INT32 , GxB_TIMES_RMINUS_INT32 , GxB_ANY_RMINUS_INT32 ,
GxB_MIN_RMINUS_INT64 , GxB_MAX_RMINUS_INT64 , GxB_PLUS_RMINUS_INT64 , GxB_TIMES_RMINUS_INT64 , GxB_ANY_RMINUS_INT64 ,
GxB_MIN_RMINUS_UINT8 , GxB_MAX_RMINUS_UINT8 , GxB_PLUS_RMINUS_UINT8 , GxB_TIMES_RMINUS_UINT8 , GxB_ANY_RMINUS_UINT8 ,
GxB_MIN_RMINUS_UINT16 , GxB_MAX_RMINUS_UINT16 , GxB_PLUS_RMINUS_UINT16 , GxB_TIMES_RMINUS_UINT16, GxB_ANY_RMINUS_UINT16 ,
GxB_MIN_RMINUS_UINT32 , GxB_MAX_RMINUS_UINT32 , GxB_PLUS_RMINUS_UINT32 , GxB_TIMES_RMINUS_UINT32, GxB_ANY_RMINUS_UINT32 ,
GxB_MIN_RMINUS_UINT64 , GxB_MAX_RMINUS_UINT64 , GxB_PLUS_RMINUS_UINT64 , GxB_TIMES_RMINUS_UINT64, GxB_ANY_RMINUS_UINT64 ,
GxB_MIN_RMINUS_FP32 , GxB_MAX_RMINUS_FP32 , GxB_PLUS_RMINUS_FP32 , GxB_TIMES_RMINUS_FP32 , GxB_ANY_RMINUS_FP32 ,
GxB_MIN_RMINUS_FP64 , GxB_MAX_RMINUS_FP64 , GxB_PLUS_RMINUS_FP64 , GxB_TIMES_RMINUS_FP64 , GxB_ANY_RMINUS_FP64 ,
// semirings with multiply op: z = ISEQ (x,y), all types x,y,z the same:
GxB_MIN_ISEQ_INT8 , GxB_MAX_ISEQ_INT8 , GxB_PLUS_ISEQ_INT8 , GxB_TIMES_ISEQ_INT8 , GxB_ANY_ISEQ_INT8 ,
GxB_MIN_ISEQ_INT16 , GxB_MAX_ISEQ_INT16 , GxB_PLUS_ISEQ_INT16 , GxB_TIMES_ISEQ_INT16 , GxB_ANY_ISEQ_INT16 ,
GxB_MIN_ISEQ_INT32 , GxB_MAX_ISEQ_INT32 , GxB_PLUS_ISEQ_INT32 , GxB_TIMES_ISEQ_INT32 , GxB_ANY_ISEQ_INT32 ,
GxB_MIN_ISEQ_INT64 , GxB_MAX_ISEQ_INT64 , GxB_PLUS_ISEQ_INT64 , GxB_TIMES_ISEQ_INT64 , GxB_ANY_ISEQ_INT64 ,
GxB_MIN_ISEQ_UINT8 , GxB_MAX_ISEQ_UINT8 , GxB_PLUS_ISEQ_UINT8 , GxB_TIMES_ISEQ_UINT8 , GxB_ANY_ISEQ_UINT8 ,
GxB_MIN_ISEQ_UINT16 , GxB_MAX_ISEQ_UINT16 , GxB_PLUS_ISEQ_UINT16 , GxB_TIMES_ISEQ_UINT16 , GxB_ANY_ISEQ_UINT16 ,
GxB_MIN_ISEQ_UINT32 , GxB_MAX_ISEQ_UINT32 , GxB_PLUS_ISEQ_UINT32 , GxB_TIMES_ISEQ_UINT32 , GxB_ANY_ISEQ_UINT32 ,
GxB_MIN_ISEQ_UINT64 , GxB_MAX_ISEQ_UINT64 , GxB_PLUS_ISEQ_UINT64 , GxB_TIMES_ISEQ_UINT64 , GxB_ANY_ISEQ_UINT64 ,
GxB_MIN_ISEQ_FP32 , GxB_MAX_ISEQ_FP32 , GxB_PLUS_ISEQ_FP32 , GxB_TIMES_ISEQ_FP32 , GxB_ANY_ISEQ_FP32 ,
GxB_MIN_ISEQ_FP64 , GxB_MAX_ISEQ_FP64 , GxB_PLUS_ISEQ_FP64 , GxB_TIMES_ISEQ_FP64 , GxB_ANY_ISEQ_FP64 ,
// semirings with multiply op: z = ISNE (x,y), all types x,y,z the same:
GxB_MIN_ISNE_INT8 , GxB_MAX_ISNE_INT8 , GxB_PLUS_ISNE_INT8 , GxB_TIMES_ISNE_INT8 , GxB_ANY_ISNE_INT8 ,
GxB_MIN_ISNE_INT16 , GxB_MAX_ISNE_INT16 , GxB_PLUS_ISNE_INT16 , GxB_TIMES_ISNE_INT16 , GxB_ANY_ISNE_INT16 ,
GxB_MIN_ISNE_INT32 , GxB_MAX_ISNE_INT32 , GxB_PLUS_ISNE_INT32 , GxB_TIMES_ISNE_INT32 , GxB_ANY_ISNE_INT32 ,
GxB_MIN_ISNE_INT64 , GxB_MAX_ISNE_INT64 , GxB_PLUS_ISNE_INT64 , GxB_TIMES_ISNE_INT64 , GxB_ANY_ISNE_INT64 ,
GxB_MIN_ISNE_UINT8 , GxB_MAX_ISNE_UINT8 , GxB_PLUS_ISNE_UINT8 , GxB_TIMES_ISNE_UINT8 , GxB_ANY_ISNE_UINT8 ,
GxB_MIN_ISNE_UINT16 , GxB_MAX_ISNE_UINT16 , GxB_PLUS_ISNE_UINT16 , GxB_TIMES_ISNE_UINT16 , GxB_ANY_ISNE_UINT16 ,
GxB_MIN_ISNE_UINT32 , GxB_MAX_ISNE_UINT32 , GxB_PLUS_ISNE_UINT32 , GxB_TIMES_ISNE_UINT32 , GxB_ANY_ISNE_UINT32 ,
GxB_MIN_ISNE_UINT64 , GxB_MAX_ISNE_UINT64 , GxB_PLUS_ISNE_UINT64 , GxB_TIMES_ISNE_UINT64 , GxB_ANY_ISNE_UINT64 ,
GxB_MIN_ISNE_FP32 , GxB_MAX_ISNE_FP32 , GxB_PLUS_ISNE_FP32 , GxB_TIMES_ISNE_FP32 , GxB_ANY_ISNE_FP32 ,
GxB_MIN_ISNE_FP64 , GxB_MAX_ISNE_FP64 , GxB_PLUS_ISNE_FP64 , GxB_TIMES_ISNE_FP64 , GxB_ANY_ISNE_FP64 ,
// semirings with multiply op: z = ISGT (x,y), all types x,y,z the same:
GxB_MIN_ISGT_INT8 , GxB_MAX_ISGT_INT8 , GxB_PLUS_ISGT_INT8 , GxB_TIMES_ISGT_INT8 , GxB_ANY_ISGT_INT8 ,
GxB_MIN_ISGT_INT16 , GxB_MAX_ISGT_INT16 , GxB_PLUS_ISGT_INT16 , GxB_TIMES_ISGT_INT16 , GxB_ANY_ISGT_INT16 ,
GxB_MIN_ISGT_INT32 , GxB_MAX_ISGT_INT32 , GxB_PLUS_ISGT_INT32 , GxB_TIMES_ISGT_INT32 , GxB_ANY_ISGT_INT32 ,
GxB_MIN_ISGT_INT64 , GxB_MAX_ISGT_INT64 , GxB_PLUS_ISGT_INT64 , GxB_TIMES_ISGT_INT64 , GxB_ANY_ISGT_INT64 ,
GxB_MIN_ISGT_UINT8 , GxB_MAX_ISGT_UINT8 , GxB_PLUS_ISGT_UINT8 , GxB_TIMES_ISGT_UINT8 , GxB_ANY_ISGT_UINT8 ,
GxB_MIN_ISGT_UINT16 , GxB_MAX_ISGT_UINT16 , GxB_PLUS_ISGT_UINT16 , GxB_TIMES_ISGT_UINT16 , GxB_ANY_ISGT_UINT16 ,
GxB_MIN_ISGT_UINT32 , GxB_MAX_ISGT_UINT32 , GxB_PLUS_ISGT_UINT32 , GxB_TIMES_ISGT_UINT32 , GxB_ANY_ISGT_UINT32 ,
GxB_MIN_ISGT_UINT64 , GxB_MAX_ISGT_UINT64 , GxB_PLUS_ISGT_UINT64 , GxB_TIMES_ISGT_UINT64 , GxB_ANY_ISGT_UINT64 ,
GxB_MIN_ISGT_FP32 , GxB_MAX_ISGT_FP32 , GxB_PLUS_ISGT_FP32 , GxB_TIMES_ISGT_FP32 , GxB_ANY_ISGT_FP32 ,
GxB_MIN_ISGT_FP64 , GxB_MAX_ISGT_FP64 , GxB_PLUS_ISGT_FP64 , GxB_TIMES_ISGT_FP64 , GxB_ANY_ISGT_FP64 ,
// semirings with multiply op: z = ISLT (x,y), all types x,y,z the same:
GxB_MIN_ISLT_INT8 , GxB_MAX_ISLT_INT8 , GxB_PLUS_ISLT_INT8 , GxB_TIMES_ISLT_INT8 , GxB_ANY_ISLT_INT8 ,
GxB_MIN_ISLT_INT16 , GxB_MAX_ISLT_INT16 , GxB_PLUS_ISLT_INT16 , GxB_TIMES_ISLT_INT16 , GxB_ANY_ISLT_INT16 ,
GxB_MIN_ISLT_INT32 , GxB_MAX_ISLT_INT32 , GxB_PLUS_ISLT_INT32 , GxB_TIMES_ISLT_INT32 , GxB_ANY_ISLT_INT32 ,
GxB_MIN_ISLT_INT64 , GxB_MAX_ISLT_INT64 , GxB_PLUS_ISLT_INT64 , GxB_TIMES_ISLT_INT64 , GxB_ANY_ISLT_INT64 ,
GxB_MIN_ISLT_UINT8 , GxB_MAX_ISLT_UINT8 , GxB_PLUS_ISLT_UINT8 , GxB_TIMES_ISLT_UINT8 , GxB_ANY_ISLT_UINT8 ,
GxB_MIN_ISLT_UINT16 , GxB_MAX_ISLT_UINT16 , GxB_PLUS_ISLT_UINT16 , GxB_TIMES_ISLT_UINT16 , GxB_ANY_ISLT_UINT16 ,
GxB_MIN_ISLT_UINT32 , GxB_MAX_ISLT_UINT32 , GxB_PLUS_ISLT_UINT32 , GxB_TIMES_ISLT_UINT32 , GxB_ANY_ISLT_UINT32 ,
GxB_MIN_ISLT_UINT64 , GxB_MAX_ISLT_UINT64 , GxB_PLUS_ISLT_UINT64 , GxB_TIMES_ISLT_UINT64 , GxB_ANY_ISLT_UINT64 ,
GxB_MIN_ISLT_FP32 , GxB_MAX_ISLT_FP32 , GxB_PLUS_ISLT_FP32 , GxB_TIMES_ISLT_FP32 , GxB_ANY_ISLT_FP32 ,
GxB_MIN_ISLT_FP64 , GxB_MAX_ISLT_FP64 , GxB_PLUS_ISLT_FP64 , GxB_TIMES_ISLT_FP64 , GxB_ANY_ISLT_FP64 ,
// semirings with multiply op: z = ISGE (x,y), all types x,y,z the same:
GxB_MIN_ISGE_INT8 , GxB_MAX_ISGE_INT8 , GxB_PLUS_ISGE_INT8 , GxB_TIMES_ISGE_INT8 , GxB_ANY_ISGE_INT8 ,
GxB_MIN_ISGE_INT16 , GxB_MAX_ISGE_INT16 , GxB_PLUS_ISGE_INT16 , GxB_TIMES_ISGE_INT16 , GxB_ANY_ISGE_INT16 ,
GxB_MIN_ISGE_INT32 , GxB_MAX_ISGE_INT32 , GxB_PLUS_ISGE_INT32 , GxB_TIMES_ISGE_INT32 , GxB_ANY_ISGE_INT32 ,
GxB_MIN_ISGE_INT64 , GxB_MAX_ISGE_INT64 , GxB_PLUS_ISGE_INT64 , GxB_TIMES_ISGE_INT64 , GxB_ANY_ISGE_INT64 ,
GxB_MIN_ISGE_UINT8 , GxB_MAX_ISGE_UINT8 , GxB_PLUS_ISGE_UINT8 , GxB_TIMES_ISGE_UINT8 , GxB_ANY_ISGE_UINT8 ,
GxB_MIN_ISGE_UINT16 , GxB_MAX_ISGE_UINT16 , GxB_PLUS_ISGE_UINT16 , GxB_TIMES_ISGE_UINT16 , GxB_ANY_ISGE_UINT16 ,
GxB_MIN_ISGE_UINT32 , GxB_MAX_ISGE_UINT32 , GxB_PLUS_ISGE_UINT32 , GxB_TIMES_ISGE_UINT32 , GxB_ANY_ISGE_UINT32 ,
GxB_MIN_ISGE_UINT64 , GxB_MAX_ISGE_UINT64 , GxB_PLUS_ISGE_UINT64 , GxB_TIMES_ISGE_UINT64 , GxB_ANY_ISGE_UINT64 ,
GxB_MIN_ISGE_FP32 , GxB_MAX_ISGE_FP32 , GxB_PLUS_ISGE_FP32 , GxB_TIMES_ISGE_FP32 , GxB_ANY_ISGE_FP32 ,
GxB_MIN_ISGE_FP64 , GxB_MAX_ISGE_FP64 , GxB_PLUS_ISGE_FP64 , GxB_TIMES_ISGE_FP64 , GxB_ANY_ISGE_FP64 ,
// semirings with multiply op: z = ISLE (x,y), all types x,y,z the same:
GxB_MIN_ISLE_INT8 , GxB_MAX_ISLE_INT8 , GxB_PLUS_ISLE_INT8 , GxB_TIMES_ISLE_INT8 , GxB_ANY_ISLE_INT8 ,
GxB_MIN_ISLE_INT16 , GxB_MAX_ISLE_INT16 , GxB_PLUS_ISLE_INT16 , GxB_TIMES_ISLE_INT16 , GxB_ANY_ISLE_INT16 ,
GxB_MIN_ISLE_INT32 , GxB_MAX_ISLE_INT32 , GxB_PLUS_ISLE_INT32 , GxB_TIMES_ISLE_INT32 , GxB_ANY_ISLE_INT32 ,
GxB_MIN_ISLE_INT64 , GxB_MAX_ISLE_INT64 , GxB_PLUS_ISLE_INT64 , GxB_TIMES_ISLE_INT64 , GxB_ANY_ISLE_INT64 ,
GxB_MIN_ISLE_UINT8 , GxB_MAX_ISLE_UINT8 , GxB_PLUS_ISLE_UINT8 , GxB_TIMES_ISLE_UINT8 , GxB_ANY_ISLE_UINT8 ,
GxB_MIN_ISLE_UINT16 , GxB_MAX_ISLE_UINT16 , GxB_PLUS_ISLE_UINT16 , GxB_TIMES_ISLE_UINT16 , GxB_ANY_ISLE_UINT16 ,
GxB_MIN_ISLE_UINT32 , GxB_MAX_ISLE_UINT32 , GxB_PLUS_ISLE_UINT32 , GxB_TIMES_ISLE_UINT32 , GxB_ANY_ISLE_UINT32 ,
GxB_MIN_ISLE_UINT64 , GxB_MAX_ISLE_UINT64 , GxB_PLUS_ISLE_UINT64 , GxB_TIMES_ISLE_UINT64 , GxB_ANY_ISLE_UINT64 ,
GxB_MIN_ISLE_FP32 , GxB_MAX_ISLE_FP32 , GxB_PLUS_ISLE_FP32 , GxB_TIMES_ISLE_FP32 , GxB_ANY_ISLE_FP32 ,
GxB_MIN_ISLE_FP64 , GxB_MAX_ISLE_FP64 , GxB_PLUS_ISLE_FP64 , GxB_TIMES_ISLE_FP64 , GxB_ANY_ISLE_FP64 ,
// semirings with multiply op: z = LOR (x,y), all types x,y,z the same:
GxB_MIN_LOR_INT8 , GxB_MAX_LOR_INT8 , GxB_PLUS_LOR_INT8 , GxB_TIMES_LOR_INT8 , GxB_ANY_LOR_INT8 ,
GxB_MIN_LOR_INT16 , GxB_MAX_LOR_INT16 , GxB_PLUS_LOR_INT16 , GxB_TIMES_LOR_INT16 , GxB_ANY_LOR_INT16 ,
GxB_MIN_LOR_INT32 , GxB_MAX_LOR_INT32 , GxB_PLUS_LOR_INT32 , GxB_TIMES_LOR_INT32 , GxB_ANY_LOR_INT32 ,
GxB_MIN_LOR_INT64 , GxB_MAX_LOR_INT64 , GxB_PLUS_LOR_INT64 , GxB_TIMES_LOR_INT64 , GxB_ANY_LOR_INT64 ,
GxB_MIN_LOR_UINT8 , GxB_MAX_LOR_UINT8 , GxB_PLUS_LOR_UINT8 , GxB_TIMES_LOR_UINT8 , GxB_ANY_LOR_UINT8 ,
GxB_MIN_LOR_UINT16 , GxB_MAX_LOR_UINT16 , GxB_PLUS_LOR_UINT16 , GxB_TIMES_LOR_UINT16 , GxB_ANY_LOR_UINT16 ,
GxB_MIN_LOR_UINT32 , GxB_MAX_LOR_UINT32 , GxB_PLUS_LOR_UINT32 , GxB_TIMES_LOR_UINT32 , GxB_ANY_LOR_UINT32 ,
GxB_MIN_LOR_UINT64 , GxB_MAX_LOR_UINT64 , GxB_PLUS_LOR_UINT64 , GxB_TIMES_LOR_UINT64 , GxB_ANY_LOR_UINT64 ,
GxB_MIN_LOR_FP32 , GxB_MAX_LOR_FP32 , GxB_PLUS_LOR_FP32 , GxB_TIMES_LOR_FP32 , GxB_ANY_LOR_FP32 ,
GxB_MIN_LOR_FP64 , GxB_MAX_LOR_FP64 , GxB_PLUS_LOR_FP64 , GxB_TIMES_LOR_FP64 , GxB_ANY_LOR_FP64 ,
// semirings with multiply op: z = LAND (x,y), all types x,y,z the same:
GxB_MIN_LAND_INT8 , GxB_MAX_LAND_INT8 , GxB_PLUS_LAND_INT8 , GxB_TIMES_LAND_INT8 , GxB_ANY_LAND_INT8 ,
GxB_MIN_LAND_INT16 , GxB_MAX_LAND_INT16 , GxB_PLUS_LAND_INT16 , GxB_TIMES_LAND_INT16 , GxB_ANY_LAND_INT16 ,
GxB_MIN_LAND_INT32 , GxB_MAX_LAND_INT32 , GxB_PLUS_LAND_INT32 , GxB_TIMES_LAND_INT32 , GxB_ANY_LAND_INT32 ,
GxB_MIN_LAND_INT64 , GxB_MAX_LAND_INT64 , GxB_PLUS_LAND_INT64 , GxB_TIMES_LAND_INT64 , GxB_ANY_LAND_INT64 ,
GxB_MIN_LAND_UINT8 , GxB_MAX_LAND_UINT8 , GxB_PLUS_LAND_UINT8 , GxB_TIMES_LAND_UINT8 , GxB_ANY_LAND_UINT8 ,
GxB_MIN_LAND_UINT16 , GxB_MAX_LAND_UINT16 , GxB_PLUS_LAND_UINT16 , GxB_TIMES_LAND_UINT16 , GxB_ANY_LAND_UINT16 ,
GxB_MIN_LAND_UINT32 , GxB_MAX_LAND_UINT32 , GxB_PLUS_LAND_UINT32 , GxB_TIMES_LAND_UINT32 , GxB_ANY_LAND_UINT32 ,
GxB_MIN_LAND_UINT64 , GxB_MAX_LAND_UINT64 , GxB_PLUS_LAND_UINT64 , GxB_TIMES_LAND_UINT64 , GxB_ANY_LAND_UINT64 ,
GxB_MIN_LAND_FP32 , GxB_MAX_LAND_FP32 , GxB_PLUS_LAND_FP32 , GxB_TIMES_LAND_FP32 , GxB_ANY_LAND_FP32 ,
GxB_MIN_LAND_FP64 , GxB_MAX_LAND_FP64 , GxB_PLUS_LAND_FP64 , GxB_TIMES_LAND_FP64 , GxB_ANY_LAND_FP64 ,
// semirings with multiply op: z = LXOR (x,y), all types x,y,z the same:
GxB_MIN_LXOR_INT8 , GxB_MAX_LXOR_INT8 , GxB_PLUS_LXOR_INT8 , GxB_TIMES_LXOR_INT8 , GxB_ANY_LXOR_INT8 ,
GxB_MIN_LXOR_INT16 , GxB_MAX_LXOR_INT16 , GxB_PLUS_LXOR_INT16 , GxB_TIMES_LXOR_INT16 , GxB_ANY_LXOR_INT16 ,
GxB_MIN_LXOR_INT32 , GxB_MAX_LXOR_INT32 , GxB_PLUS_LXOR_INT32 , GxB_TIMES_LXOR_INT32 , GxB_ANY_LXOR_INT32 ,
GxB_MIN_LXOR_INT64 , GxB_MAX_LXOR_INT64 , GxB_PLUS_LXOR_INT64 , GxB_TIMES_LXOR_INT64 , GxB_ANY_LXOR_INT64 ,
GxB_MIN_LXOR_UINT8 , GxB_MAX_LXOR_UINT8 , GxB_PLUS_LXOR_UINT8 , GxB_TIMES_LXOR_UINT8 , GxB_ANY_LXOR_UINT8 ,
GxB_MIN_LXOR_UINT16 , GxB_MAX_LXOR_UINT16 , GxB_PLUS_LXOR_UINT16 , GxB_TIMES_LXOR_UINT16 , GxB_ANY_LXOR_UINT16 ,
GxB_MIN_LXOR_UINT32 , GxB_MAX_LXOR_UINT32 , GxB_PLUS_LXOR_UINT32 , GxB_TIMES_LXOR_UINT32 , GxB_ANY_LXOR_UINT32 ,
GxB_MIN_LXOR_UINT64 , GxB_MAX_LXOR_UINT64 , GxB_PLUS_LXOR_UINT64 , GxB_TIMES_LXOR_UINT64 , GxB_ANY_LXOR_UINT64 ,
GxB_MIN_LXOR_FP32 , GxB_MAX_LXOR_FP32 , GxB_PLUS_LXOR_FP32 , GxB_TIMES_LXOR_FP32 , GxB_ANY_LXOR_FP32 ,
GxB_MIN_LXOR_FP64 , GxB_MAX_LXOR_FP64 , GxB_PLUS_LXOR_FP64 , GxB_TIMES_LXOR_FP64 , GxB_ANY_LXOR_FP64 ,
//------------------------------------------------------------------------------
// 300 semirings with a comparator TxT -> bool, where T is non-Boolean
//------------------------------------------------------------------------------
// In the 4th column the GxB_EQ_*_* semirings could also be called
// GxB_LXNOR_*_*, since the EQ and LXNOR boolean operators are identical
// but those names are not included.
// semirings with multiply op: z = EQ (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_EQ_INT8 , GxB_LAND_EQ_INT8 , GxB_LXOR_EQ_INT8 , GxB_EQ_EQ_INT8 , GxB_ANY_EQ_INT8 ,
GxB_LOR_EQ_INT16 , GxB_LAND_EQ_INT16 , GxB_LXOR_EQ_INT16 , GxB_EQ_EQ_INT16 , GxB_ANY_EQ_INT16 ,
GxB_LOR_EQ_INT32 , GxB_LAND_EQ_INT32 , GxB_LXOR_EQ_INT32 , GxB_EQ_EQ_INT32 , GxB_ANY_EQ_INT32 ,
GxB_LOR_EQ_INT64 , GxB_LAND_EQ_INT64 , GxB_LXOR_EQ_INT64 , GxB_EQ_EQ_INT64 , GxB_ANY_EQ_INT64 ,
GxB_LOR_EQ_UINT8 , GxB_LAND_EQ_UINT8 , GxB_LXOR_EQ_UINT8 , GxB_EQ_EQ_UINT8 , GxB_ANY_EQ_UINT8 ,
GxB_LOR_EQ_UINT16 , GxB_LAND_EQ_UINT16 , GxB_LXOR_EQ_UINT16 , GxB_EQ_EQ_UINT16 , GxB_ANY_EQ_UINT16 ,
GxB_LOR_EQ_UINT32 , GxB_LAND_EQ_UINT32 , GxB_LXOR_EQ_UINT32 , GxB_EQ_EQ_UINT32 , GxB_ANY_EQ_UINT32 ,
GxB_LOR_EQ_UINT64 , GxB_LAND_EQ_UINT64 , GxB_LXOR_EQ_UINT64 , GxB_EQ_EQ_UINT64 , GxB_ANY_EQ_UINT64 ,
GxB_LOR_EQ_FP32 , GxB_LAND_EQ_FP32 , GxB_LXOR_EQ_FP32 , GxB_EQ_EQ_FP32 , GxB_ANY_EQ_FP32 ,
GxB_LOR_EQ_FP64 , GxB_LAND_EQ_FP64 , GxB_LXOR_EQ_FP64 , GxB_EQ_EQ_FP64 , GxB_ANY_EQ_FP64 ,
// semirings with multiply op: z = NE (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_NE_INT8 , GxB_LAND_NE_INT8 , GxB_LXOR_NE_INT8 , GxB_EQ_NE_INT8 , GxB_ANY_NE_INT8 ,
GxB_LOR_NE_INT16 , GxB_LAND_NE_INT16 , GxB_LXOR_NE_INT16 , GxB_EQ_NE_INT16 , GxB_ANY_NE_INT16 ,
GxB_LOR_NE_INT32 , GxB_LAND_NE_INT32 , GxB_LXOR_NE_INT32 , GxB_EQ_NE_INT32 , GxB_ANY_NE_INT32 ,
GxB_LOR_NE_INT64 , GxB_LAND_NE_INT64 , GxB_LXOR_NE_INT64 , GxB_EQ_NE_INT64 , GxB_ANY_NE_INT64 ,
GxB_LOR_NE_UINT8 , GxB_LAND_NE_UINT8 , GxB_LXOR_NE_UINT8 , GxB_EQ_NE_UINT8 , GxB_ANY_NE_UINT8 ,
GxB_LOR_NE_UINT16 , GxB_LAND_NE_UINT16 , GxB_LXOR_NE_UINT16 , GxB_EQ_NE_UINT16 , GxB_ANY_NE_UINT16 ,
GxB_LOR_NE_UINT32 , GxB_LAND_NE_UINT32 , GxB_LXOR_NE_UINT32 , GxB_EQ_NE_UINT32 , GxB_ANY_NE_UINT32 ,
GxB_LOR_NE_UINT64 , GxB_LAND_NE_UINT64 , GxB_LXOR_NE_UINT64 , GxB_EQ_NE_UINT64 , GxB_ANY_NE_UINT64 ,
GxB_LOR_NE_FP32 , GxB_LAND_NE_FP32 , GxB_LXOR_NE_FP32 , GxB_EQ_NE_FP32 , GxB_ANY_NE_FP32 ,
GxB_LOR_NE_FP64 , GxB_LAND_NE_FP64 , GxB_LXOR_NE_FP64 , GxB_EQ_NE_FP64 , GxB_ANY_NE_FP64 ,
// semirings with multiply op: z = GT (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_GT_INT8 , GxB_LAND_GT_INT8 , GxB_LXOR_GT_INT8 , GxB_EQ_GT_INT8 , GxB_ANY_GT_INT8 ,
GxB_LOR_GT_INT16 , GxB_LAND_GT_INT16 , GxB_LXOR_GT_INT16 , GxB_EQ_GT_INT16 , GxB_ANY_GT_INT16 ,
GxB_LOR_GT_INT32 , GxB_LAND_GT_INT32 , GxB_LXOR_GT_INT32 , GxB_EQ_GT_INT32 , GxB_ANY_GT_INT32 ,
GxB_LOR_GT_INT64 , GxB_LAND_GT_INT64 , GxB_LXOR_GT_INT64 , GxB_EQ_GT_INT64 , GxB_ANY_GT_INT64 ,
GxB_LOR_GT_UINT8 , GxB_LAND_GT_UINT8 , GxB_LXOR_GT_UINT8 , GxB_EQ_GT_UINT8 , GxB_ANY_GT_UINT8 ,
GxB_LOR_GT_UINT16 , GxB_LAND_GT_UINT16 , GxB_LXOR_GT_UINT16 , GxB_EQ_GT_UINT16 , GxB_ANY_GT_UINT16 ,
GxB_LOR_GT_UINT32 , GxB_LAND_GT_UINT32 , GxB_LXOR_GT_UINT32 , GxB_EQ_GT_UINT32 , GxB_ANY_GT_UINT32 ,
GxB_LOR_GT_UINT64 , GxB_LAND_GT_UINT64 , GxB_LXOR_GT_UINT64 , GxB_EQ_GT_UINT64 , GxB_ANY_GT_UINT64 ,
GxB_LOR_GT_FP32 , GxB_LAND_GT_FP32 , GxB_LXOR_GT_FP32 , GxB_EQ_GT_FP32 , GxB_ANY_GT_FP32 ,
GxB_LOR_GT_FP64 , GxB_LAND_GT_FP64 , GxB_LXOR_GT_FP64 , GxB_EQ_GT_FP64 , GxB_ANY_GT_FP64 ,
// semirings with multiply op: z = LT (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_LT_INT8 , GxB_LAND_LT_INT8 , GxB_LXOR_LT_INT8 , GxB_EQ_LT_INT8 , GxB_ANY_LT_INT8 ,
GxB_LOR_LT_INT16 , GxB_LAND_LT_INT16 , GxB_LXOR_LT_INT16 , GxB_EQ_LT_INT16 , GxB_ANY_LT_INT16 ,
GxB_LOR_LT_INT32 , GxB_LAND_LT_INT32 , GxB_LXOR_LT_INT32 , GxB_EQ_LT_INT32 , GxB_ANY_LT_INT32 ,
GxB_LOR_LT_INT64 , GxB_LAND_LT_INT64 , GxB_LXOR_LT_INT64 , GxB_EQ_LT_INT64 , GxB_ANY_LT_INT64 ,
GxB_LOR_LT_UINT8 , GxB_LAND_LT_UINT8 , GxB_LXOR_LT_UINT8 , GxB_EQ_LT_UINT8 , GxB_ANY_LT_UINT8 ,
GxB_LOR_LT_UINT16 , GxB_LAND_LT_UINT16 , GxB_LXOR_LT_UINT16 , GxB_EQ_LT_UINT16 , GxB_ANY_LT_UINT16 ,
GxB_LOR_LT_UINT32 , GxB_LAND_LT_UINT32 , GxB_LXOR_LT_UINT32 , GxB_EQ_LT_UINT32 , GxB_ANY_LT_UINT32 ,
GxB_LOR_LT_UINT64 , GxB_LAND_LT_UINT64 , GxB_LXOR_LT_UINT64 , GxB_EQ_LT_UINT64 , GxB_ANY_LT_UINT64 ,
GxB_LOR_LT_FP32 , GxB_LAND_LT_FP32 , GxB_LXOR_LT_FP32 , GxB_EQ_LT_FP32 , GxB_ANY_LT_FP32 ,
GxB_LOR_LT_FP64 , GxB_LAND_LT_FP64 , GxB_LXOR_LT_FP64 , GxB_EQ_LT_FP64 , GxB_ANY_LT_FP64 ,
// semirings with multiply op: z = GE (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_GE_INT8 , GxB_LAND_GE_INT8 , GxB_LXOR_GE_INT8 , GxB_EQ_GE_INT8 , GxB_ANY_GE_INT8 ,
GxB_LOR_GE_INT16 , GxB_LAND_GE_INT16 , GxB_LXOR_GE_INT16 , GxB_EQ_GE_INT16 , GxB_ANY_GE_INT16 ,
GxB_LOR_GE_INT32 , GxB_LAND_GE_INT32 , GxB_LXOR_GE_INT32 , GxB_EQ_GE_INT32 , GxB_ANY_GE_INT32 ,
GxB_LOR_GE_INT64 , GxB_LAND_GE_INT64 , GxB_LXOR_GE_INT64 , GxB_EQ_GE_INT64 , GxB_ANY_GE_INT64 ,
GxB_LOR_GE_UINT8 , GxB_LAND_GE_UINT8 , GxB_LXOR_GE_UINT8 , GxB_EQ_GE_UINT8 , GxB_ANY_GE_UINT8 ,
GxB_LOR_GE_UINT16 , GxB_LAND_GE_UINT16 , GxB_LXOR_GE_UINT16 , GxB_EQ_GE_UINT16 , GxB_ANY_GE_UINT16 ,
GxB_LOR_GE_UINT32 , GxB_LAND_GE_UINT32 , GxB_LXOR_GE_UINT32 , GxB_EQ_GE_UINT32 , GxB_ANY_GE_UINT32 ,
GxB_LOR_GE_UINT64 , GxB_LAND_GE_UINT64 , GxB_LXOR_GE_UINT64 , GxB_EQ_GE_UINT64 , GxB_ANY_GE_UINT64 ,
GxB_LOR_GE_FP32 , GxB_LAND_GE_FP32 , GxB_LXOR_GE_FP32 , GxB_EQ_GE_FP32 , GxB_ANY_GE_FP32 ,
GxB_LOR_GE_FP64 , GxB_LAND_GE_FP64 , GxB_LXOR_GE_FP64 , GxB_EQ_GE_FP64 , GxB_ANY_GE_FP64 ,
// semirings with multiply op: z = LE (x,y), where z is boolean and x,y are given by the suffix:
GxB_LOR_LE_INT8 , GxB_LAND_LE_INT8 , GxB_LXOR_LE_INT8 , GxB_EQ_LE_INT8 , GxB_ANY_LE_INT8 ,
GxB_LOR_LE_INT16 , GxB_LAND_LE_INT16 , GxB_LXOR_LE_INT16 , GxB_EQ_LE_INT16 , GxB_ANY_LE_INT16 ,
GxB_LOR_LE_INT32 , GxB_LAND_LE_INT32 , GxB_LXOR_LE_INT32 , GxB_EQ_LE_INT32 , GxB_ANY_LE_INT32 ,
GxB_LOR_LE_INT64 , GxB_LAND_LE_INT64 , GxB_LXOR_LE_INT64 , GxB_EQ_LE_INT64 , GxB_ANY_LE_INT64 ,
GxB_LOR_LE_UINT8 , GxB_LAND_LE_UINT8 , GxB_LXOR_LE_UINT8 , GxB_EQ_LE_UINT8 , GxB_ANY_LE_UINT8 ,
GxB_LOR_LE_UINT16 , GxB_LAND_LE_UINT16 , GxB_LXOR_LE_UINT16 , GxB_EQ_LE_UINT16 , GxB_ANY_LE_UINT16 ,
GxB_LOR_LE_UINT32 , GxB_LAND_LE_UINT32 , GxB_LXOR_LE_UINT32 , GxB_EQ_LE_UINT32 , GxB_ANY_LE_UINT32 ,
GxB_LOR_LE_UINT64 , GxB_LAND_LE_UINT64 , GxB_LXOR_LE_UINT64 , GxB_EQ_LE_UINT64 , GxB_ANY_LE_UINT64 ,
GxB_LOR_LE_FP32 , GxB_LAND_LE_FP32 , GxB_LXOR_LE_FP32 , GxB_EQ_LE_FP32 , GxB_ANY_LE_FP32 ,
GxB_LOR_LE_FP64 , GxB_LAND_LE_FP64 , GxB_LXOR_LE_FP64 , GxB_EQ_LE_FP64 , GxB_ANY_LE_FP64 ,
//------------------------------------------------------------------------------
// 55 semirings with purely Boolean types, bool x bool -> bool
//------------------------------------------------------------------------------
// Note that lor_pair, land_pair, and eq_pair are all identical to any_pair.
// These 3 are marked below. GxB_EQ_*_BOOL could be called
// GxB_LXNOR_*_BOOL, and GxB_*_EQ_BOOL could be called GxB_*_LXNOR_BOOL,
// but those names are not included.
// purely boolean semirings in the form GxB_(add monoid)_(multiply operator)_BOOL:
GxB_LOR_FIRST_BOOL , GxB_LAND_FIRST_BOOL , GxB_LXOR_FIRST_BOOL , GxB_EQ_FIRST_BOOL , GxB_ANY_FIRST_BOOL ,
GxB_LOR_SECOND_BOOL , GxB_LAND_SECOND_BOOL , GxB_LXOR_SECOND_BOOL , GxB_EQ_SECOND_BOOL , GxB_ANY_SECOND_BOOL ,
GxB_LOR_PAIR_BOOL/**/ , GxB_LAND_PAIR_BOOL/**/ , GxB_LXOR_PAIR_BOOL , GxB_EQ_PAIR_BOOL/**/ , GxB_ANY_PAIR_BOOL ,
GxB_LOR_LOR_BOOL , GxB_LAND_LOR_BOOL , GxB_LXOR_LOR_BOOL , GxB_EQ_LOR_BOOL , GxB_ANY_LOR_BOOL ,
GxB_LOR_LAND_BOOL , GxB_LAND_LAND_BOOL , GxB_LXOR_LAND_BOOL , GxB_EQ_LAND_BOOL , GxB_ANY_LAND_BOOL ,
GxB_LOR_LXOR_BOOL , GxB_LAND_LXOR_BOOL , GxB_LXOR_LXOR_BOOL , GxB_EQ_LXOR_BOOL , GxB_ANY_LXOR_BOOL ,
GxB_LOR_EQ_BOOL , GxB_LAND_EQ_BOOL , GxB_LXOR_EQ_BOOL , GxB_EQ_EQ_BOOL , GxB_ANY_EQ_BOOL ,
GxB_LOR_GT_BOOL , GxB_LAND_GT_BOOL , GxB_LXOR_GT_BOOL , GxB_EQ_GT_BOOL , GxB_ANY_GT_BOOL ,
GxB_LOR_LT_BOOL , GxB_LAND_LT_BOOL , GxB_LXOR_LT_BOOL , GxB_EQ_LT_BOOL , GxB_ANY_LT_BOOL ,
GxB_LOR_GE_BOOL , GxB_LAND_GE_BOOL , GxB_LXOR_GE_BOOL , GxB_EQ_GE_BOOL , GxB_ANY_GE_BOOL ,
GxB_LOR_LE_BOOL , GxB_LAND_LE_BOOL , GxB_LXOR_LE_BOOL , GxB_EQ_LE_BOOL , GxB_ANY_LE_BOOL ,
//------------------------------------------------------------------------------
// 54 complex semirings
//------------------------------------------------------------------------------
// 3 monoids (plus, times, any), 2 types (FC32 and FC64), and 9
// multiplicative operators.
// Note that times_pair is identical to any_pair.
// These 2 are marked below.
GxB_PLUS_FIRST_FC32 , GxB_TIMES_FIRST_FC32 , GxB_ANY_FIRST_FC32 ,
GxB_PLUS_FIRST_FC64 , GxB_TIMES_FIRST_FC64 , GxB_ANY_FIRST_FC64 ,
GxB_PLUS_SECOND_FC32 , GxB_TIMES_SECOND_FC32 , GxB_ANY_SECOND_FC32 ,
GxB_PLUS_SECOND_FC64 , GxB_TIMES_SECOND_FC64 , GxB_ANY_SECOND_FC64 ,
GxB_PLUS_PAIR_FC32 , GxB_TIMES_PAIR_FC32/**/, GxB_ANY_PAIR_FC32 ,
GxB_PLUS_PAIR_FC64 , GxB_TIMES_PAIR_FC64/**/, GxB_ANY_PAIR_FC64 ,
GxB_PLUS_PLUS_FC32 , GxB_TIMES_PLUS_FC32 , GxB_ANY_PLUS_FC32 ,
GxB_PLUS_PLUS_FC64 , GxB_TIMES_PLUS_FC64 , GxB_ANY_PLUS_FC64 ,
GxB_PLUS_MINUS_FC32 , GxB_TIMES_MINUS_FC32 , GxB_ANY_MINUS_FC32 ,
GxB_PLUS_MINUS_FC64 , GxB_TIMES_MINUS_FC64 , GxB_ANY_MINUS_FC64 ,
GxB_PLUS_TIMES_FC32 , GxB_TIMES_TIMES_FC32 , GxB_ANY_TIMES_FC32 ,
GxB_PLUS_TIMES_FC64 , GxB_TIMES_TIMES_FC64 , GxB_ANY_TIMES_FC64 ,
GxB_PLUS_DIV_FC32 , GxB_TIMES_DIV_FC32 , GxB_ANY_DIV_FC32 ,
GxB_PLUS_DIV_FC64 , GxB_TIMES_DIV_FC64 , GxB_ANY_DIV_FC64 ,
GxB_PLUS_RDIV_FC32 , GxB_TIMES_RDIV_FC32 , GxB_ANY_RDIV_FC32 ,
GxB_PLUS_RDIV_FC64 , GxB_TIMES_RDIV_FC64 , GxB_ANY_RDIV_FC64 ,
GxB_PLUS_RMINUS_FC32 , GxB_TIMES_RMINUS_FC32 , GxB_ANY_RMINUS_FC32 ,
GxB_PLUS_RMINUS_FC64 , GxB_TIMES_RMINUS_FC64 , GxB_ANY_RMINUS_FC64 ,
//------------------------------------------------------------------------------
// 64 bitwise semirings
//------------------------------------------------------------------------------
// monoids: (BOR, BAND, BXOR, BXNOR) x
// mult: (BOR, BAND, BXOR, BXNOR) x
// types: (UINT8, UINT16, UINT32, UINT64)
GxB_BOR_BOR_UINT8 , GxB_BOR_BOR_UINT16 , GxB_BOR_BOR_UINT32 , GxB_BOR_BOR_UINT64 ,
GxB_BOR_BAND_UINT8 , GxB_BOR_BAND_UINT16 , GxB_BOR_BAND_UINT32 , GxB_BOR_BAND_UINT64 ,
GxB_BOR_BXOR_UINT8 , GxB_BOR_BXOR_UINT16 , GxB_BOR_BXOR_UINT32 , GxB_BOR_BXOR_UINT64 ,
GxB_BOR_BXNOR_UINT8 , GxB_BOR_BXNOR_UINT16 , GxB_BOR_BXNOR_UINT32 , GxB_BOR_BXNOR_UINT64 ,
GxB_BAND_BOR_UINT8 , GxB_BAND_BOR_UINT16 , GxB_BAND_BOR_UINT32 , GxB_BAND_BOR_UINT64 ,
GxB_BAND_BAND_UINT8 , GxB_BAND_BAND_UINT16 , GxB_BAND_BAND_UINT32 , GxB_BAND_BAND_UINT64 ,
GxB_BAND_BXOR_UINT8 , GxB_BAND_BXOR_UINT16 , GxB_BAND_BXOR_UINT32 , GxB_BAND_BXOR_UINT64 ,
GxB_BAND_BXNOR_UINT8 , GxB_BAND_BXNOR_UINT16 , GxB_BAND_BXNOR_UINT32 , GxB_BAND_BXNOR_UINT64 ,
GxB_BXOR_BOR_UINT8 , GxB_BXOR_BOR_UINT16 , GxB_BXOR_BOR_UINT32 , GxB_BXOR_BOR_UINT64 ,
GxB_BXOR_BAND_UINT8 , GxB_BXOR_BAND_UINT16 , GxB_BXOR_BAND_UINT32 , GxB_BXOR_BAND_UINT64 ,
GxB_BXOR_BXOR_UINT8 , GxB_BXOR_BXOR_UINT16 , GxB_BXOR_BXOR_UINT32 , GxB_BXOR_BXOR_UINT64 ,
GxB_BXOR_BXNOR_UINT8 , GxB_BXOR_BXNOR_UINT16 , GxB_BXOR_BXNOR_UINT32 , GxB_BXOR_BXNOR_UINT64 ,
GxB_BXNOR_BOR_UINT8 , GxB_BXNOR_BOR_UINT16 , GxB_BXNOR_BOR_UINT32 , GxB_BXNOR_BOR_UINT64 ,
GxB_BXNOR_BAND_UINT8 , GxB_BXNOR_BAND_UINT16 , GxB_BXNOR_BAND_UINT32 , GxB_BXNOR_BAND_UINT64 ,
GxB_BXNOR_BXOR_UINT8 , GxB_BXNOR_BXOR_UINT16 , GxB_BXNOR_BXOR_UINT32 , GxB_BXNOR_BXOR_UINT64 ,
GxB_BXNOR_BXNOR_UINT8 , GxB_BXNOR_BXNOR_UINT16 , GxB_BXNOR_BXNOR_UINT32 , GxB_BXNOR_BXNOR_UINT64 ,
//------------------------------------------------------------------------------
// 80 positional semirings
//------------------------------------------------------------------------------
// monoids: (MIN, MAX, ANY, PLUS, TIMES) x
// mult: (FIRSTI, FIRSTI1, FIRSTJ, FIRSTJ1, SECONDI, SECONDI1, SECONDJ, SECONDJ1)
// types: (INT32, INT64)
GxB_MIN_FIRSTI_INT32, GxB_MIN_FIRSTI_INT64,
GxB_MAX_FIRSTI_INT32, GxB_MAX_FIRSTI_INT64,
GxB_ANY_FIRSTI_INT32, GxB_ANY_FIRSTI_INT64,
GxB_PLUS_FIRSTI_INT32, GxB_PLUS_FIRSTI_INT64,
GxB_TIMES_FIRSTI_INT32, GxB_TIMES_FIRSTI_INT64,
GxB_MIN_FIRSTI1_INT32, GxB_MIN_FIRSTI1_INT64,
GxB_MAX_FIRSTI1_INT32, GxB_MAX_FIRSTI1_INT64,
GxB_ANY_FIRSTI1_INT32, GxB_ANY_FIRSTI1_INT64,
GxB_PLUS_FIRSTI1_INT32, GxB_PLUS_FIRSTI1_INT64,
GxB_TIMES_FIRSTI1_INT32, GxB_TIMES_FIRSTI1_INT64,
GxB_MIN_FIRSTJ_INT32, GxB_MIN_FIRSTJ_INT64,
GxB_MAX_FIRSTJ_INT32, GxB_MAX_FIRSTJ_INT64,
GxB_ANY_FIRSTJ_INT32, GxB_ANY_FIRSTJ_INT64,
GxB_PLUS_FIRSTJ_INT32, GxB_PLUS_FIRSTJ_INT64,
GxB_TIMES_FIRSTJ_INT32, GxB_TIMES_FIRSTJ_INT64,
GxB_MIN_FIRSTJ1_INT32, GxB_MIN_FIRSTJ1_INT64,
GxB_MAX_FIRSTJ1_INT32, GxB_MAX_FIRSTJ1_INT64,
GxB_ANY_FIRSTJ1_INT32, GxB_ANY_FIRSTJ1_INT64,
GxB_PLUS_FIRSTJ1_INT32, GxB_PLUS_FIRSTJ1_INT64,
GxB_TIMES_FIRSTJ1_INT32, GxB_TIMES_FIRSTJ1_INT64,
GxB_MIN_SECONDI_INT32, GxB_MIN_SECONDI_INT64,
GxB_MAX_SECONDI_INT32, GxB_MAX_SECONDI_INT64,
GxB_ANY_SECONDI_INT32, GxB_ANY_SECONDI_INT64,
GxB_PLUS_SECONDI_INT32, GxB_PLUS_SECONDI_INT64,
GxB_TIMES_SECONDI_INT32, GxB_TIMES_SECONDI_INT64,
GxB_MIN_SECONDI1_INT32, GxB_MIN_SECONDI1_INT64,
GxB_MAX_SECONDI1_INT32, GxB_MAX_SECONDI1_INT64,
GxB_ANY_SECONDI1_INT32, GxB_ANY_SECONDI1_INT64,
GxB_PLUS_SECONDI1_INT32, GxB_PLUS_SECONDI1_INT64,
GxB_TIMES_SECONDI1_INT32, GxB_TIMES_SECONDI1_INT64,
GxB_MIN_SECONDJ_INT32, GxB_MIN_SECONDJ_INT64,
GxB_MAX_SECONDJ_INT32, GxB_MAX_SECONDJ_INT64,
GxB_ANY_SECONDJ_INT32, GxB_ANY_SECONDJ_INT64,
GxB_PLUS_SECONDJ_INT32, GxB_PLUS_SECONDJ_INT64,
GxB_TIMES_SECONDJ_INT32, GxB_TIMES_SECONDJ_INT64,
GxB_MIN_SECONDJ1_INT32, GxB_MIN_SECONDJ1_INT64,
GxB_MAX_SECONDJ1_INT32, GxB_MAX_SECONDJ1_INT64,
GxB_ANY_SECONDJ1_INT32, GxB_ANY_SECONDJ1_INT64,
GxB_PLUS_SECONDJ1_INT32, GxB_PLUS_SECONDJ1_INT64,
GxB_TIMES_SECONDJ1_INT32, GxB_TIMES_SECONDJ1_INT64 ;
//------------------------------------------------------------------------------
// GrB_* semirings
//------------------------------------------------------------------------------
// The v1.3 C API for GraphBLAS adds the following 124 predefined semirings,
// with GrB_* names. They are identical to 124 GxB_* semirings defined above,
// with the same name, except that GrB_LXNOR_LOR_SEMIRING_BOOL is identical to
// GxB_EQ_LOR_BOOL (since GrB_EQ_BOOL == GrB_LXNOR). The old names are listed
// below alongside each new name; the new GrB_* names are preferred.
// 12 kinds of GrB_* semirings are available for all 10 real non-boolean types:
// PLUS_TIMES, PLUS_MIN,
// MIN_PLUS, MIN_TIMES, MIN_FIRST, MIN_SECOND, MIN_MAX,
// MAX_PLUS, MAX_TIMES, MAX_FIRST, MAX_SECOND, MAX_MIN
// and 4 semirings for boolean only:
// LOR_LAND, LAND_LOR, LXOR_LAND, LXNOR_LOR.
// GxB_* semirings corresponding to the equivalent GrB_* semiring are
// historical.
GB_PUBLIC GrB_Semiring
//--------------------------------------------------------------------------
// 20 semirings with PLUS monoids
//--------------------------------------------------------------------------
// PLUS_TIMES semirings for all 10 real, non-boolean types:
GrB_PLUS_TIMES_SEMIRING_INT8, // GxB_PLUS_TIMES_INT8
GrB_PLUS_TIMES_SEMIRING_INT16, // GxB_PLUS_TIMES_INT16
GrB_PLUS_TIMES_SEMIRING_INT32, // GxB_PLUS_TIMES_INT32
GrB_PLUS_TIMES_SEMIRING_INT64, // GxB_PLUS_TIMES_INT64
GrB_PLUS_TIMES_SEMIRING_UINT8, // GxB_PLUS_TIMES_UINT8
GrB_PLUS_TIMES_SEMIRING_UINT16, // GxB_PLUS_TIMES_UINT16
GrB_PLUS_TIMES_SEMIRING_UINT32, // GxB_PLUS_TIMES_UINT32
GrB_PLUS_TIMES_SEMIRING_UINT64, // GxB_PLUS_TIMES_UINT64
GrB_PLUS_TIMES_SEMIRING_FP32, // GxB_PLUS_TIMES_FP32
GrB_PLUS_TIMES_SEMIRING_FP64, // GxB_PLUS_TIMES_FP64
// PLUS_MIN semirings for all 10 real, non-boolean types:
GrB_PLUS_MIN_SEMIRING_INT8, // GxB_PLUS_MIN_INT8
GrB_PLUS_MIN_SEMIRING_INT16, // GxB_PLUS_MIN_INT16
GrB_PLUS_MIN_SEMIRING_INT32, // GxB_PLUS_MIN_INT32
GrB_PLUS_MIN_SEMIRING_INT64, // GxB_PLUS_MIN_INT64
GrB_PLUS_MIN_SEMIRING_UINT8, // GxB_PLUS_MIN_UINT8
GrB_PLUS_MIN_SEMIRING_UINT16, // GxB_PLUS_MIN_UINT16
GrB_PLUS_MIN_SEMIRING_UINT32, // GxB_PLUS_MIN_UINT32
GrB_PLUS_MIN_SEMIRING_UINT64, // GxB_PLUS_MIN_UINT64
GrB_PLUS_MIN_SEMIRING_FP32, // GxB_PLUS_MIN_FP32
GrB_PLUS_MIN_SEMIRING_FP64, // GxB_PLUS_MIN_FP64
//--------------------------------------------------------------------------
// 50 semirings with MIN monoids
//--------------------------------------------------------------------------
// MIN_PLUS semirings for all 10 real, non-boolean types:
GrB_MIN_PLUS_SEMIRING_INT8, // GxB_MIN_PLUS_INT8
GrB_MIN_PLUS_SEMIRING_INT16, // GxB_MIN_PLUS_INT16
GrB_MIN_PLUS_SEMIRING_INT32, // GxB_MIN_PLUS_INT32
GrB_MIN_PLUS_SEMIRING_INT64, // GxB_MIN_PLUS_INT64
GrB_MIN_PLUS_SEMIRING_UINT8, // GxB_MIN_PLUS_UINT8
GrB_MIN_PLUS_SEMIRING_UINT16, // GxB_MIN_PLUS_UINT16
GrB_MIN_PLUS_SEMIRING_UINT32, // GxB_MIN_PLUS_UINT32
GrB_MIN_PLUS_SEMIRING_UINT64, // GxB_MIN_PLUS_UINT64
GrB_MIN_PLUS_SEMIRING_FP32, // GxB_MIN_PLUS_FP32
GrB_MIN_PLUS_SEMIRING_FP64, // GxB_MIN_PLUS_FP64
// MIN_TIMES semirings for all 10 real, non-boolean types:
GrB_MIN_TIMES_SEMIRING_INT8, // GxB_MIN_TIMES_INT8
GrB_MIN_TIMES_SEMIRING_INT16, // GxB_MIN_TIMES_INT16
GrB_MIN_TIMES_SEMIRING_INT32, // GxB_MIN_TIMES_INT32
GrB_MIN_TIMES_SEMIRING_INT64, // GxB_MIN_TIMES_INT64
GrB_MIN_TIMES_SEMIRING_UINT8, // GxB_MIN_TIMES_UINT8
GrB_MIN_TIMES_SEMIRING_UINT16, // GxB_MIN_TIMES_UINT16
GrB_MIN_TIMES_SEMIRING_UINT32, // GxB_MIN_TIMES_UINT32
GrB_MIN_TIMES_SEMIRING_UINT64, // GxB_MIN_TIMES_UINT64
GrB_MIN_TIMES_SEMIRING_FP32, // GxB_MIN_TIMES_FP32
GrB_MIN_TIMES_SEMIRING_FP64, // GxB_MIN_TIMES_FP64
// MIN_FIRST semirings for all 10 real, non-boolean types:
GrB_MIN_FIRST_SEMIRING_INT8, // GxB_MIN_FIRST_INT8
GrB_MIN_FIRST_SEMIRING_INT16, // GxB_MIN_FIRST_INT16
GrB_MIN_FIRST_SEMIRING_INT32, // GxB_MIN_FIRST_INT32
GrB_MIN_FIRST_SEMIRING_INT64, // GxB_MIN_FIRST_INT64
GrB_MIN_FIRST_SEMIRING_UINT8, // GxB_MIN_FIRST_UINT8
GrB_MIN_FIRST_SEMIRING_UINT16, // GxB_MIN_FIRST_UINT16
GrB_MIN_FIRST_SEMIRING_UINT32, // GxB_MIN_FIRST_UINT32
GrB_MIN_FIRST_SEMIRING_UINT64, // GxB_MIN_FIRST_UINT64
GrB_MIN_FIRST_SEMIRING_FP32, // GxB_MIN_FIRST_FP32
GrB_MIN_FIRST_SEMIRING_FP64, // GxB_MIN_FIRST_FP64
// MIN_SECOND semirings for all 10 real, non-boolean types:
GrB_MIN_SECOND_SEMIRING_INT8, // GxB_MIN_SECOND_INT8
GrB_MIN_SECOND_SEMIRING_INT16, // GxB_MIN_SECOND_INT16
GrB_MIN_SECOND_SEMIRING_INT32, // GxB_MIN_SECOND_INT32
GrB_MIN_SECOND_SEMIRING_INT64, // GxB_MIN_SECOND_INT64
GrB_MIN_SECOND_SEMIRING_UINT8, // GxB_MIN_SECOND_UINT8
GrB_MIN_SECOND_SEMIRING_UINT16, // GxB_MIN_SECOND_UINT16
GrB_MIN_SECOND_SEMIRING_UINT32, // GxB_MIN_SECOND_UINT32
GrB_MIN_SECOND_SEMIRING_UINT64, // GxB_MIN_SECOND_UINT64
GrB_MIN_SECOND_SEMIRING_FP32, // GxB_MIN_SECOND_FP32
GrB_MIN_SECOND_SEMIRING_FP64, // GxB_MIN_SECOND_FP64
// MIN_MAX semirings for all 10 real, non-boolean types:
GrB_MIN_MAX_SEMIRING_INT8, // GxB_MIN_MAX_INT8
GrB_MIN_MAX_SEMIRING_INT16, // GxB_MIN_MAX_INT16
GrB_MIN_MAX_SEMIRING_INT32, // GxB_MIN_MAX_INT32
GrB_MIN_MAX_SEMIRING_INT64, // GxB_MIN_MAX_INT64
GrB_MIN_MAX_SEMIRING_UINT8, // GxB_MIN_MAX_UINT8
GrB_MIN_MAX_SEMIRING_UINT16, // GxB_MIN_MAX_UINT16
GrB_MIN_MAX_SEMIRING_UINT32, // GxB_MIN_MAX_UINT32
GrB_MIN_MAX_SEMIRING_UINT64, // GxB_MIN_MAX_UINT64
GrB_MIN_MAX_SEMIRING_FP32, // GxB_MIN_MAX_FP32
GrB_MIN_MAX_SEMIRING_FP64, // GxB_MIN_MAX_FP64
//--------------------------------------------------------------------------
// 50 semirings with MAX monoids
//--------------------------------------------------------------------------
// MAX_PLUS semirings for all 10 real, non-boolean types
GrB_MAX_PLUS_SEMIRING_INT8, // GxB_MAX_PLUS_INT8
GrB_MAX_PLUS_SEMIRING_INT16, // GxB_MAX_PLUS_INT16
GrB_MAX_PLUS_SEMIRING_INT32, // GxB_MAX_PLUS_INT32
GrB_MAX_PLUS_SEMIRING_INT64, // GxB_MAX_PLUS_INT64
GrB_MAX_PLUS_SEMIRING_UINT8, // GxB_MAX_PLUS_UINT8
GrB_MAX_PLUS_SEMIRING_UINT16, // GxB_MAX_PLUS_UINT16
GrB_MAX_PLUS_SEMIRING_UINT32, // GxB_MAX_PLUS_UINT32
GrB_MAX_PLUS_SEMIRING_UINT64, // GxB_MAX_PLUS_UINT64
GrB_MAX_PLUS_SEMIRING_FP32, // GxB_MAX_PLUS_FP32
GrB_MAX_PLUS_SEMIRING_FP64, // GxB_MAX_PLUS_FP64
// MAX_TIMES semirings for all 10 real, non-boolean types:
GrB_MAX_TIMES_SEMIRING_INT8, // GxB_MAX_TIMES_INT8
GrB_MAX_TIMES_SEMIRING_INT16, // GxB_MAX_TIMES_INT16
GrB_MAX_TIMES_SEMIRING_INT32, // GxB_MAX_TIMES_INT32
GrB_MAX_TIMES_SEMIRING_INT64, // GxB_MAX_TIMES_INT64
GrB_MAX_TIMES_SEMIRING_UINT8, // GxB_MAX_TIMES_UINT8
GrB_MAX_TIMES_SEMIRING_UINT16, // GxB_MAX_TIMES_UINT16
GrB_MAX_TIMES_SEMIRING_UINT32, // GxB_MAX_TIMES_UINT32
GrB_MAX_TIMES_SEMIRING_UINT64, // GxB_MAX_TIMES_UINT64
GrB_MAX_TIMES_SEMIRING_FP32, // GxB_MAX_TIMES_FP32
GrB_MAX_TIMES_SEMIRING_FP64, // GxB_MAX_TIMES_FP64
// MAX_FIRST semirings for all 10 real, non-boolean types:
GrB_MAX_FIRST_SEMIRING_INT8, // GxB_MAX_FIRST_INT8
GrB_MAX_FIRST_SEMIRING_INT16, // GxB_MAX_FIRST_INT16
GrB_MAX_FIRST_SEMIRING_INT32, // GxB_MAX_FIRST_INT32
GrB_MAX_FIRST_SEMIRING_INT64, // GxB_MAX_FIRST_INT64
GrB_MAX_FIRST_SEMIRING_UINT8, // GxB_MAX_FIRST_UINT8
GrB_MAX_FIRST_SEMIRING_UINT16, // GxB_MAX_FIRST_UINT16
GrB_MAX_FIRST_SEMIRING_UINT32, // GxB_MAX_FIRST_UINT32
GrB_MAX_FIRST_SEMIRING_UINT64, // GxB_MAX_FIRST_UINT64
GrB_MAX_FIRST_SEMIRING_FP32, // GxB_MAX_FIRST_FP32
GrB_MAX_FIRST_SEMIRING_FP64, // GxB_MAX_FIRST_FP64
// MAX_SECOND semirings for all 10 real, non-boolean types:
GrB_MAX_SECOND_SEMIRING_INT8, // GxB_MAX_SECOND_INT8
GrB_MAX_SECOND_SEMIRING_INT16, // GxB_MAX_SECOND_INT16
GrB_MAX_SECOND_SEMIRING_INT32, // GxB_MAX_SECOND_INT32
GrB_MAX_SECOND_SEMIRING_INT64, // GxB_MAX_SECOND_INT64
GrB_MAX_SECOND_SEMIRING_UINT8, // GxB_MAX_SECOND_UINT8
GrB_MAX_SECOND_SEMIRING_UINT16, // GxB_MAX_SECOND_UINT16
GrB_MAX_SECOND_SEMIRING_UINT32, // GxB_MAX_SECOND_UINT32
GrB_MAX_SECOND_SEMIRING_UINT64, // GxB_MAX_SECOND_UINT64
GrB_MAX_SECOND_SEMIRING_FP32, // GxB_MAX_SECOND_FP32
GrB_MAX_SECOND_SEMIRING_FP64, // GxB_MAX_SECOND_FP64
// MAX_MIN semirings for all 10 real, non-boolean types:
GrB_MAX_MIN_SEMIRING_INT8, // GxB_MAX_MIN_INT8
GrB_MAX_MIN_SEMIRING_INT16, // GxB_MAX_MIN_INT16
GrB_MAX_MIN_SEMIRING_INT32, // GxB_MAX_MIN_INT32
GrB_MAX_MIN_SEMIRING_INT64, // GxB_MAX_MIN_INT64
GrB_MAX_MIN_SEMIRING_UINT8, // GxB_MAX_MIN_UINT8
GrB_MAX_MIN_SEMIRING_UINT16, // GxB_MAX_MIN_UINT16
GrB_MAX_MIN_SEMIRING_UINT32, // GxB_MAX_MIN_UINT32
GrB_MAX_MIN_SEMIRING_UINT64, // GxB_MAX_MIN_UINT64
GrB_MAX_MIN_SEMIRING_FP32, // GxB_MAX_MIN_FP32
GrB_MAX_MIN_SEMIRING_FP64, // GxB_MAX_MIN_FP64
//--------------------------------------------------------------------------
// 4 boolean semirings:
//--------------------------------------------------------------------------
GrB_LOR_LAND_SEMIRING_BOOL, // GxB_LOR_LAND_BOOL
GrB_LAND_LOR_SEMIRING_BOOL, // GxB_LAND_LOR_BOOL
GrB_LXOR_LAND_SEMIRING_BOOL, // GxB_LXOR_LAND_BOOL
GrB_LXNOR_LOR_SEMIRING_BOOL ; // GxB_EQ_LOR_BOOL (note EQ == LXNOR)
//==============================================================================
// GrB_*_resize: change the size of a matrix or vector
//==============================================================================
// If the dimensions decrease, entries that fall outside the resized matrix or
// vector are deleted.
GB_PUBLIC
GrB_Info GrB_Matrix_resize // change the size of a matrix
(
GrB_Matrix C, // matrix to modify
GrB_Index nrows_new, // new number of rows in matrix
GrB_Index ncols_new // new number of columns in matrix
) ;
GB_PUBLIC
GrB_Info GrB_Vector_resize // change the size of a vector
(
GrB_Vector w, // vector to modify
GrB_Index nrows_new // new number of rows in vector
) ;
// GxB_*_resize are identical to the GrB_*resize methods above
GB_PUBLIC
GrB_Info GxB_Matrix_resize // change the size of a matrix (historical)
(
GrB_Matrix C, // matrix to modify
GrB_Index nrows_new, // new number of rows in matrix
GrB_Index ncols_new // new number of columns in matrix
) ;
GB_PUBLIC
GrB_Info GxB_Vector_resize // change the size of a vector (historical)
(
GrB_Vector w, // vector to modify
GrB_Index nrows_new // new number of rows in vector
) ;
// GxB_resize is a generic function for resizing a matrix or vector:
// GrB_Vector_resize (u,nrows_new)
// GrB_Matrix_resize (A,nrows_new,ncols_new)
#if GxB_STDC_VERSION >= 201112L
#define GxB_resize(arg1,...) \
_Generic \
( \
(arg1), \
GrB_Vector : GrB_Vector_resize , \
GrB_Matrix : GrB_Matrix_resize \
) \
(arg1, __VA_ARGS__)
#endif
//==============================================================================
// GxB_fprint and GxB_print: print the contents of a GraphBLAS object
//==============================================================================
// GxB_fprint (object, GxB_Print_Level pr, FILE *f) prints the contents of any
// of the 9 GraphBLAS objects to the file f, and also does an extensive test on
// the object to determine if it is valid. It returns one of the following
// error conditions:
//
// GrB_SUCCESS object is valid
// GrB_UNINITIALIZED_OBJECT object is not initialized
// GrB_INVALID_OBJECT object is not valid
// GrB_NULL_POINTER object is a NULL pointer
// GrB_INVALID_VALUE fprintf returned an I/O error; see the ANSI C
// errno or GrB_error( )for details.
//
// GxB_fprint does not modify the status of any object. If a matrix or vector
// has not been completed, the pending computations are guaranteed to *not* be
// performed by GxB_fprint. The reason is simple. It is possible for a bug in
// the user application (such as accessing memory outside the bounds of an
// array) to mangle the internal content of a GraphBLAS object, and GxB_fprint
// can be a helpful tool to track down this bug. If GxB_fprint attempted to
// complete any computations prior to printing or checking the contents of the
// matrix or vector, then further errors could occur, including a segfault.
//
// The type-specific functions include an additional argument, the name string.
// The name is printed at the beginning of the display (assuming pr is not
// GxB_SILENT) so that the object can be more easily identified in the output.
// For the type-generic methods GxB_fprint and GxB_print, the name string is
// the variable name of the object itself.
//
// If f is NULL, stdout is used; this is not an error condition. If pr is
// outside the bounds 0 to 3, negative values are treated as GxB_SILENT, and
// values > 3 are treated as GxB_COMPLETE. If name is NULL, it is treated as
// the empty string.
//
// GxB_print (object, GxB_Print_Level pr) is the same as GxB_fprint, except
// that it prints the contents with printf instead of fprintf to a file f.
//
// The exact content and format of what is printed is implementation-dependent,
// and will change from version to version of SuiteSparse:GraphBLAS. Do not
// attempt to rely on the exact content or format by trying to parse the
// resulting output via another program. The intent of these functions is to
// produce a report of the object for visual inspection.
typedef enum
{
GxB_SILENT = 0, // nothing is printed, just check the object
GxB_SUMMARY = 1, // print a terse summary
GxB_SHORT = 2, // short description, about 30 entries of a matrix
GxB_COMPLETE = 3, // print the entire contents of the object
GxB_SHORT_VERBOSE = 4, // GxB_SHORT but with "%.15g" for doubles
GxB_COMPLETE_VERBOSE = 5 // GxB_COMPLETE but with "%.15g" for doubles
}
GxB_Print_Level ;
GB_PUBLIC
GrB_Info GxB_Type_fprint // print and check a GrB_Type
(
GrB_Type type, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_UnaryOp_fprint // print and check a GrB_UnaryOp
(
GrB_UnaryOp unaryop, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_BinaryOp_fprint // print and check a GrB_BinaryOp
(
GrB_BinaryOp binaryop, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_IndexUnaryOp_fprint // print and check a GrB_IndexUnaryOp
(
GrB_IndexUnaryOp op, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_SelectOp_fprint // print and check a GxB_SelectOp
(
GxB_SelectOp selectop, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Monoid_fprint // print and check a GrB_Monoid
(
GrB_Monoid monoid, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Semiring_fprint // print and check a GrB_Semiring
(
GrB_Semiring semiring, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Descriptor_fprint // print and check a GrB_Descriptor
(
GrB_Descriptor descriptor, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_fprint // print and check a GrB_Matrix
(
GrB_Matrix A, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Vector_fprint // print and check a GrB_Vector
(
GrB_Vector v, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
GB_PUBLIC
GrB_Info GxB_Scalar_fprint // print and check a GrB_Scalar
(
GrB_Scalar s, // object to print and check
const char *name, // name of the object
GxB_Print_Level pr, // print level
FILE *f // file for output
) ;
#if GxB_STDC_VERSION >= 201112L
#define GxB_fprint(object,pr,f) \
_Generic \
( \
(object), \
const GrB_Type : GxB_Type_fprint , \
GrB_Type : GxB_Type_fprint , \
const GrB_UnaryOp : GxB_UnaryOp_fprint , \
GrB_UnaryOp : GxB_UnaryOp_fprint , \
const GrB_BinaryOp : GxB_BinaryOp_fprint , \
GrB_BinaryOp : GxB_BinaryOp_fprint , \
const GrB_IndexUnaryOp : GxB_IndexUnaryOp_fprint , \
GrB_IndexUnaryOp : GxB_IndexUnaryOp_fprint , \
const GxB_SelectOp : GxB_SelectOp_fprint , \
GxB_SelectOp : GxB_SelectOp_fprint , \
const GrB_Monoid : GxB_Monoid_fprint , \
GrB_Monoid : GxB_Monoid_fprint , \
const GrB_Semiring : GxB_Semiring_fprint , \
GrB_Semiring : GxB_Semiring_fprint , \
const GrB_Scalar : GxB_Scalar_fprint , \
GrB_Scalar : GxB_Scalar_fprint , \
const GrB_Vector : GxB_Vector_fprint , \
GrB_Vector : GxB_Vector_fprint , \
const GrB_Matrix : GxB_Matrix_fprint , \
GrB_Matrix : GxB_Matrix_fprint , \
const GrB_Descriptor : GxB_Descriptor_fprint , \
GrB_Descriptor : GxB_Descriptor_fprint \
) \
(object, GB_STR(object), pr, f)
#define GxB_print(object,pr) GxB_fprint(object,pr,NULL)
#endif
//==============================================================================
// Matrix and vector import/export/pack/unpack
//==============================================================================
// The import/export/pack/unpack functions allow the user application to create
// a GrB_Matrix or GrB_Vector object, and to extract its contents, faster and
// with less memory overhead than the GrB_*_build and GrB_*_extractTuples
// functions.
// The semantics of import/export/pack/unpack are the same as the "move
// constructor" in C++. On import, the user provides a set of arrays that have
// been previously allocated via the ANSI C malloc function. The arrays define
// the content of the matrix or vector. Unlike GrB_*_build, the GraphBLAS
// library then takes ownership of the user's input arrays and may either (a)
// incorporate them into its internal data structure for the new GrB_Matrix or
// GrB_Vector, potentially creating the GrB_Matrix or GrB_Vector in constant
// time with no memory copying performed, or (b) if the library does not
// support the import format directly, then it may convert the input to its
// internal format, and then free the user's input arrays. GraphBLAS may also
// choose to use a mix of the two strategies. In either case, the input arrays
// are no longer "owned" by the user application. If A is a GrB_Matrix created
// by an import/pack, the user input arrays are freed no later than GrB_free
// (&A), and may be freed earlier, at the discretion of the GraphBLAS library.
// The data structure of the GrB_Matrix and GrB_Vector remain opaque.
// The export/unpack of a GrB_Matrix or GrB_Vector is symmetric with the import
// operation. The export is destructive, where the GrB_Matrix or GrB_Vector no
// longer exists when the export completes. The GrB_Matrix or GrB_Vector
// exists after an unpack operation, just with no entries. In both export and
// unpack, the user is returned several arrays that contain the matrix or
// vector in the requested format. Ownership of these arrays is given to the
// user application, which is then responsible for freeing them via the ANSI C
// free function. If the output format is supported by the GraphBLAS library,
// then these arrays may be returned to the user application in O(1) time and
// with no memory copying performed. Otherwise, the GraphBLAS library will
// create the output arrays for the user (via the ANSI C malloc function), fill
// them with the GrB_Matrix or GrB_Vector data, and then return the newly
// allocated arrays to the user.
// Eight different formats are provided for import/export. For each format,
// the Ax array has a C-type <type> corresponding to one of the 13 built-in
// types in GraphBLAS (bool, int*_t, uint*_t, float, double, float complex, or
// double complex), or a user-defined type.
// On import/pack, the required user arrays Ah, Ap, Ab, Ai, Aj, and/or Ax must
// be non-NULL pointers to memory space allocated by the ANSI C malloc (or
// calloc, or realloc), unless nzmax is zero (in which case the Ab, Ai, Aj, Ax,
// vb, vi, and vx arrays may all be NULL). For the import, A (or GrB_Vector v)
// is undefined on input, just like GrB_*_new, the GrB_Matrix. If the import
// is successful, the GrB_Matrix A or GrB_Vector v is created, and the pointers
// to the user input arrays have been set to NULL. These user arrays have
// either been incorporated directly into the GrB_Matrix A or GrB_Vector v, in
// which case the user input arrays will eventually be freed by GrB_free (&A),
// or their contents have been copied and the arrays freed. This decision is
// made by the GraphBLAS library itself, and the user application has no
// control over this decision.
// If any of the arrays Ab, Aj, Ai, Ax, vb, vi, or vx have zero size (with
// nzmax of zero), they are allowed to be be NULL pointers on input.
// A matrix or vector may be "iso", where all entries present in the pattern
// have the same value. In this case, the boolean iso flag is true, and the
// corresponding numerical array (Ax for matrices, vx for vectors, below) need
// be only large enough to hold a single value.
// No error checking is performed on the content of the user input arrays. If
// the user input arrays do not conform to the precise specifications above,
// results are undefined. No typecasting of the values of the matrix or vector
// entries is performed on import or export.
// SuiteSparse:GraphBLAS supports all eight formats natively (CSR, CSC,
// HyperCSR, and HyperCSC, BitmapR, BitmapC, FullR, FullC). For vectors, only
// CSC, BitmapC, and FullC formats are used. On import, the all eight formats
// take O(1) time and memory to import. On export, if the GrB_Matrix or
// GrB_Vector is already in this particular format, then the export takes O(1)
// time and no memory copying is performed.
// If the import is not successful, the GxB_Matrix_import_* functions return A
// as NULL, GxB_Vector_import returns v as NULL, and the user input arrays are
// neither modified nor freed. They are still owned by the user application.
// If the input data is untrusted, use the following descriptor setting for
// GxB_Matrix_import* and GxB_Matrix_pack*. The import/pack will be slower,
// but secure. GrB_Matrix_import uses the slow, secure method, since it has
// no descriptor input.
//
// GxB_set (desc, GxB_IMPORT, GxB_SECURE_IMPORT) ;
// As of v5.2.0, GxB_*import* and GxB_*export* are declared historical. Use
// GxB_*pack* and GxB_*unpack* instead. The GxB import/export will be kept
// but only documented here, not in the User Guide.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_CSR: pack a CSR matrix
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_CSR // historical: use GxB_Matrix_pack_CSR
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
GrB_Index **Ap, // row "pointers", Ap_size >= (nrows+1)* sizeof(int64_t)
GrB_Index **Aj, // column indices, Aj_size >= nvals(A) * sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Aj_size, // size of Aj in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
bool jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_CSR // pack a CSR matrix
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
GrB_Index **Ap, // row "pointers", Ap_size >= (nrows+1)* sizeof(int64_t)
GrB_Index **Aj, // column indices, Aj_size >= nvals(A) * sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Aj_size, // size of Aj in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
bool jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
// CSR: an nrows-by-ncols matrix with nvals entries in CSR format consists
// of 3 arrays, where nvals = Ap [nrows]:
//
// GrB_Index Ap [nrows+1], Aj [nvals] ; <type> Ax [nvals] ;
//
// The column indices of entries in the ith row of the matrix are held
// in Aj [Ap [i] ... Ap[i+1]], and the corresponding values are held
// in the same positions in Ax. Column indices must be in the range 0
// to ncols-1. If jumbled is false, the column indices must appear in
// sorted order within each row. No duplicate column indices may
// appear in any row. Ap [0] must equal zero, and Ap [nrows] must
// equal nvals. The Ap array must be of size nrows+1 (or larger), and
// the Aj and Ax arrays must have size at least nvals. If nvals is
// zero, then the Aj and Ax arrays need not be present and can be
// NULL.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_CSC: pack a CSC matrix
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_CSC // historical: use GxB_Matrix_pack_CSC
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
GrB_Index **Ap, // col "pointers", Ap_size >= (ncols+1)*sizeof(int64_t)
GrB_Index **Ai, // row indices, Ai_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ai_size, // size of Ai in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
bool jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_CSC // pack a CSC matrix
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
GrB_Index **Ap, // col "pointers", Ap_size >= (ncols+1)*sizeof(int64_t)
GrB_Index **Ai, // row indices, Ai_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ai_size, // size of Ai in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
bool jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
// CSC: an nrows-by-ncols matrix with nvals entries in CSC format consists
// of 3 arrays, where nvals = Ap [ncols]:
//
// GrB_Index Ap [ncols+1], Ai [nvals] ; <type> Ax [nvals] ;
//
// The row indices of entries in the jth column of the matrix are held
// in Ai [Ap [j] ... Ap[j+1]], and the corresponding values are held
// in the same positions in Ax. Row indices must be in the range 0 to
// nrows-1. If jumbled is false, the row indices must appear in
// sorted order within each column. No duplicate row indices may
// appear in any column. Ap [0] must equal zero, and Ap [ncols] must
// equal nvals. The Ap array must be of size ncols+1 (or larger), and
// the Ai and Ax arrays must have size at least nvals. If nvals is
// zero, then the Ai and Ax arrays need not be present and can be
// NULL.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_HyperCSR: pack a hypersparse CSR matrix
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_HyperCSR // historical: use GxB_Matrix_pack_HyperCSR
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
GrB_Index **Ap, // row "pointers", Ap_size >= (nvec+1)*sizeof(int64_t)
GrB_Index **Ah, // row indices, Ah_size >= nvec*sizeof(int64_t)
GrB_Index **Aj, // column indices, Aj_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ah_size, // size of Ah in bytes
GrB_Index Aj_size, // size of Aj in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvec, // number of rows that appear in Ah
bool jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_HyperCSR // pack a hypersparse CSR matrix
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
GrB_Index **Ap, // row "pointers", Ap_size >= (nvec+1)*sizeof(int64_t)
GrB_Index **Ah, // row indices, Ah_size >= nvec*sizeof(int64_t)
GrB_Index **Aj, // column indices, Aj_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A) * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ah_size, // size of Ah in bytes
GrB_Index Aj_size, // size of Aj in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvec, // number of rows that appear in Ah
bool jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
// HyperCSR: an nrows-by-ncols matrix with nvals entries and nvec
// rows that may have entries in HyperCSR format consists of 4 arrays,
// where nvals = Ap [nvec]:
//
// GrB_Index Ah [nvec], Ap [nvec+1], Aj [nvals] ;
// <type> Ax [nvals] ;
//
// The Aj and Ax arrays are the same for a matrix in CSR or HyperCSR
// format. Only Ap and Ah differ.
//
// The Ah array is a list of the row indices of rows that appear in
// the matrix. It
// must appear in sorted order, and no duplicates may appear. If i =
// Ah [k] is the kth row, then the column indices of the ith
// row appear in Aj [Ap [k] ... Ap [k+1]], and the corresponding
// values appear in the same locations in Ax. Column indices must be
// in the range 0 to ncols-1, and must appear in sorted order within
// each row. No duplicate column indices may appear in any row. nvec
// may be zero, to denote an array with no entries. The Ah array must
// be of size at least nvec, Ap must be of size at least nvec+1, and
// Aj and Ax must be at least of size nvals. If nvals is zero, then
// the Aj and Ax arrays need not be present and can be NULL.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_HyperCSC: pack a hypersparse CSC matrix
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_HyperCSC // historical: use GxB_Matrix_pack_HyperCSC
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
GrB_Index **Ap, // col "pointers", Ap_size >= (nvec+1)*sizeof(int64_t)
GrB_Index **Ah, // column indices, Ah_size >= nvec*sizeof(int64_t)
GrB_Index **Ai, // row indices, Ai_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A)*(type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ah_size, // size of Ah in bytes
GrB_Index Ai_size, // size of Ai in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvec, // number of columns that appear in Ah
bool jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_HyperCSC // pack a hypersparse CSC matrix
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
GrB_Index **Ap, // col "pointers", Ap_size >= (nvec+1)*sizeof(int64_t)
GrB_Index **Ah, // column indices, Ah_size >= nvec*sizeof(int64_t)
GrB_Index **Ai, // row indices, Ai_size >= nvals(A)*sizeof(int64_t)
void **Ax, // values, Ax_size >= nvals(A)*(type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ap_size, // size of Ap in bytes
GrB_Index Ah_size, // size of Ah in bytes
GrB_Index Ai_size, // size of Ai in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvec, // number of columns that appear in Ah
bool jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
// HyperCSC: an nrows-by-ncols matrix with nvals entries and nvec
// columns that may have entries in HyperCSC format consists of 4 arrays,
// where nvals = Ap [nvec]:
//
//
// GrB_Index Ah [nvec], Ap [nvec+1], Ai [nvals] ;
// <type> Ax [nvals] ;
//
// The Ai and Ax arrays are the same for a matrix in CSC or HyperCSC
// format. Only Ap and Ah differ.
//
// The Ah array is a list of the column indices of non-empty columns.
// It must appear in sorted order, and no duplicates may appear. If j
// = Ah [k] is the kth non-empty column, then the row indices of the
// jth column appear in Ai [Ap [k] ... Ap [k+1]], and the
// corresponding values appear in the same locations in Ax. Row
// indices must be in the range 0 to nrows-1, and must appear in
// sorted order within each column. No duplicate row indices may
// appear in any column. nvec may be zero, to denote an array with no
// entries. The Ah array must be of size at least nvec, Ap must be of
// size at least nvec+1, and Ai and Ax must be at least of size nvals.
// If nvals is zero, then the Ai and Ax arrays need not be present and
// can be NULL.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_BitmapR: pack a bitmap matrix, held by row
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_BitmapR // historical: use GxB_Matrix_pack_BitmapR
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
int8_t **Ab, // bitmap, Ab_size >= nrows*ncols
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ab_size, // size of Ab in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_BitmapR // pack a bitmap matrix, held by row
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
int8_t **Ab, // bitmap, Ab_size >= nrows*ncols
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ab_size, // size of Ab in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
// BitmapR: a dense format, but able to represent sparsity structure of A.
//
// int8_t Ab [nrows*ncols] ;
// <type> Ax [nrows*ncols] ;
//
// Ab and Ax are both of size nrows*ncols. Ab [i*ncols+j] = 1 if the
// A(i,j) entry is present with value Ax [i*ncols+j], or 0 if A(i,j)
// is not present. nvals must equal the number of 1's in the Ab
// array.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_BitmapC: pack a bitmap matrix, held by column
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_BitmapC // historical: use GxB_Matrix_pack_BitmapC
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
int8_t **Ab, // bitmap, Ab_size >= nrows*ncols
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ab_size, // size of Ab in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_BitmapC // pack a bitmap matrix, held by column
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
int8_t **Ab, // bitmap, Ab_size >= nrows*ncols
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ab_size, // size of Ab in bytes
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
// BitmapC: a dense format, but able to represent sparsity structure of A.
//
// int8_t Ab [nrows*ncols] ;
// <type> Ax [nrows*ncols] ;
//
// Ab and Ax are both of size nrows*ncols. Ab [i+j*nrows] = 1 if the
// A(i,j) entry is present with value Ax [i+j*nrows], or 0 if A(i,j)
// is not present. nvals must equal the number of 1's in the Ab
// array.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_FullR: pack a full matrix, held by row
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_FullR // historical: use GxB_Matrix_pack_FullR
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_FullR // pack a full matrix, held by row
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
const GrB_Descriptor desc
) ;
// FullR: an nrows-by-ncols full matrix held in row-major order:
//
// <type> Ax [nrows*ncols] ;
//
// Ax is an array of size nrows*ncols, where A(i,j) is held in
// Ax [i*ncols+j]. All entries in A are present.
//------------------------------------------------------------------------------
// GxB_Matrix_pack_FullC: pack a full matrix, held by column
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Matrix_import_FullC // historical: use GxB_Matrix_pack_FullC
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_pack_FullC // pack a full matrix, held by column
(
GrB_Matrix A, // matrix to create (type, nrows, ncols unchanged)
void **Ax, // values, Ax_size >= nrows*ncols * (type size)
// or Ax_size >= (type size), if iso is true
GrB_Index Ax_size, // size of Ax in bytes
bool iso, // if true, A is iso
const GrB_Descriptor desc
) ;
// FullC: an nrows-by-ncols full matrix held in column-major order:
//
// <type> Ax [nrows*ncols] ;
//
// Ax is an array of size nrows*ncols, where A(i,j) is held in
// Ax [i+j*nrows]. All entries in A are present.
//------------------------------------------------------------------------------
// GxB_Vector_pack_CSC: import/pack a vector in CSC format
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Vector_import_CSC // historical: use GxB_Vector_pack_CSC
(
GrB_Vector *v, // handle of vector to create
GrB_Type type, // type of vector to create
GrB_Index n, // vector length
GrB_Index **vi, // indices, vi_size >= nvals(v) * sizeof(int64_t)
void **vx, // values, vx_size >= nvals(v) * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vi_size, // size of vi in bytes
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
GrB_Index nvals, // # of entries in vector
bool jumbled, // if true, indices may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_pack_CSC // pack a vector in CSC format
(
GrB_Vector v, // vector to create (type and length unchanged)
GrB_Index **vi, // indices, vi_size >= nvals(v) * sizeof(int64_t)
void **vx, // values, vx_size >= nvals(v) * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vi_size, // size of vi in bytes
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
GrB_Index nvals, // # of entries in vector
bool jumbled, // if true, indices may be unsorted
const GrB_Descriptor desc
) ;
// The GrB_Vector is treated as if it was a single column of an n-by-1
// matrix in CSC format, except that no vp array is required. If nvals is
// zero, then the vi and vx arrays need not be present and can be NULL.
//------------------------------------------------------------------------------
// GxB_Vector_pack_Bitmap: pack a vector in bitmap format
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Vector_import_Bitmap // historical: GxB_Vector_pack_Bitmap
(
GrB_Vector *v, // handle of vector to create
GrB_Type type, // type of vector to create
GrB_Index n, // vector length
int8_t **vb, // bitmap, vb_size >= n
void **vx, // values, vx_size >= n * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vb_size, // size of vb in bytes
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_pack_Bitmap // pack a bitmap vector
(
GrB_Vector v, // vector to create (type and length unchanged)
int8_t **vb, // bitmap, vb_size >= n
void **vx, // values, vx_size >= n * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vb_size, // size of vb in bytes
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
GrB_Index nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
// The GrB_Vector is treated as if it was a single column of an n-by-1
// matrix in BitmapC format.
//------------------------------------------------------------------------------
// GxB_Vector_pack_Full: pack a vector in full format
//------------------------------------------------------------------------------
GB_PUBLIC
GrB_Info GxB_Vector_import_Full // historical: use GxB_Vector_pack_Full
(
GrB_Vector *v, // handle of vector to create
GrB_Type type, // type of vector to create
GrB_Index n, // vector length
void **vx, // values, vx_size >= nvals(v) * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_pack_Full // pack a full vector
(
GrB_Vector v, // vector to create (type and length unchanged)
void **vx, // values, vx_size >= nvals(v) * (type size)
// or vx_size >= (type size), if iso is true
GrB_Index vx_size, // size of vx in bytes
bool iso, // if true, v is iso
const GrB_Descriptor desc
) ;
// The GrB_Vector is treated as if it was a single column of an n-by-1
// matrix in FullC format.
//------------------------------------------------------------------------------
// GxB* export/unpack
//------------------------------------------------------------------------------
// The GxB_*_export/unpack functions are symmetric with the GxB_*_import/pack
// functions. The export/unpack functions force completion of any pending
// operations, prior to the export, except if the only pending operation is to
// unjumble the matrix.
//
// If there are no entries in the matrix or vector, then the index arrays (Ai,
// Aj, or vi) and value arrays (Ax or vx) are returned as NULL. This is not an
// error condition.
//
// A GrB_Matrix may be exported/unpacked in any one of four different formats.
// On successful export, the input GrB_Matrix A is freed, and the output arrays
// Ah, Ap, Ai, Aj, and/or Ax are returned to the user application as arrays
// allocated by the ANSI C malloc function. The four formats are the same as
// the import formats for GxB_Matrix_import/pack.
//
// If jumbled is NULL on input, this indicates to GxB_*export/unpack* that the
// exported/unpacked matrix cannot be returned in a jumbled format. In this
// case, if the matrix is jumbled, it is sorted before exporting it to the
// caller.
//
// If iso is NULL on input, this indicates to the export/unpack methods that
// the exported/unpacked matrix cannot be returned in a iso format, with an Ax
// array with just one entry. In this case, if the matrix is iso, it is
// expanded before exporting/unpacking it to the caller.
//
// For the export/unpack*Full* methods, all entries in the matrix or must be
// present. That is, GrB_*_nvals must report nvals equal to nrows*ncols or a
// matrix. If this condition does not hold, the matrix/vector is not exported,
// and GrB_INVALID_VALUE is returned.
//
// If the export/unpack is not successful, the export/unpack functions do not
// modify matrix or vector and the user arrays are returned as NULL.
GB_PUBLIC
GrB_Info GxB_Matrix_export_CSR // historical: use GxB_Matrix_unpack_CSR
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
GrB_Index **Ap, // row "pointers"
GrB_Index **Aj, // column indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Aj_size, // size of Aj in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
bool *jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_CSR // unpack a CSR matrix
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
GrB_Index **Ap, // row "pointers"
GrB_Index **Aj, // column indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Aj_size, // size of Aj in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
bool *jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_CSC // historical: use GxB_Matrix_unpack_CSC
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
GrB_Index **Ap, // column "pointers"
GrB_Index **Ai, // row indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ai_size, // size of Ai in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
bool *jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_CSC // unpack a CSC matrix
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
GrB_Index **Ap, // column "pointers"
GrB_Index **Ai, // row indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ai_size, // size of Ai in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
bool *jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_HyperCSR // historical: use GxB_Matrix_unpack_HyperCSR
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
GrB_Index **Ap, // row "pointers"
GrB_Index **Ah, // row indices
GrB_Index **Aj, // column indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ah_size, // size of Ah in bytes
GrB_Index *Aj_size, // size of Aj in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvec, // number of rows that appear in Ah
bool *jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_HyperCSR // unpack a hypersparse CSR matrix
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
GrB_Index **Ap, // row "pointers"
GrB_Index **Ah, // row indices
GrB_Index **Aj, // column indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ah_size, // size of Ah in bytes
GrB_Index *Aj_size, // size of Aj in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvec, // number of rows that appear in Ah
bool *jumbled, // if true, indices in each row may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_HyperCSC // historical: use GxB_Matrix_unpack_HyperCSC
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
GrB_Index **Ap, // column "pointers"
GrB_Index **Ah, // column indices
GrB_Index **Ai, // row indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ah_size, // size of Ah in bytes
GrB_Index *Ai_size, // size of Ai in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvec, // number of columns that appear in Ah
bool *jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_HyperCSC // unpack a hypersparse CSC matrix
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
GrB_Index **Ap, // column "pointers"
GrB_Index **Ah, // column indices
GrB_Index **Ai, // row indices
void **Ax, // values
GrB_Index *Ap_size, // size of Ap in bytes
GrB_Index *Ah_size, // size of Ah in bytes
GrB_Index *Ai_size, // size of Ai in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvec, // number of columns that appear in Ah
bool *jumbled, // if true, indices in each column may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_BitmapR // historical: use GxB_Matrix_unpack_BitmapR
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
int8_t **Ab, // bitmap
void **Ax, // values
GrB_Index *Ab_size, // size of Ab in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_BitmapR // unpack a bitmap matrix, by row
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
int8_t **Ab, // bitmap
void **Ax, // values
GrB_Index *Ab_size, // size of Ab in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_BitmapC // historical: use GxB_Matrix_unpack_BitmapC
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
int8_t **Ab, // bitmap
void **Ax, // values
GrB_Index *Ab_size, // size of Ab in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_BitmapC // unpack a bitmap matrix, by col
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
int8_t **Ab, // bitmap
void **Ax, // values
GrB_Index *Ab_size, // size of Ab in bytes
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_FullR // historical: use GxB_Matrix_unpack_FullR
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
void **Ax, // values
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_FullR // unpack a full matrix, by row
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
void **Ax, // values
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_FullC // historical: use GxB_Matrix_unpack_FullC
(
GrB_Matrix *A, // handle of matrix to export and free
GrB_Type *type, // type of matrix exported
GrB_Index *nrows, // number of rows of the matrix
GrB_Index *ncols, // number of columns of the matrix
void **Ax, // values
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_unpack_FullC // unpack a full matrix, by column
(
GrB_Matrix A, // matrix to unpack (type, nrows, ncols unchanged)
void **Ax, // values
GrB_Index *Ax_size, // size of Ax in bytes
bool *iso, // if true, A is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_export_CSC // historical: use GxB_Vector_unpack_CSC
(
GrB_Vector *v, // handle of vector to export and free
GrB_Type *type, // type of vector exported
GrB_Index *n, // length of the vector
GrB_Index **vi, // indices
void **vx, // values
GrB_Index *vi_size, // size of vi in bytes
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
GrB_Index *nvals, // # of entries in vector
bool *jumbled, // if true, indices may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_unpack_CSC // unpack a CSC vector
(
GrB_Vector v, // vector to unpack (type and length unchanged)
GrB_Index **vi, // indices
void **vx, // values
GrB_Index *vi_size, // size of vi in bytes
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
GrB_Index *nvals, // # of entries in vector
bool *jumbled, // if true, indices may be unsorted
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_export_Bitmap // historical: use GxB_Vector_unpack_Bitmap
(
GrB_Vector *v, // handle of vector to export and free
GrB_Type *type, // type of vector exported
GrB_Index *n, // length of the vector
int8_t **vb, // bitmap
void **vx, // values
GrB_Index *vb_size, // size of vb in bytes
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_unpack_Bitmap // unpack a bitmap vector
(
GrB_Vector v, // vector to unpack (type and length unchanged)
int8_t **vb, // bitmap
void **vx, // values
GrB_Index *vb_size, // size of vb in bytes
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
GrB_Index *nvals, // # of entries in bitmap
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_export_Full // historical: use GxB_Vector_unpack_Full
(
GrB_Vector *v, // handle of vector to export and free
GrB_Type *type, // type of vector exported
GrB_Index *n, // length of the vector
void **vx, // values
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Vector_unpack_Full // unpack a full vector
(
GrB_Vector v, // vector to unpack (type and length unchanged)
void **vx, // values
GrB_Index *vx_size, // size of vx in bytes
bool *iso, // if true, v is iso
const GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// GxB hyper_hash pack/unpack
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS v7.3.0 adds a new internal component to the
// hypersparse matrix format: the hyper_hash GrB_Matrix A->Y. The matrix
// provides a fast lookup into the hyperlist Ah.
// GxB_unpack_HyperHash unpacks the hyper_hash from the hypersparse matrix A.
// Normally, this method is called immediately before calling one of the four
// methods GxB_Matrix_(export/unpack)_Hyper(CSR/CSC). For example, to unpack
// then pack a hypersparse CSC matrix:
// GrB_Matrix Y = NULL ;
//
// // to unpack all of A:
// GxB_unpack_HyperHash (A, &Y, desc) ; // first unpack A->Y into Y
// GxB_Matrix_unpack_HyperCSC (A, // then unpack the rest of A
// &Ap, &Ah, &Ai, &Ax, &Ap_size, &Ah_size, &Ai_size, &Ax_size,
// &iso, &nvec, &jumbled, descriptor) ;
//
// // use the unpacked contents of A here, but do not change Ah or nvec.
// ...
//
// // to pack the data back into A:
// GxB_Matrix_pack_HyperCSC (A, ...) ; // pack most of A, except A->Y
// GxB_pack_HyperHash (A, &Y, desc) ; // then pack A->Y
// The same process is used with GxB_Matrix_unpack_HyperCSR,
// an the GxB_Matrix_export_Hyper* and GxB_Matrix_import_Hyper* methods.
// If A is not hypersparse on input to GxB_unpack_HyperHash, or if A is
// hypersparse but does yet not have a hyper_hash, then Y is returned as NULL.
// This is not an error condition, and GrB_SUCCESS is returned. The hyper_hash
// of a hypersparse matrix A is a matrix that provides quick access to the
// inverse of Ah. It is not always needed and may not be present. It is left
// as pending work to be computed when needed. GrB_Matrix_wait (A) will ensure
// that the hyper_hash is constructed, if A is hypersparse.
// If Y is moved from A and returned as non-NULL to the caller, then it is
// the responsibility of the user application to free it, or to re-pack it back
// into A via GxB_pack_HyperHash, as shown in the example above.
// If this method is called to remove the hyper_hash Y from the hypersparse
// matrix A, and then GrB_Matrix_wait (A) is called, a new hyper_hash matrix is
// constructed for A.
GB_PUBLIC
GrB_Info GxB_unpack_HyperHash // move A->Y into Y
(
GrB_Matrix A, // matrix to modify
GrB_Matrix *Y, // hyper_hash matrix to move from A
const GrB_Descriptor desc // unused
) ;
// GxB_pack_HyperHash assigns the input Y matrix as the A->Y hyper_hash of the
// hypersparse matrix A. Normally, this method is called immediately after
// calling one of the four methods GxB_Matrix_(import/pack)_Hyper(CSR/CSC).
// If A is not hypersparse on input to GxB_pack_HyperHash, or if A already has
// a hyper_hash matrix, or if Y is NULL on input, then nothing happens and Y is
// unchanged. This is not an error condition and this method returns
// GrB_SUCCESS. In this case, if Y is non-NULL after calling this method, it
// owned by the user application and freeing it is the responsibility of the
// user application.
// Basic checks are perfomed on Y: Y must have the right dimensions: if A is
// HyperCSR and m-by-n with nvec vectors present in Ah, then Y must be n-by-v
// where v is a power of 2; if A is HyperCSR and m-by-n, then Y must be m-by-v.
// nvals(Y) must equal nvec. Y must be sparse, held by column, and have type
// int64. It cannot have any pending work. It cannot have a hyper_hash
// of its own. If any of these conditions hold, GrB_INVALID is returned and
// A and Y are unchanged.
// If Y is moved into A as its hyper_hash, then the caller's Y is set to NULL
// to indicate that it has been moved into A. It is no longer owned by the
// caller, but is instead an opaque component of the A matrix. It will be
// freed by SuiteSparse:GraphBLAS if A is modified or freed.
// Results are undefined if the input Y was not created by GxB_unpack_HyperHash
// (see the example above) or if the Ah contents or nvec of the matrix A are
// modified after they were exported/unpacked by
// GxB_Matrix_(export/unpack)_Hyper(CSR/CSC).
GB_PUBLIC
GrB_Info GxB_pack_HyperHash // move Y into A->Y
(
GrB_Matrix A, // matrix to modify
GrB_Matrix *Y, // hyper_hash matrix to pack into A
const GrB_Descriptor desc // unused
) ;
//==============================================================================
// GrB import/export
//==============================================================================
// The GrB_Matrix_import method copies from user-provided arrays into an
// opaque GrB_Matrix and GrB_Matrix_export copies data out, from an opaque
// GrB_Matrix into user-provided arrays. Unlike the GxB pack/unpack methods,
// memory is not handed off between the user application and GraphBLAS.
// These methods are much slower than the GxB pack/unpack methods, since they
// require a copy of the data to be made. GrB_Matrix_import also must assume
// its input data cannot be trusted, and so it does extensive checks. The GxB
// pack takes O(1) time in all cases (unless it is told the input data is
// untrusted, via the descriptor). GxB unpack takes O(1) time unless the
// matrix is exported in a different format than it currently has.
// No typecasting of the values is done on import or export.
// The GrB C API specification supports 3 formats:
typedef enum
{
GrB_CSR_FORMAT = 0, // CSR format (equiv to GxB_SPARSE with GxB_BY_ROW)
GrB_CSC_FORMAT = 1, // CSC format (equiv to GxB_SPARSE with GxB_BY_COL)
GrB_COO_FORMAT = 2 // triplet format (like input to GrB*build)
}
GrB_Format ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_BOOL // import a GrB_BOOL matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_BOOL)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const bool *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_INT8 // import a GrB_INT8 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_iNT8)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const int8_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_INT16 // import a GrB_INT16 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_INT16)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const int16_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_INT32 // import a GrB_INT32 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_INT32)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const int32_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_INT64 // import a GrB_INT64 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_INT64)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const int64_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_UINT8 // import a GrB_UINT8 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_UINT8)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const uint8_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_UINT16 // import a GrB_UINT16 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_UINT16)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const uint16_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_UINT32 // import a GrB_UINT32 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_UINT32)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const uint32_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_UINT64 // import a GrB_UINT64 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_UINT64)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const uint64_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_FP32 // import a GrB_FP32 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_FP32)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const float *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_FP64 // import a GrB_FP64 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GrB_FP64)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const double *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_import_FC32 // import a GxB_FC32 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GxB_FC32)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const GxB_FC32_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_import_FC64 // import a GxB_FC64 matrix
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create (must be GxB_FC64)
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const GxB_FC64_t *Ax, // values
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_import_UDT // import a matrix with a user-defined type
(
GrB_Matrix *A, // handle of matrix to create
GrB_Type type, // type of matrix to create
GrB_Index nrows, // number of rows of the matrix
GrB_Index ncols, // number of columns of the matrix
const GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
const GrB_Index *Ai, // row indices for CSR, CSC
const void *Ax, // values (must match the type parameter)
GrB_Index Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format // import format
) ;
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_import(A,type,nrows,ncols,Ap,Ai,Ax,Ap_len,Ai_len,Ax_len,fmt)\
_Generic \
( \
(Ax), \
GB_CASES (*, GrB, Matrix_import) \
) \
(A, type, nrows, ncols, Ap, Ai, Ax, Ap_len, Ai_len, Ax_len, fmt)
#endif
// For GrB_Matrix_export_T: on input, Ap_len, Ai_len, and Ax_len are
// the size of the 3 arrays Ap, Ai, and Ax, in terms of the # of entries.
// On output, these 3 values are modified to be the # of entries copied
// into those 3 arrays.
GB_PUBLIC
GrB_Info GrB_Matrix_export_BOOL // export a GrB_BOOL matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
bool *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_BOOL)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_INT8 // export a GrB_INT8 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
int8_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_INT8)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_INT16 // export a GrB_INT16 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
int16_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_INT16)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_INT32 // export a GrB_INT32 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
int32_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_INT32)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_INT64 // export a GrB_INT64 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
int64_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_INT64)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_UINT8 // export a GrB_UINT8 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
uint8_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_UINT8)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_UINT16 // export a GrB_UINT16 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
uint16_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_UINT16)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_UINT32 // export a GrB_UINT32 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
uint32_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_UINT32)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_UINT64 // export a GrB_UINT64 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
uint64_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_UINT64)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_FP32 // export a GrB_FP32 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
float *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_FP32)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_FP64 // export a GrB_FP64 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
double *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_FP64)
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_FC32 // export a GrB_FC32 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
GxB_FC32_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_FC32)
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_export_FC64 // export a GrB_FC64 matrix
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
GxB_FC64_t *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export (must be of type GrB_FC64)
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_export_UDT // export a matrix with a user-defined type
(
GrB_Index *Ap, // pointers for CSR, CSC, column indices for COO
GrB_Index *Ai, // col indices for CSR/COO, row indices for CSC
void *Ax, // values (must match the type of A)
GrB_Index *Ap_len, // number of entries in Ap (not # of bytes)
GrB_Index *Ai_len, // number of entries in Ai (not # of bytes)
GrB_Index *Ax_len, // number of entries in Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export
) ;
#if GxB_STDC_VERSION >= 201112L
#define GrB_Matrix_export(Ap,Ai,Ax,Ap_len,Ai_len,Ax_len,fmt,A) \
_Generic \
( \
(Ax), \
GB_CASES (*, GrB, Matrix_export) \
) \
(Ap, Ai, Ax, Ap_len, Ai_len, Ax_len, fmt, A)
#endif
GB_PUBLIC
GrB_Info GrB_Matrix_exportSize // determine sizes of user arrays for export
(
GrB_Index *Ap_len, // # of entries required for Ap (not # of bytes)
GrB_Index *Ai_len, // # of entries required for Ai (not # of bytes)
GrB_Index *Ax_len, // # of entries required for Ax (not # of bytes)
GrB_Format format, // export format
GrB_Matrix A // matrix to export
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_exportHint // suggest the best export format
(
GrB_Format *format, // export format
GrB_Matrix A // matrix to export
) ;
//==============================================================================
// serialize/deserialize
//==============================================================================
// GxB_Matrix_serialize copies the contents of a GrB_Matrix into a single array
// of bytes (the "blob"). The contents of the blob are implementation
// dependent. The blob can be saved to a file, or sent across a communication
// channel, and then a GrB_Matrix can be reconstructed from the blob, even on
// another process or another machine, using the same version of
// SuiteSparse:GraphBLAS (v5.2.0 or later). The goal is that future versions
// of SuiteSparse:GraphBLAS should be able to read in the blob as well, and
// reconstruct a matrix. The matrix can be reconstructed from the blob using
// GxB_Matrix_deserialize. The blob is compressed, by default, and
// uncompressed by GxB_Matrix_deserialize.
// GrB_Matrix_serialize/deserialize are slightly different from their GxB*
// counterparts. The blob is allocated by GxB_Matrix_serialize, and must be
// freed by the same free() method passed to GxB_init (or the ANSI C11 free()
// if GrB_init was used). By contrast, the GrB* methods require the user
// application to pass in a preallocated blob to GrB_Matrix_serialize, whose
// size can be given by GrB_Matrix_serializeSize (as a loose upper bound).
// The GrB* and GxB* methods can be mixed. GrB_Matrix_serialize and
// GxB_Matrix_serialize construct the same blob (assuming they are given the
// same # of threads to do the work). Both GrB_Matrix_deserialize and
// GxB_Matrix_deserialize can deserialize a blob coming from either
// GrB_Matrix_serialize or GxB_Matrix_serialize.
// Deserialization of untrusted data is a common security problem; see
// https://cwe.mitre.org/data/definitions/502.html. The deserialization methods
// below do a few basic checks so that no out-of-bounds access occurs during
// deserialization, but the output matrix itself may still be corrupted. If
// the data is untrusted, use this to check the matrix:
// GxB_Matrix_fprint (A, "A deserialized", GrB_SILENT, NULL)
// Example usage:
/*
//--------------------------------------------------------------------------
// using GxB serialize/deserialize
//--------------------------------------------------------------------------
// Given a GrB_Matrix A: assuming a user-defined type:
void *blob ;
GrB_Index blob_size ;
GxB_Matrix_serialize (&blob, &blob_size, A, NULL) ;
FILE *f = fopen ("myblob", "w") ;
fwrite (blob_size, sizeof (size_t), 1, f) ;
fwrite (blob, sizeof (uint8_t), blob_size, f) ;
fclose (f) ;
GrB_Matrix_free (&A) ;
// B is a copy of A
GxB_Matrix_deserialize (&B, MyQtype, blob, blob_size, NULL) ;
GrB_Matrix_free (&B) ;
free (blob) ;
GrB_finalize ( ) ;
// --- in another process, to recreate the GrB_Matrix A:
GrB_init (GrB_NONBLOCKING) ;
FILE *f = fopen ("myblob", "r") ;
fread (&blob_size, sizeof (size_t), 1, f) ;
blob = malloc (blob_size) ;
fread (blob, sizeof (uint8_t), blob_size, f) ;
fclose (f) ;
char type_name [GxB_MAX_NAME_LEN] ;
GxB_deserialize_type_name (type_name, blob, blob_size) ;
printf ("blob type is: %s\n", type_name) ;
GrB_Type user_type = NULL ;
if (strncmp (type_name, "myquaternion", GxB_MAX_NAME_LEN) == 0)
user_type = MyQtype ;
GxB_Matrix_deserialize (&A, user_type, blob, blob_size, NULL) ;
free (blob) ; // note, freed by the user, not GraphBLAS
//--------------------------------------------------------------------------
// using GrB serialize/deserialize
//--------------------------------------------------------------------------
// Given a GrB_Matrix A: assuming a user-defined type, MyQType:
void *blob = NULL ;
GrB_Index blob_size = 0 ;
GrB_Matrix A, B = NULL ;
// construct a matrix A, then serialized it:
GrB_Matrix_serializeSize (&blob_size, A) ; // loose upper bound
blob = malloc (blob_size) ;
GrB_Matrix_serialize (blob, &blob_size, A) ; // returns actual size
blob = realloc (blob, blob_size) ; // user can shrink the blob
FILE *f = fopen ("myblob", "w") ;
fwrite (blob_size, sizeof (size_t), 1, f) ;
fwrite (blob, sizeof (uint8_t), blob_size, f) ;
fclose (f) ;
GrB_Matrix_free (&A) ;
// B is a copy of A:
GrB_Matrix_deserialize (&B, MyQtype, blob, blob_size) ;
GrB_Matrix_free (&B) ;
free (blob) ;
GrB_finalize ( ) ;
// --- in another process, to recreate the GrB_Matrix A:
GrB_init (GrB_NONBLOCKING) ;
FILE *f = fopen ("myblob", "r") ;
fread (&blob_size, sizeof (size_t), 1, f) ;
blob = malloc (blob_size) ;
fread (blob, sizeof (uint8_t), blob_size, f) ;
fclose (f) ;
// the user must know the type of A is MyQType
GrB_Matrix_deserialize (&A, MyQtype, blob, blob_size) ;
free (blob) ;
*/
// Currently implemented: no compression, LZ4, LZ4HC, and ZSTD
#define GxB_COMPRESSION_NONE -1 // no compression
#define GxB_COMPRESSION_DEFAULT 0 // ZSTD (level 1)
#define GxB_COMPRESSION_LZ4 1000 // LZ4
#define GxB_COMPRESSION_LZ4HC 2000 // LZ4HC, with default level 9
#define GxB_COMPRESSION_ZSTD 3000 // ZSTD, with default level 1
#define GxB_COMPRESSION_INTEL 1000000 // not yet supported
// Most of the above methods have a level parameter that controls the tradeoff
// between run time and the amount of compression obtained. Higher levels
// result in a more compact result, at the cost of higher run time:
// LZ4 no level setting
// LZ4HC 1: fast, 9: default, 9: max
// ZSTD: 1: fast, 1: default, 19: max
// For all methods, a level of zero results in the default level setting.
// These settings can be added, so to use LZ4HC at level 5, use method =
// GxB_COMPRESSION_LZ4HC + 5.
// If the level setting is out of range, the default is used for that method.
// If the method is negative, no compression is performed. If the method is
// positive but unrecognized, the default is used (GxB_COMPRESSION_ZSTD,
// level 1).
GB_PUBLIC
GrB_Info GxB_Matrix_serialize // serialize a GrB_Matrix to a blob
(
// output:
void **blob_handle, // the blob, allocated on output
GrB_Index *blob_size_handle, // size of the blob on output
// input:
GrB_Matrix A, // matrix to serialize
const GrB_Descriptor desc // descriptor to select compression method
// and to control # of threads used
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_serialize // serialize a GrB_Matrix to a blob
(
// output:
void *blob, // the blob, already allocated in input
// input/output:
GrB_Index *blob_size_handle, // size of the blob on input. On output,
// the # of bytes used in the blob.
// input:
GrB_Matrix A // matrix to serialize
) ;
GB_PUBLIC
GrB_Info GxB_Vector_serialize // serialize a GrB_Vector to a blob
(
// output:
void **blob_handle, // the blob, allocated on output
GrB_Index *blob_size_handle, // size of the blob on output
// input:
GrB_Vector u, // vector to serialize
const GrB_Descriptor desc // descriptor to select compression method
// and to control # of threads used
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_serializeSize // estimate the size of a blob
(
// output:
GrB_Index *blob_size_handle, // upper bound on the required size of the
// blob on output.
// input:
GrB_Matrix A // matrix to serialize
) ;
// The GrB* and GxB* deserialize methods are nearly identical. The GxB*
// deserialize methods simply add the descriptor, which allows for optional
// control of the # of threads used to deserialize the blob.
GB_PUBLIC
GrB_Info GxB_Matrix_deserialize // deserialize blob into a GrB_Matrix
(
// output:
GrB_Matrix *C, // output matrix created from the blob
// input:
GrB_Type type, // type of the matrix C. Required if the blob holds a
// matrix of user-defined type. May be NULL if blob
// holds a built-in type; otherwise must match the
// type of C.
const void *blob, // the blob
GrB_Index blob_size, // size of the blob
const GrB_Descriptor desc // to control # of threads used
) ;
GB_PUBLIC
GrB_Info GrB_Matrix_deserialize // deserialize blob into a GrB_Matrix
(
// output:
GrB_Matrix *C, // output matrix created from the blob
// input:
GrB_Type type, // type of the matrix C. Required if the blob holds a
// matrix of user-defined type. May be NULL if blob
// holds a built-in type; otherwise must match the
// type of C.
const void *blob, // the blob
GrB_Index blob_size // size of the blob
) ;
GB_PUBLIC
GrB_Info GxB_Vector_deserialize // deserialize blob into a GrB_Vector
(
// output:
GrB_Vector *w, // output vector created from the blob
// input:
GrB_Type type, // type of the vector w. Required if the blob holds a
// vector of user-defined type. May be NULL if blob
// holds a built-in type; otherwise must match the
// type of w.
const void *blob, // the blob
GrB_Index blob_size, // size of the blob
const GrB_Descriptor desc // to control # of threads used
) ;
// GxB_deserialize_type_name extracts the type_name of the GrB_Type of the
// GrB_Matrix or GrB_Vector held in a serialized blob. On input, type_name
// must point to a user-owned char array of size at least GxB_MAX_NAME_LEN (it
// must not point into the blob itself). On output, type_name will contain a
// null-terminated string with the corresponding C type name. If the blob
// holds a matrix of a built-in type, the name is returned as "bool" for
// GrB_BOOL, "uint8_t" for GrB_UINT8, "float complex" for GxB_FC32, etc.
// See GxB_Type_name to convert this name into a GrB_Type.
GB_PUBLIC
GrB_Info GxB_deserialize_type_name // return the type name of a blob
(
// output:
char *type_name, // name of the type (char array of size at least
// GxB_MAX_NAME_LEN, owned by the user application).
// input, not modified:
const void *blob, // the blob
GrB_Index blob_size // size of the blob
) ;
//==============================================================================
// GxB_Vector_sort and GxB_Matrix_sort: sort a matrix or vector
//==============================================================================
GB_PUBLIC
GrB_Info GxB_Vector_sort
(
// output:
GrB_Vector w, // vector of sorted values
GrB_Vector p, // vector containing the permutation
// input
GrB_BinaryOp op, // comparator op
GrB_Vector u, // vector to sort
const GrB_Descriptor desc
) ;
GB_PUBLIC
GrB_Info GxB_Matrix_sort
(
// output:
GrB_Matrix C, // matrix of sorted values
GrB_Matrix P, // matrix containing the permutations
// input
GrB_BinaryOp op, // comparator op
GrB_Matrix A, // matrix to sort
const GrB_Descriptor desc
) ;
#define GxB_sort(arg1,...) \
_Generic \
( \
(arg1), \
GrB_Vector : GxB_Vector_sort , \
GrB_Matrix : GxB_Matrix_sort \
) \
(arg1, __VA_ARGS__)
//==============================================================================
// GxB_Matrix_reshape and GxB_Matrix_reshapeDup: reshape a matrix
//==============================================================================
// GxB_Matrix_reshape changes the dimensions of a matrix, reshaping the entries
// by row or by column.
// For example, if C is 3-by-4 on input, and is reshaped by column to have
// dimensions 2-by-6:
// C on input C on output (by_col true)
// 00 01 02 03 00 20 11 02 22 13
// 10 11 12 13 10 01 21 12 03 23
// 20 21 22 23
// If the same C on input is reshaped by row to dimensions 2-by-6:
// C on input C on output (by_col false)
// 00 01 02 03 00 01 02 03 10 11
// 10 11 12 13 12 13 20 21 22 23
// 20 21 22 23
// If the input matrix is nrows-by-ncols, and the size of the reshaped matrix
// is nrows_new-by-ncols_new, then nrows*ncols must equal nrows_new*ncols_new.
// The format of the input matrix (by row or by column) is unchanged; this
// format need not match the by_col input parameter.
GB_PUBLIC
GrB_Info GxB_Matrix_reshape // reshape a GrB_Matrix in place
(
// input/output:
GrB_Matrix C, // input/output matrix, reshaped in place
// input:
bool by_col, // true if reshape by column, false if by row
GrB_Index nrows_new, // new number of rows of C
GrB_Index ncols_new, // new number of columns of C
const GrB_Descriptor desc // to control # of threads used
) ;
// GxB_Matrix_reshapeDup reshapes a matrix into another matrix.
// If the input matrix A is nrows-by-ncols, and the size of the newly-created
// matrix C is nrows_new-by-ncols_new, then nrows*ncols must equal
// nrows_new*ncols_new. The format of the input matrix A (by row or by column)
// determines the format of the output matrix C, which need not match the
// by_col input parameter.
GB_PUBLIC
GrB_Info GxB_Matrix_reshapeDup // reshape a GrB_Matrix into another GrB_Matrix
(
// output:
GrB_Matrix *C, // newly created output matrix, not in place
// input:
GrB_Matrix A, // input matrix, not modified
bool by_col, // true if reshape by column, false if by row
GrB_Index nrows_new, // number of rows of C
GrB_Index ncols_new, // number of columns of C
const GrB_Descriptor desc // to control # of threads used
) ;
//==============================================================================
// GxB_Iterator: an object that iterates over the entries of a matrix or vector
//==============================================================================
/* Example usage:
single thread iteration of a whole matrix, one row at a time (in the
outer loop), and one entry at a time within the row (in the inner loop):
// create an iterator
GxB_Iterator iterator ;
GxB_Iterator_new (&iterator) ;
// attach it to the matrix A, known to be type GrB_FP64
GrB_Info info = GxB_rowIterator_attach (iterator, A, NULL) ;
if (info < 0) { handle the failure ... }
// seek to A(0,:)
info = GxB_rowIterator_seekRow (iterator, 0) ;
while (info != GxB_EXHAUSTED)
{
// iterate over entries in A(i,:)
GrB_Index i = GxB_rowIterator_getRowIndex (iterator) ;
while (info == GrB_SUCCESS)
{
// get the entry A(i,j)
GrB_Index j = GxB_rowIterator_getColIndex (iterator) ;
double aij = GxB_Iterator_get_FP64 (iterator) ;
// move to the next entry in A(i,:)
info = GxB_rowIterator_nextCol (iterator) ;
}
// move to the next row, A(i+1,:)
info = GxB_rowIterator_nextRow (iterator) ;
}
GrB_free (&iterator) ;
parallel iteration using 4 threads (work may be imbalanced however):
GrB_Index nrows ;
GrB_wait (A, GrB_MATERIALIZE) ; // this is essential
GrB_Matrix_nrows (&nrows, A) ;
#pragma omp parallel for num_threads(4)
for (int tid = 0 ; tid < 4 ; tid++)
{
// thread tid operates on A(row1:row2-1,:)
GrB_Index row1 = tid * (nrows / 4) ;
GrB_Index row2 = (tid == 3) ? nrows : ((tid+1) * (nrows / 4)) ;
GxB_Iterator iterator ;
GxB_Iterator_new (&iterator) ;
GrB_Info info = GxB_rowIterator_attach (iterator, A, NULL) ;
if (info < 0) { handle the failure ... }
// seek to A(row1,:)
info = GxB_rowIterator_seekRow (iterator, row1) ;
while (info != GxB_EXHAUSTED)
{
// iterate over entries in A(i,:)
GrB_Index i = GxB_rowIterator_getRowIndex (iterator) ;
if (i >= row2) break ;
while (info == GrB_SUCCESS)
{
// get the entry A(i,j)
GrB_Index j = GxB_rowIterator_getColIndex (iterator) ;
double aij = GxB_Iterator_get_FP64 (iterator) ;
// move to the next entry in A(i,:)
info = GxB_rowIterator_nextCol (iterator) ;
}
// move to the next row, A(i+1,:)
info = GxB_rowIterator_nextRow (iterator) ;
}
GrB_free (&iterator) ;
}
In the parallel example above, a more balanced work distribution can be
obtained by first computing the row degree via GrB_mxv (see LAGraph), and
then compute the cumulative sum (ideally in parallel). Next, partition the
cumulative sum into one part per thread via binary search, and divide the
rows into parts accordingly.
*/
//------------------------------------------------------------------------------
// GxB_Iterator: definition and new/free methods
//------------------------------------------------------------------------------
// The contents of an iterator must not be directly accessed by the user
// application. Only the functions and macros provided here may access
// "iterator->..." contents. The iterator is defined here only so that macros
// can be used to speed up the use of the iterator methods. User applications
// must not use "iterator->..." directly.
struct GB_Iterator_opaque
{
// these components change as the iterator moves (via seek or next):
int64_t pstart ; // the start of the current vector
int64_t pend ; // the end of the current vector
int64_t p ; // position of the current entry
int64_t k ; // the current vector
// only changes when the iterator is created:
size_t header_size ; // size of this iterator object
// these components only change when the iterator is attached:
int64_t pmax ; // avlen*avdim for bitmap; nvals(A) otherwise
int64_t avlen ; // length of each vector in the matrix
int64_t avdim ; // number of vectors in the matrix dimension
int64_t anvec ; // # of vectors present in the matrix
const int64_t *GB_restrict Ap ; // pointers for sparse and hypersparse
const int64_t *GB_restrict Ah ; // vector names for hypersparse
const int8_t *GB_restrict Ab ; // bitmap
const int64_t *GB_restrict Ai ; // indices for sparse and hypersparse
const void *GB_restrict Ax ; // values for all 4 data structures
size_t type_size ; // size of the type of A
int A_sparsity ; // sparse, hyper, bitmap, or full
bool iso ; // true if A is iso-valued, false otherwise
bool by_col ; // true if A is held by column, false if by row
} ;
typedef struct GB_Iterator_opaque *GxB_Iterator ;
// GxB_Iterator_new: create a new iterator, not attached to any matrix/vector
GB_PUBLIC GrB_Info GxB_Iterator_new (GxB_Iterator *iterator) ;
// GxB_Iterator_free: free an iterator
GB_PUBLIC GrB_Info GxB_Iterator_free (GxB_Iterator *iterator) ;
//==============================================================================
// GB_Iterator_*: implements user-callable GxB_*Iterator_* methods
//==============================================================================
// GB_* methods are not user-callable. These methods appear here so that the
// iterator methods can be done via macros.
//------------------------------------------------------------------------------
// GB_Iterator_attach: attach a row/col/entry iterator to a matrix
//------------------------------------------------------------------------------
GB_PUBLIC GrB_Info GB_Iterator_attach
(
GxB_Iterator iterator, // iterator to attach to the matrix A
GrB_Matrix A, // matrix to attach
GxB_Format_Value format, // by row, by col, or by entry (GxB_NO_FORMAT)
GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// GB_Iterator_rc_seek: seek a row/col iterator to a particular vector
//------------------------------------------------------------------------------
GB_PUBLIC GrB_Info GB_Iterator_rc_seek
(
GxB_Iterator iterator,
GrB_Index j,
bool jth_vector
) ;
//------------------------------------------------------------------------------
// GB_Iterator_rc_bitmap_next: move a row/col iterator to next entry in bitmap
//------------------------------------------------------------------------------
GB_PUBLIC GrB_Info GB_Iterator_rc_bitmap_next (GxB_Iterator iterator) ;
//------------------------------------------------------------------------------
// GB_Iterator_rc_knext: move a row/col iterator to the next vector
//------------------------------------------------------------------------------
#define GB_Iterator_rc_knext(iterator) \
( \
/* move to the next vector, and check if iterator is exhausted */ \
(++(iterator->k) >= iterator->anvec) ? \
( \
/* iterator is at the end of the matrix */ \
iterator->pstart = 0, \
iterator->pend = 0, \
iterator->p = 0, \
iterator->k = iterator->anvec, \
GxB_EXHAUSTED \
) \
: \
( \
/* find first entry in vector, and pstart/pend for this vector */ \
(iterator->A_sparsity <= GxB_SPARSE) ? \
( \
/* matrix is sparse or hypersparse */ \
iterator->pstart = iterator->Ap [iterator->k], \
iterator->pend = iterator->Ap [iterator->k+1], \
iterator->p = iterator->pstart, \
((iterator->p >= iterator->pend) ? GrB_NO_VALUE : GrB_SUCCESS) \
) \
: \
( \
/* matrix is bitmap or full */ \
iterator->pstart += iterator->avlen, \
iterator->pend += iterator->avlen, \
iterator->p = iterator->pstart, \
(iterator->A_sparsity <= GxB_BITMAP) ? \
( \
/* matrix is bitmap */ \
GB_Iterator_rc_bitmap_next (iterator) \
) \
: \
( \
/* matrix is full */ \
((iterator->p >= iterator->pend) ? GrB_NO_VALUE : GrB_SUCCESS) \
) \
) \
) \
)
//------------------------------------------------------------------------------
// GB_Iterator_rc_inext: move a row/col iterator the next entry in the vector
//------------------------------------------------------------------------------
#define GB_Iterator_rc_inext(iterator) \
( \
/* move to the next entry in the vector */ \
(++(iterator->p) >= iterator->pend) ? \
( \
/* no more entries in the current vector */ \
GrB_NO_VALUE \
) \
: \
( \
(iterator->A_sparsity == GxB_BITMAP) ? \
( \
/* the matrix is in bitmap form */ \
GB_Iterator_rc_bitmap_next (iterator) \
) \
: \
( \
GrB_SUCCESS \
) \
) \
)
//------------------------------------------------------------------------------
// GB_Iterator_rc_getj: get index of current vector for row/col iterator
//------------------------------------------------------------------------------
#define GB_Iterator_rc_getj(iterator) \
( \
(iterator->k >= iterator->anvec) ? \
( \
/* iterator is past the end of the matrix */ \
iterator->avdim \
) \
: \
( \
(iterator->A_sparsity == GxB_HYPERSPARSE) ? \
( \
/* return the name of kth vector: j = Ah [k] if it appears */ \
iterator->Ah [iterator->k] \
) \
: \
( \
/* return the kth vector: j = k */ \
iterator->k \
) \
) \
)
//------------------------------------------------------------------------------
// GB_Iterator_rc_geti: return index of current entry for row/col iterator
//------------------------------------------------------------------------------
#define GB_Iterator_rc_geti(iterator) \
( \
(iterator->Ai != NULL) ? \
( \
iterator->Ai [iterator->p] \
) \
: \
( \
(iterator->p - iterator->pstart) \
) \
)
//==============================================================================
// GxB_rowIterator_*: iterate over the rows of a matrix
//==============================================================================
#undef GxB_rowIterator_attach
#undef GxB_rowIterator_kount
#undef GxB_rowIterator_seekRow
#undef GxB_rowIterator_kseek
#undef GxB_rowIterator_nextRow
#undef GxB_rowIterator_nextCol
#undef GxB_rowIterator_getRowIndex
#undef GxB_rowIterator_getColIndex
//------------------------------------------------------------------------------
// GxB_rowIterator_attach: attach a row iterator to a matrix
//------------------------------------------------------------------------------
// On input, the iterator must already exist, having been created by
// GxB_Iterator_new.
// GxB_rowIterator_attach attaches a row iterator to a matrix. If the iterator
// is already attached to a matrix, it is detached and then attached to the
// given matrix A.
// The following error conditions are returned:
// GrB_NULL_POINTER: if the iterator or A are NULL.
// GrB_INVALID_OBJECT: if the matrix A is invalid.
// GrB_NOT_IMPLEMENTED: if the matrix A cannot be iterated by row.
// GrB_OUT_OF_MEMORY: if the method runs out of memory.
// If successful, the row iterator is attached to the matrix, but not to any
// specific row. Use GxB_rowIterator_*seek* to move the iterator to a row.
GB_PUBLIC
GrB_Info GxB_rowIterator_attach
(
GxB_Iterator iterator,
GrB_Matrix A,
GrB_Descriptor desc
) ;
#define GxB_rowIterator_attach(iterator, A, desc) \
( \
GB_Iterator_attach (iterator, A, GxB_BY_ROW, desc) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_kount: upper bound on the # of nonempty rows of a matrix
//------------------------------------------------------------------------------
// On input, the row iterator must be attached to a matrix, but need not be at
// any specific row; results are undefined if this condition is not met.
// GxB_rowIterator_kount returns an upper bound on the # of non-empty rows of a
// matrix. A GraphBLAS library may always return this as simply nrows(A), but
// in some libraries, it may be a value between the # of rows with at least one
// entry, and nrows(A), inclusive. Any value in this range is a valid return
// value from this function.
// For SuiteSparse:GraphBLAS: If A is m-by-n, and sparse, bitmap, or full, then
// kount == m. If A is hypersparse, kount is the # of vectors held in the data
// structure for the matrix, some of which may be empty, and kount <= m.
GB_PUBLIC
GrB_Index GxB_rowIterator_kount (GxB_Iterator iterator) ;
#define GxB_rowIterator_kount(iterator) \
( \
(iterator)->anvec \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_seekRow: move a row iterator to a different row of a matrix
//------------------------------------------------------------------------------
// On input, the row iterator must be attached to a matrix, but need not be at
// any specific row; results are undefined if this condition is not met.
// GxB_rowIterator_seekRow moves a row iterator to the first entry of A(row,:).
// If A(row,:) has no entries, the iterator may move to the first entry of next
// nonempty row i for some i > row. The row index can be determined by
// GxB_rowIterator_getRowIndex.
// For SuiteSparse:GraphBLAS: If the matrix is hypersparse, and the row
// does not appear in the hyperlist, then the iterator is moved to the first
// row after the given row that does appear in the hyperlist.
// The method is always successful; the following are conditions are returned:
// GxB_EXHAUSTED: if the row index is >= nrows(A); the row iterator is
// exhausted, but is still attached to the matrix.
// GrB_NO_VALUE: if the row index is valid but A(row,:) has no entries; the
// row iterator is positioned at A(row,:).
// GrB_SUCCESS: if the row index is valid and A(row,:) has at least one
// entry. The row iterator is positioned at A(row,:).
// GxB_rowIterator_get* can be used to return the indices of
// the first entry in A(row,:), and GxB_Iterator_get* can
// return its value.
GB_PUBLIC
GrB_Info GxB_rowIterator_seekRow (GxB_Iterator iterator, GrB_Index row) ;
#define GxB_rowIterator_seekRow(iterator, row) \
( \
GB_Iterator_rc_seek (iterator, row, false) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_kseek: move a row iterator to a different row of a matrix
//------------------------------------------------------------------------------
// On input, the row iterator must be attached to a matrix, but need not be at
// any specific row; results are undefined if this condition is not met.
// GxB_rowIterator_kseek is identical to GxB_rowIterator_seekRow, except for
// how the row index is specified. The row is the kth non-empty row of A.
// More precisely, k is in the range 0 to kount-1, where kount is the value
// returned by GxB_rowIterator_kount.
GB_PUBLIC
GrB_Info GxB_rowIterator_kseek (GxB_Iterator iterator, GrB_Index k) ;
#define GxB_rowIterator_kseek(iterator, k) \
( \
GB_Iterator_rc_seek (iterator, k, true) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_nextRow: move a row iterator to the next row of a matrix
//------------------------------------------------------------------------------
// On input, the row iterator must already be attached to a matrix via a prior
// call to GxB_rowIterator_attach, and the iterator must be at a specific row,
// via a prior call to GxB_rowIterator_*seek* or GxB_rowIterator_nextRow;
// results are undefined if this condition is not met.
// If the the row iterator is currently at A(row,:), it is moved to A(row+1,:),
// or to the first non-empty row after A(row,:), at the discretion of this
// method. That is, empty rows may be skipped.
// The method is always successful, and the return conditions are identical to
// the return conditions of GxB_rowIterator_seekRow.
GB_PUBLIC
GrB_Info GxB_rowIterator_nextRow (GxB_Iterator iterator) ;
#define GxB_rowIterator_nextRow(iterator) \
( \
GB_Iterator_rc_knext (iterator) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_nextCol: move a row iterator to the next entry in A(row,:)
//------------------------------------------------------------------------------
// On input, the row iterator must already be attached to a matrix via a prior
// call to GxB_rowIterator_attach, and the iterator must be at a specific row,
// via a prior call to GxB_rowIterator_*seek* or GxB_rowIterator_nextRow;
// results are undefined if this condition is not met.
// The method is always successful, and returns the following conditions:
// GrB_NO_VALUE: If the iterator is already exhausted, or if there is no
// entry in the current A(row,;),
// GrB_SUCCESS: If the row iterator has been moved to the next entry in
// A(row,:).
GB_PUBLIC
GrB_Info GxB_rowIterator_nextCol (GxB_Iterator iterator) ;
#define GxB_rowIterator_nextCol(iterator) \
( \
GB_Iterator_rc_inext ((iterator)) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_getRowIndex: get current row index of a row iterator
//------------------------------------------------------------------------------
// On input, the iterator must be already successfully attached to matrix as a
// row iterator; results are undefined if this condition is not met.
// The method returns nrows(A) if the iterator is exhausted, or the current
// row index otherwise. There need not be any entry in the current row.
// Zero is returned if the iterator is attached to the matrix but
// GxB_rowIterator_*seek* has not been called, but this does not mean the
// iterator is positioned at row zero.
GB_PUBLIC
GrB_Index GxB_rowIterator_getRowIndex (GxB_Iterator iterator) ;
#define GxB_rowIterator_getRowIndex(iterator) \
( \
GB_Iterator_rc_getj ((iterator)) \
)
//------------------------------------------------------------------------------
// GxB_rowIterator_getColIndex: get current column index of a row iterator
//------------------------------------------------------------------------------
// On input, the iterator must be already successfully attached to matrix as a
// row iterator, and in addition, the row iterator must be positioned at a
// valid entry present in the matrix. That is, the last call to
// GxB_rowIterator_*seek* or GxB_rowIterator_*next*, must have returned
// GrB_SUCCESS. Results are undefined if this condition is not met.
GB_PUBLIC
GrB_Index GxB_rowIterator_getColIndex (GxB_Iterator iterator) ;
#define GxB_rowIterator_getColIndex(iterator) \
( \
GB_Iterator_rc_geti ((iterator)) \
)
//==============================================================================
// GxB_colIterator_*: iterate over columns of a matrix
//==============================================================================
// The column iterator is analoguous to the row iterator.
#undef GxB_colIterator_attach
#undef GxB_colIterator_kount
#undef GxB_colIterator_seekCol
#undef GxB_colIterator_kseek
#undef GxB_colIterator_nextCol
#undef GxB_colIterator_nextRow
#undef GxB_colIterator_getColIndex
#undef GxB_colIterator_getRowIndex
// GxB_colIterator_attach: attach a column iterator to a matrix
GB_PUBLIC
GrB_Info GxB_colIterator_attach
(
GxB_Iterator iterator,
GrB_Matrix A,
GrB_Descriptor desc
) ;
#define GxB_colIterator_attach(iterator, A, desc) \
( \
GB_Iterator_attach (iterator, A, GxB_BY_COL, desc) \
)
// GxB_colIterator_kount: return # of nonempty columns of the matrix
GB_PUBLIC
GrB_Index GxB_colIterator_kount (GxB_Iterator iterator) ;
#define GxB_colIterator_kount(iterator) \
( \
(iterator)->anvec \
)
// GxB_colIterator_seekCol: move a column iterator to A(:,col)
GB_PUBLIC
GrB_Info GxB_colIterator_seekCol (GxB_Iterator iterator, GrB_Index col) ;
#define GxB_colIterator_seekCol(iterator, col) \
( \
GB_Iterator_rc_seek (iterator, col, false) \
)
// GxB_colIterator_kseek: move a column iterator to kth non-empty column of A
GB_PUBLIC
GrB_Info GxB_colIterator_kseek (GxB_Iterator iterator, GrB_Index k) ;
#define GxB_colIterator_kseek(iterator, k) \
( \
GB_Iterator_rc_seek (iterator, k, true) \
)
// GxB_colIterator_nextCol: move a column iterator to first entry of next column
GB_PUBLIC
GrB_Info GxB_colIterator_nextCol (GxB_Iterator iterator) ;
#define GxB_colIterator_nextCol(iterator) \
( \
GB_Iterator_rc_knext ((iterator)) \
)
// GxB_colIterator_nextRow: move a column iterator to next entry in column
GB_PUBLIC
GrB_Info GxB_colIterator_nextRow (GxB_Iterator iterator) ;
#define GxB_colIterator_nextRow(iterator) \
( \
GB_Iterator_rc_inext ((iterator)) \
)
// GxB_colIterator_getColIndex: return the column index of current entry
GB_PUBLIC
GrB_Index GxB_colIterator_getColIndex (GxB_Iterator iterator) ;
#define GxB_colIterator_getColIndex(iterator) \
( \
GB_Iterator_rc_getj ((iterator)) \
)
// GxB_colIterator_getRowIndex: return the row index of current entry
GB_PUBLIC
GrB_Index GxB_colIterator_getRowIndex (GxB_Iterator iterator) ;
#define GxB_colIterator_getRowIndex(iterator) \
( \
GB_Iterator_rc_geti ((iterator)) \
)
//==============================================================================
// GxB_Matrix_Iterator_*: iterate over the entries of a matrix
//==============================================================================
// Example usage:
// single thread iteration of a whole matrix, one entry at at time
/*
// create an iterator
GxB_Iterator iterator ;
GxB_Iterator_new (&iterator) ;
// attach it to the matrix A, known to be type GrB_FP64
GrB_Info info = GxB_Matrix_Iterator_attach (iterator, A, NULL) ;
if (info < 0) { handle the failure ... }
// seek to the first entry
info = GxB_Matrix_Iterator_seek (iterator, 0) ;
while (info != GxB_EXHAUSTED)
{
// get the entry A(i,j)
GrB_Index i, j ;
GxB_Matrix_Iterator_getIndex (iterator, &i, &j) ;
double aij = GxB_Iterator_get_FP64 (iterator) ;
// move to the next entry in A
info = GxB_Matrix_Iterator_next (iterator) ;
}
GrB_free (&iterator) ;
*/
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_attach: attach an entry iterator to a matrix
//------------------------------------------------------------------------------
// On input, the iterator must already exist, having been created by
// GxB_Iterator_new.
// GxB_Matrix_Iterator_attach attaches an entry iterator to a matrix. If the
// iterator is already attached to a matrix, it is detached and then attached
// to the given matrix A.
// The following error conditions are returned:
// GrB_NULL_POINTER: if the iterator or A are NULL.
// GrB_INVALID_OBJECT: if the matrix A is invalid.
// GrB_OUT_OF_MEMORY: if the method runs out of memory.
// If successful, the entry iterator is attached to the matrix, but not to any
// specific entry. Use GxB_Matrix_Iterator_*seek* to move the iterator to a
// particular entry.
GB_PUBLIC
GrB_Info GxB_Matrix_Iterator_attach
(
GxB_Iterator iterator,
GrB_Matrix A,
GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_getpmax: return the range of the iterator
//------------------------------------------------------------------------------
// On input, the entry iterator must be already attached to a matrix via
// GxB_Matrix_Iterator_attach; results are undefined if this condition is not
// met.
// Entries in a matrix are given an index p, ranging from 0 to pmax-1, where
// pmax >= nvals(A). For sparse, hypersparse, and full matrices, pmax is equal
// to nvals(A). For an m-by-n bitmap matrix, pmax=m*n, or pmax=0 if the
// matrix has no entries.
GB_PUBLIC
GrB_Index GxB_Matrix_Iterator_getpmax (GxB_Iterator iterator) ;
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_seek: seek to a specific entry
//------------------------------------------------------------------------------
// On input, the entry iterator must be already attached to a matrix via
// GxB_Matrix_Iterator_attach; results are undefined if this condition is not
// met.
// The input p is in range 0 to pmax-1, which points to an entry in the matrix,
// or p >= pmax if the iterator is exhausted, where pmax is the return value
// from GxB_Matrix_Iterator_getpmax.
// Returns GrB_SUCCESS if the iterator is at an entry that exists in the
// matrix, or GxB_EXHAUSTED if the iterator is exhausted.
GB_PUBLIC
GrB_Info GxB_Matrix_Iterator_seek (GxB_Iterator iterator, GrB_Index p) ;
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_next: move to the next entry of a matrix
//------------------------------------------------------------------------------
// On input, the entry iterator must be already attached to a matrix via
// GxB_Matrix_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Matrix_Iterator_seek or
// GxB_Matrix_Iterator_next. Results are undefined if these conditions are not
// met.
// Returns GrB_SUCCESS if the iterator is at an entry that exists in the
// matrix, or GxB_EXHAUSTED if the iterator is exhausted.
GB_PUBLIC
GrB_Info GxB_Matrix_Iterator_next (GxB_Iterator iterator) ;
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_getp: get the current position of a matrix iterator
//------------------------------------------------------------------------------
// On input, the entry iterator must be already attached to a matrix via
// GxB_Matrix_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Matrix_Iterator_seek or
// GxB_Matrix_Iterator_next. Results are undefined if these conditions are not
// met.
GB_PUBLIC
GrB_Index GxB_Matrix_Iterator_getp (GxB_Iterator iterator) ;
//------------------------------------------------------------------------------
// GxB_Matrix_Iterator_getIndex: get the row and column index of a matrix entry
//------------------------------------------------------------------------------
// On input, the entry iterator must be already attached to a matrix via
// GxB_Matrix_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Matrix_Iterator_seek or
// GxB_Matrix_Iterator_next, with a return value of GrB_SUCCESS. Results are
// undefined if these conditions are not met.
GB_PUBLIC
void GxB_Matrix_Iterator_getIndex
(
GxB_Iterator iterator,
GrB_Index *row,
GrB_Index *col
) ;
//==============================================================================
// GxB_Vector_Iterator_*: iterate over the entries of a vector
//==============================================================================
/* Example usage:
single thread iteration of a whole vector, one entry at at time
// create an iterator
GxB_Iterator iterator ;
GxB_Iterator_new (&iterator) ;
// attach it to the vector v, known to be type GrB_FP64
GrB_Info info = GxB_Vector_Iterator_attach (iterator, v, NULL) ;
if (info < 0) { handle the failure ... }
// seek to the first entry
info = GxB_Vector_Iterator_seek (iterator, 0) ;
while (info != GxB_EXHAUSTED)
{
// get the entry v(i)
GrB_Index i = GxB_Vector_Iterator_getIndex (iterator) ;
double vi = GxB_Iterator_get_FP64 (iterator) ;
// move to the next entry in v
info = GxB_Vector_Iterator_next (iterator) ;
}
GrB_free (&iterator) ;
*/
#undef GxB_Vector_Iterator_getpmax
#undef GxB_Vector_Iterator_seek
#undef GxB_Vector_Iterator_next
#undef GxB_Vector_Iterator_getp
#undef GxB_Vector_Iterator_getIndex
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_attach: attach an iterator to a vector
//------------------------------------------------------------------------------
// On input, the iterator must already exist, having been created by
// GxB_Iterator_new.
// GxB_Vector_Iterator_attach attaches an iterator to a vector. If the
// iterator is already attached to a vector or matrix, it is detached and then
// attached to the given vector v.
// The following error conditions are returned:
// GrB_NULL_POINTER: if the iterator or v are NULL.
// GrB_INVALID_OBJECT: if the vector v is invalid.
// GrB_OUT_OF_MEMORY: if the method runs out of memory.
// If successful, the iterator is attached to the vector, but not to any
// specific entry. Use GxB_Vector_Iterator_seek to move the iterator to a
// particular entry.
GB_PUBLIC GrB_Info GxB_Vector_Iterator_attach
(
GxB_Iterator iterator,
GrB_Vector v,
GrB_Descriptor desc
) ;
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_getpmax: return the range of the vector iterator
//------------------------------------------------------------------------------
// On input, the iterator must be already attached to a vector via
// GxB_Vector_Iterator_attach; results are undefined if this condition is not
// met.
// Entries in a vector are given an index p, ranging from 0 to pmax-1, where
// pmax >= nvals(v). For sparse and full vectors, pmax is equal to nvals(v).
// For a size-m bitmap vector, pmax=m, or pmax=0 if the vector has no entries.
GB_PUBLIC
GrB_Index GxB_Vector_Iterator_getpmax (GxB_Iterator iterator) ;
#define GxB_Vector_Iterator_getpmax(iterator) \
( \
(iterator->pmax) \
)
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_seek: seek to a specific entry in the vector
//------------------------------------------------------------------------------
// On input, the iterator must be already attached to a vector via
// GxB_Vector_Iterator_attach; results are undefined if this condition is not
// met.
// The input p is in range 0 to pmax-1, which points to an entry in the vector,
// or p >= pmax if the iterator is exhausted, where pmax is the return value
// from GxB_Vector_Iterator_getpmax.
// Returns GrB_SUCCESS if the iterator is at an entry that exists in the
// vector, or GxB_EXHAUSTED if the iterator is exhausted.
GB_PUBLIC
GrB_Info GB_Vector_Iterator_bitmap_seek (GxB_Iterator iterator,
GrB_Index unused) ; // unused parameter to be removed in v8.x
GB_PUBLIC
GrB_Info GxB_Vector_Iterator_seek (GxB_Iterator iterator, GrB_Index p) ;
#define GB_Vector_Iterator_seek(iterator, q) \
( \
(q >= iterator->pmax) ? \
( \
/* the iterator is exhausted */ \
iterator->p = iterator->pmax, \
GxB_EXHAUSTED \
) \
: \
( \
/* seek to an arbitrary position in the vector */ \
iterator->p = q, \
(iterator->A_sparsity == GxB_BITMAP) ? \
( \
GB_Vector_Iterator_bitmap_seek (iterator, 0) \
) \
: \
( \
GrB_SUCCESS \
) \
) \
)
#define GxB_Vector_Iterator_seek(iterator, p) \
( \
GB_Vector_Iterator_seek (iterator, p) \
)
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_next: move to the next entry of a vector
//------------------------------------------------------------------------------
// On input, the iterator must be already attached to a vector via
// GxB_Vector_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Vector_Iterator_seek or
// GxB_Vector_Iterator_next. Results are undefined if these conditions are not
// met.
// Returns GrB_SUCCESS if the iterator is at an entry that exists in the
// vector, or GxB_EXHAUSTED if the iterator is exhausted.
GB_PUBLIC
GrB_Info GxB_Vector_Iterator_next (GxB_Iterator iterator) ;
#define GB_Vector_Iterator_next(iterator) \
( \
/* move to the next entry */ \
(++(iterator->p) >= iterator->pmax) ? \
( \
/* the iterator is exhausted */ \
iterator->p = iterator->pmax, \
GxB_EXHAUSTED \
) \
: \
( \
(iterator->A_sparsity == GxB_BITMAP) ? \
( \
/* bitmap: seek to the next entry present in the bitmap */ \
GB_Vector_Iterator_bitmap_seek (iterator, 0) \
) \
: \
( \
/* other formats: already at the next entry */ \
GrB_SUCCESS \
) \
) \
)
#define GxB_Vector_Iterator_next(iterator) \
( \
GB_Vector_Iterator_next (iterator) \
)
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_getp: get the current position of a vector iterator
//------------------------------------------------------------------------------
// On input, the iterator must be already attached to a vector via
// GxB_Vector_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Vector_Iterator_seek or
// GxB_Vector_Iterator_next. Results are undefined if these conditions are not
// met.
GB_PUBLIC
GrB_Index GxB_Vector_Iterator_getp (GxB_Iterator iterator) ;
#define GxB_Vector_Iterator_getp(iterator) \
( \
(iterator->p) \
)
//------------------------------------------------------------------------------
// GxB_Vector_Iterator_getIndex: get the index of a vector entry
//------------------------------------------------------------------------------
// On input, the iterator must be already attached to a vector via
// GxB_Vector_Iterator_attach, and the position of the iterator must also have
// been defined by a prior call to GxB_Vector_Iterator_seek or
// GxB_Vector_Iterator_next, with a return value of GrB_SUCCESS. Results are
// undefined if these conditions are not met.
GB_PUBLIC
GrB_Index GxB_Vector_Iterator_getIndex (GxB_Iterator iterator) ;
#define GxB_Vector_Iterator_getIndex(iterator) \
( \
((iterator->Ai != NULL) ? iterator->Ai [iterator->p] : iterator->p) \
)
//==============================================================================
// GxB_Iterator_get_TYPE: get value of the current entry for any iterator
//==============================================================================
// On input, the prior call to GxB_*Iterator_*seek*, or GxB_*Iterator_*next*
// must have returned GrB_SUCCESS, indicating that the iterator is at a valid
// current entry for either a matrix or vector.
// Returns the value of the current entry at the position determined by the
// iterator. No typecasting is permitted; the method name must match the
// type of the matrix or vector.
#undef GxB_Iterator_get_BOOL
#undef GxB_Iterator_get_INT8
#undef GxB_Iterator_get_INT16
#undef GxB_Iterator_get_INT32
#undef GxB_Iterator_get_INT64
#undef GxB_Iterator_get_UINT8
#undef GxB_Iterator_get_UINT16
#undef GxB_Iterator_get_UINT32
#undef GxB_Iterator_get_UINT64
#undef GxB_Iterator_get_FP32
#undef GxB_Iterator_get_FP64
#undef GxB_Iterator_get_FC32
#undef GxB_Iterator_get_FC64
#undef GxB_Iterator_get_UDT
GB_PUBLIC bool GxB_Iterator_get_BOOL (GxB_Iterator iterator) ;
GB_PUBLIC int8_t GxB_Iterator_get_INT8 (GxB_Iterator iterator) ;
GB_PUBLIC int16_t GxB_Iterator_get_INT16 (GxB_Iterator iterator) ;
GB_PUBLIC int32_t GxB_Iterator_get_INT32 (GxB_Iterator iterator) ;
GB_PUBLIC int64_t GxB_Iterator_get_INT64 (GxB_Iterator iterator) ;
GB_PUBLIC uint8_t GxB_Iterator_get_UINT8 (GxB_Iterator iterator) ;
GB_PUBLIC uint16_t GxB_Iterator_get_UINT16 (GxB_Iterator iterator) ;
GB_PUBLIC uint32_t GxB_Iterator_get_UINT32 (GxB_Iterator iterator) ;
GB_PUBLIC uint64_t GxB_Iterator_get_UINT64 (GxB_Iterator iterator) ;
GB_PUBLIC float GxB_Iterator_get_FP32 (GxB_Iterator iterator) ;
GB_PUBLIC double GxB_Iterator_get_FP64 (GxB_Iterator iterator) ;
GB_PUBLIC GxB_FC32_t GxB_Iterator_get_FC32 (GxB_Iterator iterator) ;
GB_PUBLIC GxB_FC64_t GxB_Iterator_get_FC64 (GxB_Iterator iterator) ;
GB_PUBLIC void GxB_Iterator_get_UDT (GxB_Iterator iterator,
void *value) ;
#define GB_Iterator_get(iterator, type) \
( \
(((type *) (iterator)->Ax) [(iterator)->iso ? 0 : (iterator)->p]) \
)
#define GxB_Iterator_get_BOOL(iterator) GB_Iterator_get (iterator, bool)
#define GxB_Iterator_get_INT8(iterator) GB_Iterator_get (iterator, int8_t)
#define GxB_Iterator_get_INT16(iterator) GB_Iterator_get (iterator, int16_t)
#define GxB_Iterator_get_INT32(iterator) GB_Iterator_get (iterator, int32_t)
#define GxB_Iterator_get_INT64(iterator) GB_Iterator_get (iterator, int64_t)
#define GxB_Iterator_get_UINT8(iterator) GB_Iterator_get (iterator, uint8_t)
#define GxB_Iterator_get_UINT16(iterator) GB_Iterator_get (iterator, uint16_t)
#define GxB_Iterator_get_UINT32(iterator) GB_Iterator_get (iterator, uint32_t)
#define GxB_Iterator_get_UINT64(iterator) GB_Iterator_get (iterator, uint64_t)
#define GxB_Iterator_get_FP32(iterator) GB_Iterator_get (iterator, float)
#define GxB_Iterator_get_FP64(iterator) GB_Iterator_get (iterator, double)
#define GxB_Iterator_get_FC32(iterator) GB_Iterator_get (iterator, GxB_FC32_t)
#define GxB_Iterator_get_FC64(iterator) GB_Iterator_get (iterator, GxB_FC64_t)
#define GxB_Iterator_get_UDT(iterator, value) \
( \
(void) memcpy ((void *) value, ((const uint8_t *) ((iterator)->Ax)) + \
((iterator)->iso ? 0 : ((iterator)->type_size * (iterator)->p)), \
(iterator)->type_size) \
)
//------------------------------------------------------------------------------
// Rapids Memory Manager wrappers for SuiteSparse:GraphBLAS
//------------------------------------------------------------------------------
#ifndef RMM_WRAP_H
#define RMM_WRAP_H
#ifdef __cplusplus
extern "C" {
#endif
// TODO describe the modes
typedef enum
{
rmm_wrap_host = 0,
rmm_wrap_host_pinned = 1,
rmm_wrap_device = 2,
rmm_wrap_managed = 3
} RMM_MODE ;
void rmm_wrap_finalize (void) ;
int rmm_wrap_initialize
(
RMM_MODE mode,
size_t init_pool_size,
size_t max_pool_size
) ;
// example usage:
// rmm_wrap_initialize (rmm_wrap_managed, INT32_MAX, INT64_MAX) ;
// GxB_init (GxB_NONBLOCKING_GPU, rmm_wrap_malloc, rmm_wrap_calloc,
// rmm_wrap_realloc, rmm_wrap_free) ;
// use GraphBLAS ... with the GPU
// GrB_finalize ( ) ;
// rmm_wrap_finalize ( ) ;
// The two PMR-based allocate/deallocate signatures (C-style):
void *rmm_wrap_allocate (size_t *size) ;
void rmm_wrap_deallocate (void *p, size_t size) ;
// The four malloc/calloc/realloc/free signatures:
void *rmm_wrap_malloc (size_t size) ;
void *rmm_wrap_calloc (size_t n, size_t size) ;
void *rmm_wrap_realloc (void *p, size_t newsize) ;
void rmm_wrap_free (void *p) ;
#ifdef __cplusplus
}
#endif
#endif
#endif
|