| 1039 | //------------------------------------------------------------------------------ |
| 1040 | |
| 1041 | void test_RGMatrix_fuzzy() { |
| 1042 | GrB_Type t = GrB_BOOL; |
| 1043 | RG_Matrix A = NULL; |
| 1044 | RG_Matrix T = NULL; // A transposed |
| 1045 | GrB_Matrix M = NULL; // primary internal matrix |
| 1046 | GrB_Matrix MT = NULL; |
| 1047 | GrB_Matrix N = NULL; |
| 1048 | GrB_Matrix NT = NULL; |
| 1049 | GrB_Info info = GrB_SUCCESS; |
| 1050 | GrB_Index nrows = 100; |
| 1051 | GrB_Index ncols = 100; |
| 1052 | GrB_Index i = 0; |
| 1053 | GrB_Index j = 1; |
| 1054 | GrB_Index* I = NULL; |
| 1055 | GrB_Index* J = NULL; |
| 1056 | uint32_t operations = 10000; |
| 1057 | |
| 1058 | //-------------------------------------------------------------------------- |
| 1059 | // create RGMatrix |
| 1060 | //-------------------------------------------------------------------------- |
| 1061 | |
| 1062 | srand(time(0)); |
| 1063 | |
| 1064 | I = (GrB_Index*) malloc(sizeof(GrB_Index) * operations); |
| 1065 | J = (GrB_Index*) malloc(sizeof(GrB_Index) * operations); |
| 1066 | |
| 1067 | info = RG_Matrix_new(&A, t, nrows, ncols); |
| 1068 | info = RG_Matrix_new(&A->transposed, t, ncols, nrows); |
| 1069 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1070 | |
| 1071 | // make sure transposed was created |
| 1072 | T = RG_Matrix_getTranspose(A); |
| 1073 | TEST_ASSERT(T != A); |
| 1074 | TEST_ASSERT(T != NULL); |
| 1075 | |
| 1076 | // get internal matrices |
| 1077 | M = RG_MATRIX_M(A); |
| 1078 | MT = RG_MATRIX_M(T); |
| 1079 | |
| 1080 | info = GrB_Matrix_new(&N, t, nrows, ncols); |
| 1081 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1082 | |
| 1083 | info = GrB_Matrix_new(&NT, t, ncols, nrows); |
| 1084 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1085 | |
| 1086 | uint additions = 0; |
| 1087 | for (size_t index = 0; index < operations; index++) |
| 1088 | { |
| 1089 | if (index < 10 || rand() % 100 > 20) |
| 1090 | { |
| 1091 | i = rand() % nrows; |
| 1092 | j = rand() % ncols; |
| 1093 | |
| 1094 | //------------------------------------------------------------------ |
| 1095 | // set element at position i,j |
| 1096 | //------------------------------------------------------------------ |
| 1097 | |
| 1098 | info = RG_Matrix_setElement_BOOL(A, i, j); |
nothing calls this directly
no test coverage detected