1 //------------------------------------------------------------------------------ 2 // GB_meta16_factory: 16 cases of a method for A and B 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 // All 16 cases are handled: A and B are sparse, hyper, bitmap, or full. 11 12 #define GB_META16 13 14 { 15 if (A_is_sparse) 16 { 17 18 if (B_is_sparse) 19 { 20 21 //------------------------------------------------------------------ 22 // both A and B are sparse 23 //------------------------------------------------------------------ 24 25 #define GB_A_IS_SPARSE 1 26 #define GB_A_IS_HYPER 0 27 #define GB_A_IS_BITMAP 0 28 #define GB_A_IS_FULL 0 29 #define GB_B_IS_SPARSE 1 30 #define GB_B_IS_HYPER 0 31 #define GB_B_IS_BITMAP 0 32 #define GB_B_IS_FULL 0 33 #include "GB_meta16_methods.c" 34 35 } 36 else if (B_is_hyper) 37 { 38 39 //------------------------------------------------------------------ 40 // A is sparse and B is hyper 41 //------------------------------------------------------------------ 42 43 #define GB_A_IS_SPARSE 1 44 #define GB_A_IS_HYPER 0 45 #define GB_A_IS_BITMAP 0 46 #define GB_A_IS_FULL 0 47 #define GB_B_IS_SPARSE 0 48 #define GB_B_IS_HYPER 1 49 #define GB_B_IS_BITMAP 0 50 #define GB_B_IS_FULL 0 51 #include "GB_meta16_methods.c" 52 53 } 54 else if (B_is_bitmap) 55 { 56 57 //------------------------------------------------------------------ 58 // A is sparse and B is bitmap 59 //------------------------------------------------------------------ 60 61 #define GB_A_IS_SPARSE 1 62 #define GB_A_IS_HYPER 0 63 #define GB_A_IS_BITMAP 0 64 #define GB_A_IS_FULL 0 65 #define GB_B_IS_SPARSE 0 66 #define GB_B_IS_HYPER 0 67 #define GB_B_IS_BITMAP 1 68 #define GB_B_IS_FULL 0 69 #include "GB_meta16_methods.c" 70 71 } 72 else 73 { 74 75 //------------------------------------------------------------------ 76 // A is sparse and B is full 77 //------------------------------------------------------------------ 78 79 #define GB_A_IS_SPARSE 1 80 #define GB_A_IS_HYPER 0 81 #define GB_A_IS_BITMAP 0 82 #define GB_A_IS_FULL 0 83 #define GB_B_IS_SPARSE 0 84 #define GB_B_IS_HYPER 0 85 #define GB_B_IS_BITMAP 0 86 #define GB_B_IS_FULL 1 87 #include "GB_meta16_methods.c" 88 89 } 90 } 91 else if (A_is_hyper) 92 { 93 if (B_is_sparse) 94 { 95 96 //------------------------------------------------------------------ 97 // A is hyper and B is sparse 98 //------------------------------------------------------------------ 99 100 #define GB_A_IS_SPARSE 0 101 #define GB_A_IS_HYPER 1 102 #define GB_A_IS_BITMAP 0 103 #define GB_A_IS_FULL 0 104 #define GB_B_IS_SPARSE 1 105 #define GB_B_IS_HYPER 0 106 #define GB_B_IS_BITMAP 0 107 #define GB_B_IS_FULL 0 108 #include "GB_meta16_methods.c" 109 110 } 111 else if (B_is_hyper) 112 { 113 114 //------------------------------------------------------------------ 115 // both A and B are hyper 116 //------------------------------------------------------------------ 117 118 #define GB_A_IS_SPARSE 0 119 #define GB_A_IS_HYPER 1 120 #define GB_A_IS_BITMAP 0 121 #define GB_A_IS_FULL 0 122 #define GB_B_IS_SPARSE 0 123 #define GB_B_IS_HYPER 1 124 #define GB_B_IS_BITMAP 0 125 #define GB_B_IS_FULL 0 126 #include "GB_meta16_methods.c" 127 128 } 129 else if (B_is_bitmap) 130 { 131 132 //------------------------------------------------------------------ 133 // A is hyper and B is bitmap 134 //------------------------------------------------------------------ 135 136 #define GB_A_IS_SPARSE 0 137 #define GB_A_IS_HYPER 1 138 #define GB_A_IS_BITMAP 0 139 #define GB_A_IS_FULL 0 140 #define GB_B_IS_SPARSE 0 141 #define GB_B_IS_HYPER 0 142 #define GB_B_IS_BITMAP 1 143 #define GB_B_IS_FULL 0 144 #include "GB_meta16_methods.c" 145 146 } 147 else 148 { 149 150 //------------------------------------------------------------------ 151 // A is hyper and B is full 152 //------------------------------------------------------------------ 153 154 #define GB_A_IS_SPARSE 0 155 #define GB_A_IS_HYPER 1 156 #define GB_A_IS_BITMAP 0 157 #define GB_A_IS_FULL 0 158 #define GB_B_IS_SPARSE 0 159 #define GB_B_IS_HYPER 0 160 #define GB_B_IS_BITMAP 0 161 #define GB_B_IS_FULL 1 162 #include "GB_meta16_methods.c" 163 164 } 165 } 166 else if (A_is_bitmap) 167 { 168 if (B_is_sparse) 169 { 170 171 //------------------------------------------------------------------ 172 // A is bitmap and B is sparse 173 //------------------------------------------------------------------ 174 175 #define GB_A_IS_SPARSE 0 176 #define GB_A_IS_HYPER 0 177 #define GB_A_IS_BITMAP 1 178 #define GB_A_IS_FULL 0 179 #define GB_B_IS_SPARSE 1 180 #define GB_B_IS_HYPER 0 181 #define GB_B_IS_BITMAP 0 182 #define GB_B_IS_FULL 0 183 #include "GB_meta16_methods.c" 184 185 } 186 else if (B_is_hyper) 187 { 188 189 //------------------------------------------------------------------ 190 // A is bitmap and B is hyper 191 //------------------------------------------------------------------ 192 193 #define GB_A_IS_SPARSE 0 194 #define GB_A_IS_HYPER 0 195 #define GB_A_IS_BITMAP 1 196 #define GB_A_IS_FULL 0 197 #define GB_B_IS_SPARSE 0 198 #define GB_B_IS_HYPER 1 199 #define GB_B_IS_BITMAP 0 200 #define GB_B_IS_FULL 0 201 #include "GB_meta16_methods.c" 202 203 } 204 else if (B_is_bitmap) 205 { 206 207 //------------------------------------------------------------------ 208 // both A and B are bitmap 209 //------------------------------------------------------------------ 210 211 #define GB_A_IS_SPARSE 0 212 #define GB_A_IS_HYPER 0 213 #define GB_A_IS_BITMAP 1 214 #define GB_A_IS_FULL 0 215 #define GB_B_IS_SPARSE 0 216 #define GB_B_IS_HYPER 0 217 #define GB_B_IS_BITMAP 1 218 #define GB_B_IS_FULL 0 219 #include "GB_meta16_methods.c" 220 221 } 222 else 223 { 224 225 //------------------------------------------------------------------ 226 // A is bitmap and B is full 227 //------------------------------------------------------------------ 228 229 #define GB_A_IS_SPARSE 0 230 #define GB_A_IS_HYPER 0 231 #define GB_A_IS_BITMAP 1 232 #define GB_A_IS_FULL 0 233 #define GB_B_IS_SPARSE 0 234 #define GB_B_IS_HYPER 0 235 #define GB_B_IS_BITMAP 0 236 #define GB_B_IS_FULL 1 237 #include "GB_meta16_methods.c" 238 239 } 240 } 241 else 242 { 243 if (B_is_sparse) 244 { 245 246 //------------------------------------------------------------------ 247 // A is full and B is sparse 248 //------------------------------------------------------------------ 249 250 #define GB_A_IS_SPARSE 0 251 #define GB_A_IS_HYPER 0 252 #define GB_A_IS_BITMAP 0 253 #define GB_A_IS_FULL 1 254 #define GB_B_IS_SPARSE 1 255 #define GB_B_IS_HYPER 0 256 #define GB_B_IS_BITMAP 0 257 #define GB_B_IS_FULL 0 258 #include "GB_meta16_methods.c" 259 260 } 261 else if (B_is_hyper) 262 { 263 264 //------------------------------------------------------------------ 265 // A is full and B is hyper 266 //------------------------------------------------------------------ 267 268 #define GB_A_IS_SPARSE 0 269 #define GB_A_IS_HYPER 0 270 #define GB_A_IS_BITMAP 0 271 #define GB_A_IS_FULL 1 272 #define GB_B_IS_SPARSE 0 273 #define GB_B_IS_HYPER 1 274 #define GB_B_IS_BITMAP 0 275 #define GB_B_IS_FULL 0 276 #include "GB_meta16_methods.c" 277 278 } 279 else if (B_is_bitmap) 280 { 281 282 //------------------------------------------------------------------ 283 // A is full and B is bitmap 284 //------------------------------------------------------------------ 285 286 #define GB_A_IS_SPARSE 0 287 #define GB_A_IS_HYPER 0 288 #define GB_A_IS_BITMAP 0 289 #define GB_A_IS_FULL 1 290 #define GB_B_IS_SPARSE 0 291 #define GB_B_IS_HYPER 0 292 #define GB_B_IS_BITMAP 1 293 #define GB_B_IS_FULL 0 294 #include "GB_meta16_methods.c" 295 296 } 297 else 298 { 299 300 //------------------------------------------------------------------ 301 // both A and B are full 302 //------------------------------------------------------------------ 303 304 #define GB_A_IS_SPARSE 0 305 #define GB_A_IS_HYPER 0 306 #define GB_A_IS_BITMAP 0 307 #define GB_A_IS_FULL 1 308 #define GB_B_IS_SPARSE 0 309 #define GB_B_IS_HYPER 0 310 #define GB_B_IS_BITMAP 0 311 #define GB_B_IS_FULL 1 312 #include "GB_meta16_methods.c" 313 314 } 315 } 316 } 317 318 //------------------------------------------------------------------------------ 319 // redefine macros for any sparity of A and B 320 //------------------------------------------------------------------------------ 321 322 #undef GB_META16 323 #include "GB_meta16_definitions.h" 324 325