| 18 | #include "graphblas_demos.h" |
| 19 | |
| 20 | int main (int argc, char **argv) |
| 21 | { |
| 22 | GrB_Matrix A = NULL ; |
| 23 | GrB_Info info ; |
| 24 | OK (GrB_init (GrB_NONBLOCKING)) ; |
| 25 | int nthreads ; |
| 26 | OK (GxB_Global_Option_get (GxB_GLOBAL_NTHREADS, &nthreads)) ; |
| 27 | fprintf (stderr, "import_demo: nthreads: %d\n", nthreads) ; |
| 28 | |
| 29 | //-------------------------------------------------------------------------- |
| 30 | // get a matrix |
| 31 | //-------------------------------------------------------------------------- |
| 32 | |
| 33 | // usage: ./main < file |
| 34 | // ./main 0 dump < file |
| 35 | // ./main 1 dump < file |
| 36 | // |
| 37 | // default is 0-based, for the matrices in the Matrix/ folder |
| 38 | |
| 39 | bool one_based = false ; |
| 40 | bool dump = false ; |
| 41 | if (argc > 1) one_based = strtol (argv [1], NULL, 0) ; |
| 42 | if (argc > 2) dump = strtol (argv [2], NULL, 0) ; |
| 43 | |
| 44 | OK (read_matrix (&A, stdin, false, false, one_based, false, false)) ; |
| 45 | |
| 46 | for (int hyper = 0 ; hyper <= 1 ; hyper++) |
| 47 | { |
| 48 | for (int csc = 0 ; csc <= 1 ; csc++) |
| 49 | { |
| 50 | double h = hyper ? GxB_ALWAYS_HYPER : GxB_NEVER_HYPER ; |
| 51 | GxB_Format_Value f = csc ? GxB_BY_COL : GxB_BY_ROW ; |
| 52 | |
| 53 | printf ("\n######### input A: hyper %d csc %d\n", hyper, csc) ; |
| 54 | |
| 55 | for (int format = 0 ; format <= 3 ; format++) |
| 56 | { |
| 57 | OK (GxB_Matrix_Option_set (A, GxB_HYPER_SWITCH, h)) ; |
| 58 | OK (GxB_Matrix_Option_set (A, GxB_FORMAT, f)) ; |
| 59 | OK (import_test (&A, format, dump)) ; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | FREE_ALL ; |
| 65 | |
| 66 | OK (GrB_finalize ( )) ; |
| 67 | printf ("import_demo: all tests passed\n") ; |
| 68 | } |
| 69 |
nothing calls this directly
no test coverage detected