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
|
GraphBLAS type: WildType user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
WildType size: 128
GraphBLAS type: WildType user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
a wildtype scalar: scalar1 [this is from scalar1]
0.0 1.0 2.0 3.0
100.0 101.0 102.0 103.0
200.0 201.0 202.0 203.0
300.0 301.0 302.0 303.0
a wildtype scalar: got scalar2 = C(7,2) [this is A(2,7)]
0.0 1.0 2.0 3.0
100.0 101.0 102.0 103.0
200.0 201.0 202.0 203.0
300.0 301.0 302.0 303.0
GraphBLAS BinaryOp: WildAdd (user-defined) z=wildtype_add(x,y)
GraphBLAS type: ztype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: xtype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: ytype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
void wildtype_add (wildtype *z, const wildtype *x, const wildtype *y)
{
for (int i = 0 ; i < 4 ; i++)
{
for (int j = 0 ; j < 4 ; j++)
{
z->stuff [i][j] = x->stuff [i][j] + y->stuff [i][j] ;
}
}
strcpy (z->whatstuff, "this was added") ;
}
GraphBLAS BinaryOp: WildMult (user-defined) z=wildtype_mult(x,y)
GraphBLAS type: ztype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: xtype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: ytype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
void wildtype_mult (wildtype *z, const wildtype *x, const wildtype *y)
{
for (int i = 0 ; i < 4 ; i++)
{
for (int j = 0 ; j < 4 ; j++)
{
z->stuff [i][j] = 0 ;
for (int k = 0 ; k < 4 ; k++)
{
z->stuff [i][j] += (x->stuff [i][k] * y->stuff [k][j]) ;
}
}
}
strcpy (z->whatstuff, "this was multiplied") ;
}
a wildtype scalar: scalar2 [here is scalar2]
0.5 1.5 2.5 3.5
-0.5 0.5 1.5 2.5
-1.5 -0.5 0.5 1.5
-2.5 -1.5 -0.5 0.5
a wildtype scalar: scalar_identity for the monoid [identity]
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
GraphBLAS Semiring: InTheWild (user-defined)
GraphBLAS Monoid: semiring->add (user-defined)
GraphBLAS BinaryOp: monoid->op (user-defined) z=wildtype_add(x,y)
GraphBLAS type: ztype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: xtype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: ytype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
void wildtype_add (wildtype *z, const wildtype *x, const wildtype *y)
{
for (int i = 0 ; i < 4 ; i++)
{
for (int j = 0 ; j < 4 ; j++)
{
z->stuff [i][j] = x->stuff [i][j] + y->stuff [i][j] ;
}
}
strcpy (z->whatstuff, "this was added") ;
}
identity: [ [user-defined value] ]
GraphBLAS BinaryOp: semiring->multiply (user-defined) z=wildtype_mult(x,y)
GraphBLAS type: ztype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: xtype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
GraphBLAS type: ytype user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
void wildtype_mult (wildtype *z, const wildtype *x, const wildtype *y)
{
for (int i = 0 ; i < 4 ; i++)
{
for (int j = 0 ; j < 4 ; j++)
{
z->stuff [i][j] = 0 ;
for (int k = 0 ; k < 4 ; k++)
{
z->stuff [i][j] += (x->stuff [i][k] * y->stuff [k][j]) ;
}
}
}
strcpy (z->whatstuff, "this was multiplied") ;
}
multiplication C=A*B InTheWild semiring:
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS wildtype matrix, sparse by row
input A, 3 entries, memory: 928 bytes
(2,4) [user-defined value]
(2,7) [user-defined value]
(3,7) [user-defined value]
============= printing the WildType matrix: input A (10-by-10 with 3 entries)
----------- input A(2,4):
a wildtype scalar: [this is A(2,4)]
0.0 1.0 2.0 3.0
100.0 101.0 102.0 103.0
200.0 201.0 202.0 909.0
300.0 301.0 302.0 42.0
----------- input A(2,7):
a wildtype scalar: [this is A(2,7)]
0.0 1.0 2.0 3.0
100.0 101.0 102.0 103.0
200.0 201.0 202.0 203.0
300.0 301.0 302.0 303.0
----------- input A(3,7):
a wildtype scalar: [this is A(3,7)]
0.0 1.0 2.0 3.0
100.0 101.0 102.0 103.0
200.0 201.0 202.0 909.0
300.0 301.0 302.0 303.0
============= that was the WildType matrix input A
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS wildtype matrix, hypersparse by row
input B, 1 entry, memory: 36.5 KB
pending tuples: 2 max pending: 256 zombies: 0
(7,2) [user-defined value]
pending tuples:
GraphBLAS type: user-defined: [wildtype] size: 128
typedef struct { float stuff [4][4] ; char whatstuff [64] ; } wildtype ;
row: 7 col: 5 [user-defined value]
row: 4 col: 2 [user-defined value]
pending operator: implicit 2nd
============= printing the WildType matrix: input B (10-by-10 with 3 entries)
----------- input B(4,2):
a wildtype scalar: [finally, B(4,2)]
-1.0 1.5 2.5 77.0
-0.5 0.5 1.5 2.5
-1.5 -0.5 0.5 1.5
-2.5 -1.5 -0.5 0.5
----------- input B(7,2):
a wildtype scalar: [this is B(7,2)]
0.5 1.5 2.5 3.5
-0.5 0.5 1.5 2.5
-1.5 -0.5 0.5 1.5
-2.5 -1.5 -0.5 0.5
----------- input B(7,5):
a wildtype scalar: [here is B(7,5)]
-1.0 1.5 2.5 3.5
-0.5 0.5 1.5 2.5
-1.5 -0.5 0.5 1.5
-2.5 -1.5 -0.5 0.5
============= that was the WildType matrix input B
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS wildtype matrix, sparse by row
output C, 4 entries, memory: 928 bytes
(2,2) [user-defined value]
(2,5) [user-defined value]
(3,2) [user-defined value]
(3,5) [user-defined value]
============= printing the WildType matrix: output C (10-by-10 with 4 entries)
----------- output C(2,2):
a wildtype scalar: [this was added]
-22.0 -10.0 2.0 14.0
-972.0 -10.0 802.0 8964.0
-3687.0 -1069.0 1249.0 18267.0
-2219.5 381.5 2532.5 26733.5
----------- output C(2,5):
a wildtype scalar: [this was multiplied]
-11.0 -5.0 1.0 7.0
-561.0 -5.0 401.0 807.0
-1111.0 -5.0 801.0 1607.0
-1661.0 -5.0 1201.0 2407.0
----------- output C(3,2):
a wildtype scalar: [this was multiplied]
-11.0 -5.0 1.0 7.0
-411.0 -5.0 401.0 807.0
-2576.0 -1064.0 448.0 1960.0
-1211.0 -5.0 1201.0 2407.0
----------- output C(3,5):
a wildtype scalar: [this was multiplied]
-11.0 -5.0 1.0 7.0
-561.0 -5.0 401.0 807.0
-2876.0 -1064.0 448.0 1960.0
-1661.0 -5.0 1201.0 2407.0
============= that was the WildType matrix output C
------ C<M>=C*C'----------------------------------------
The mask matrix M:
10x10 GraphBLAS bool matrix, hypersparse by row
M, no entries, memory: 4.4 KB
iso value: 1
pending tuples: 4 max pending: 256 zombies: 0
pending tuples:
GraphBLAS type: int32_t size: 4
row: 2 col: 2
row: 2 col: 3
row: 3 col: 2
row: 3 col: 3
pending operator: implicit 2nd
[ GrB_mxm (iso wait:M 0 zombies, 4 pending) (iso build) (hyper to sparse) C<M>=A'*B, masked_dot_product (dot3) (S{S} = S'*S) nthreads 1 ntasks 1 (generic C<M>=A'*B)
0.000168 sec ]
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS wildtype matrix, sparse by row
output C, 4 entries, memory: 1.4 KB
(2,2) [user-defined value]
(2,3) [user-defined value]
(3,2) [user-defined value]
(3,3) [user-defined value]
============= printing the WildType matrix: output C (10-by-10 with 4 entries)
----------- output C(2,2):
a wildtype scalar: [this was added]
-38055.0 3563.0 37081.0 335199.0
-24598430.0 2569038.0 24980906.0 256764864.0
-47572600.0 5674779.5 49524956.0 506665632.0
-74305584.0 7500257.5 75016352.0 772037824.0
----------- output C(2,3):
a wildtype scalar: [this was added]
-29331.0 -3057.0 20517.0 44091.0
-15391281.0 -1321107.0 12266367.0 25853840.0
-29816720.0 -2251210.0 24351604.0 50954412.0
-46461396.0 -4100626.5 36817444.0 77735512.0
----------- output C(3,2):
a wildtype scalar: [this was added]
-23933.5 1801.5 22136.5 174771.5
-5032683.5 -119848.5 3827586.5 31427322.0
-8035864.0 312888.0 6948040.0 55566392.0
-15050184.0 -363148.5 11438486.0 93932424.0
----------- output C(3,3):
a wildtype scalar: [this was added]
-20454.0 -2038.0 13678.0 29394.0
-4488404.0 -856488.0 2292728.0 5441944.0
-6977436.0 -935044.0 4250548.0 9436140.0
-13424304.0 -2565388.0 6850828.0 16267044.0
============= that was the WildType matrix output C
a wildtype scalar: sum [this was added]
-111773.5 269.5 93412.5 583455.5
-49510800.0 271594.5 43367588.0 319487968.0
-92402624.0 2801413.5 85075152.0 622622592.0
-149241456.0 471094.5 130123104.0 959972800.0
C is now stored by column, but it looks just the same to the
GraphBLAS user application. The difference is opaque, in the
internal data structure.
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS wildtype matrix, sparse by col
output C, 4 entries, memory: 928 bytes
(2,2) [user-defined value]
(3,2) [user-defined value]
(2,3) [user-defined value]
(3,3) [user-defined value]
============= printing the WildType matrix: output C (10-by-10 with 4 entries)
----------- output C(2,2):
a wildtype scalar: [this was added]
-38055.0 3563.0 37081.0 335199.0
-24598430.0 2569038.0 24980906.0 256764864.0
-47572600.0 5674779.5 49524956.0 506665632.0
-74305584.0 7500257.5 75016352.0 772037824.0
----------- output C(2,3):
a wildtype scalar: [this was added]
-29331.0 -3057.0 20517.0 44091.0
-15391281.0 -1321107.0 12266367.0 25853840.0
-29816720.0 -2251210.0 24351604.0 50954412.0
-46461396.0 -4100626.5 36817444.0 77735512.0
----------- output C(3,2):
a wildtype scalar: [this was added]
-23933.5 1801.5 22136.5 174771.5
-5032683.5 -119848.5 3827586.5 31427322.0
-8035864.0 312888.0 6948040.0 55566392.0
-15050184.0 -363148.5 11438486.0 93932424.0
----------- output C(3,3):
a wildtype scalar: [this was added]
-20454.0 -2038.0 13678.0 29394.0
-4488404.0 -856488.0 2292728.0 5441944.0
-6977436.0 -935044.0 4250548.0 9436140.0
-13424304.0 -2565388.0 6850828.0 16267044.0
============= that was the WildType matrix output C
Printing the matrix with GxB_Matrix_fprint:
10x10 GraphBLAS float matrix, hypersparse by row
D, no entries, memory: 280 bytes
The matrix D is not wild enough to print.
10x10 GraphBLAS int64_t matrix, sparse by row
E (positional i), 3 entries, memory: 448 bytes
(2,4) 2
(2,7) 2
(3,7) 3
10x10 GraphBLAS int64_t matrix, sparse by row
E (positional j), 3 entries, memory: 448 bytes
(2,4) 4
(2,7) 7
(3,7) 7
This is supposed to fail, as a demo of GrB_error:
GraphBLAS error: GrB_DOMAIN_MISMATCH
function: GrB_Matrix_eWiseAdd_BinaryOp (C, M, accum, add, A, B, desc)
Incompatible type for z=wildtype_add(x,y):
second input of type [float]
cannot be typecast to y input of type [wildtype]
|