Skip to content

Commit 6a2fe26

Browse files
committed
feat: add custom types in main.c + change matrices type from bool to double
1 parent d4d94bb commit 6a2fe26

File tree

4 files changed

+69
-16
lines changed

4 files changed

+69
-16
lines changed

data/minimal_demo/graph/call.mtx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%%MatrixMarket matrix coordinate pattern general
2-
%%GraphBLAS type bool
2+
%%GraphBLAS type double
33
9 9 3
4-
1 4
5-
1 3
6-
3 4
4+
1 4 0.33333
5+
1 3 0.33333
6+
3 4 0.33333

data/minimal_demo/graph/owns.mtx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
%%MatrixMarket matrix coordinate pattern general
2-
%%GraphBLAS type bool
2+
%%GraphBLAS type double
33
9 9 5
4-
1 9
5-
2 7
6-
2 8
7-
3 6
8-
4 5
4+
1 9 0.2
5+
2 7 0.2
6+
2 8 0.2
7+
3 6 0.2
8+
4 5 0.2
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%%MatrixMarket matrix coordinate pattern general
2-
%%GraphBLAS type bool
2+
%%GraphBLAS type double
33
9 9 4
4-
5 6
5-
5 9
6-
6 7
7-
6 9
4+
5 6 0.25
5+
5 9 0.25
6+
6 7 0.25
7+
6 9 0.25

src/main.c

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,61 @@
11
#include <stdio.h>
2+
#include <stdint.h>
23
#include "../vendor/GraphBLAS/Include/GraphBLAS.h"
34
#include "../vendor/LAGraph/include/LAGraph.h"
5+
typedef enum {
6+
VISA,
7+
MIR,
8+
MASTERCARD,
9+
} System;
10+
11+
typedef enum {
12+
MALE,
13+
FEMALE,
14+
} Gender;
15+
16+
typedef enum {
17+
EDGE_OWNS,
18+
EDGE_CALL,
19+
EDGE_TX
20+
} EdgeType;
21+
22+
typedef struct {
23+
Gender gender;
24+
uint8_t age;
25+
} User;
26+
27+
typedef struct {
28+
System system;
29+
double limit;
30+
} Card;
31+
32+
typedef struct {
33+
EdgeType type;
34+
double weight;
35+
double aux;
36+
} EdgeInfo;
37+
38+
void edge_mul(void *z, const void *x, const void *y) {
39+
40+
}
41+
42+
void edge_add(void *z, const void *x, const void *y) {
43+
44+
}
445

546
int main()
647
{
7-
printf("Helllo, World!\n");
48+
// init graphblas
49+
GrB_Info info = GrB_init(GrB_NONBLOCKING);
50+
if (info != GrB_SUCCESS) {
51+
fprintf(stderr, "GraphBLAS init failed\n");
52+
return 1;
53+
}
54+
printf("GraphBLAS initialized.\n");
55+
56+
// custom type
57+
GrB_Type EdgeInfo_Type;
58+
GrB_Type_new(&EdgeInfo_Type, sizeof(EdgeInfo));
59+
60+
861
}

0 commit comments

Comments
 (0)