Skip to content

Commit 9c2bf0e

Browse files
committed
refactor: remove dead code and debug prints
1 parent abf7b38 commit 9c2bf0e

File tree

1 file changed

+5
-107
lines changed

1 file changed

+5
-107
lines changed

src/main.c

Lines changed: 5 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -265,60 +265,7 @@ int main()
265265
TRY(GrB_Vector_apply_IndexOp_UDT(v, NULL, NULL, user_age, users, &age, NULL));
266266
GxB_print(v, GxB_COMPLETE);
267267
TRY(GrB_Matrix_diag(&ID, v, 0));
268-
// GrB_Matrix v_mat, id_mat;
269-
// GrB_Matrix_new(&v_mat, GrB_BOOL, VERTICES_NUMBER, 1);
270-
// GrB_Col_assign(v_mat, NULL, NULL, v, GrB_ALL, VERTICES_NUMBER, 0, NULL);
271-
272-
// GrB_Vector id;
273-
// TRY(GrB_Vector_new(&id, GrB_BOOL, VERTICES_NUMBER);
274-
// TRY(GrB_Vector_assign_BOOL(id, NULL, NULL, true, GrB_ALL, VERTICES_NUMBER, NULL);
275-
// GrB_Matrix_new(&id_mat, GrB_BOOL, 1, VERTICES_NUMBER);
276-
// GrB_Row_assign(id_mat, NULL, NULL, id, 0, GrB_ALL, VERTICES_NUMBER, NULL);
277-
278-
// GrB_Matrix kron;
279-
// GrB_Matrix_new(&kron, GrB_BOOL, VERTICES_NUMBER, VERTICES_NUMBER);
280-
// // GxB_print(v_mat, GxB_COMPLETE);
281-
// // GxB_print(id_mat, GxB_COMPLETE);
282-
// TRY(GrB_kronecker(kron, NULL, NULL, GrB_LAND, v_mat, id_mat, NULL);
283-
284-
// DEBUG
285-
printf("filter matrix content: \n");
286-
for (GrB_Index i = 0; i < VERTICES_NUMBER; i++)
287-
for (GrB_Index j = 0; j < VERTICES_NUMBER; j++)
288-
{
289-
bool val;
290-
GrB_Matrix_extractElement_BOOL(&val, ID, i, j);
291-
if (info == GrB_SUCCESS)
292-
{
293-
printf("[%lu,%lu] = %d\n", i, j, val);
294-
}
295-
// else if (info == GrB_NO_VALUE)
296-
// {
297-
// printf("[%lu,%lu] no value\n", i, j);
298-
// }
299-
// else
300-
// {
301-
// printf("[%lu,%lu] error code: %d\n", i, j, info);
302-
// }
303-
}
304-
// for (GrB_Index i = 0; i < VERTICES_NUMBER; i++)
305-
// {
306-
// bool val;
307-
// GrB_Info TRY(GrB_Matrix_extractElement_BOOL(&val, kron, i, i);
308-
// if (info == GrB_SUCCESS)
309-
// {
310-
// printf("[%lu,%lu] = %d\n", i, i, val);
311-
// }
312-
// else if (info == GrB_NO_VALUE)
313-
// {
314-
// printf("[%lu,%lu] no value\n", i, i);
315-
// }
316-
// else
317-
// {
318-
// printf("[%lu,%lu] error code: %d\n", i, i, info);
319-
// }
320-
// }
321-
268+
322269
// ------------------------------------------------------------------------
323270
// apply user filters
324271
// ------------------------------------------------------------------------
@@ -336,47 +283,8 @@ int main()
336283

337284
GrB_Matrix owns_mat_filtered;
338285
TRY(GrB_Matrix_new(&owns_mat_filtered, GrB_BOOL, VERTICES_NUMBER, VERTICES_NUMBER));
339-
printf("\nowns edge mat before filter\n");
340-
for (GrB_Index i = 0; i < VERTICES_NUMBER; i++)
341-
for (GrB_Index j = 0; j < VERTICES_NUMBER; j++)
342-
{
343-
EdgeOwns val;
344-
GrB_Matrix_extractElement_UDT(&val, owns_edge_mat, i, j);
345-
if (info == GrB_SUCCESS)
346-
{
347-
printf("[%lu,%lu] = %d\n", i, j, val.days);
348-
}
349-
// else if (info == GrB_NO_VALUE)
350-
// {
351-
// printf("[%lu,%lu] no value\n", i, j);
352-
// }
353-
// else
354-
// {
355-
// printf("[%lu,%lu] error code: %d\n", i, j, info);
356-
// }
357-
}
358286
// apply filter
359-
// TRY(GrB_Matrix_assign(owns_mat_filtered, kron, NULL, owns_edge_mat, GrB_ALL, VERTICES_NUMBER, GrB_ALL, VERTICES_NUMBER, NULL);
360287
TRY(GrB_mxm(owns_mat_filtered, NULL, NULL, owns_semiring_bool, ID, owns_edge_mat, NULL));
361-
printf("\nowns edge mat after filter\n");
362-
for (GrB_Index i = 0; i < VERTICES_NUMBER; i++)
363-
for (GrB_Index j = 0; j < VERTICES_NUMBER; j++)
364-
{
365-
EdgeOwns val;
366-
GrB_Matrix_extractElement_UDT(&val, owns_mat_filtered, i, j);
367-
if (info == GrB_SUCCESS)
368-
{
369-
printf("[%lu,%lu] = %d\n", i, j, val.days);
370-
}
371-
// else if (info == GrB_NO_VALUE)
372-
// {
373-
// printf("[%lu,%lu] no value\n", i, j);
374-
// }
375-
// else
376-
// {
377-
// printf("[%lu,%lu] error code: %d\n", i, j, info);
378-
// }
379-
}
380288

381289
// ------------------------------------------------------------------------
382290
// get cards of filtered users
@@ -424,17 +332,7 @@ int main()
424332
TRY(GrB_mxm(tx_mat_filtered2, NULL, NULL, tx_bool_semiring_right, tx_mat_filtered, ID, NULL));
425333

426334
GxB_print(tx_mat_filtered2, GxB_COMPLETE);
427-
printf("Non-zero edges in tx_mat_filtered2:\n");
428-
for (GrB_Index i = 0; i < VERTICES_NUMBER; i++)
429-
for (GrB_Index j = 0; j < VERTICES_NUMBER; j++)
430-
{
431-
EdgeTX val;
432-
if (GrB_Matrix_extractElement_UDT(&val, tx_mat_filtered2, i, j) == GrB_SUCCESS)
433-
{
434-
if (val.count > 0)
435-
printf("(%lu,%lu): sum=%.1f count=%u\n", i, j, val.sum, val.count);
436-
}
437-
}
335+
438336
GrB_UnaryOp tx_is_nonempty_op;
439337
TRY(GxB_UnaryOp_new(&tx_is_nonempty_op, (GxB_unary_function)&tx_is_nonempty, GrB_BOOL, tx_edge, NULL, NULL));
440338

@@ -493,15 +391,15 @@ int main()
493391
TRY(GrB_mxm(KRONEXPSUMmat, NULL, NULL, GxB_PLUS_TIMES_FP64, v_mat, id_mat, NULL));
494392
GxB_print(KRONEXPSUMmat, GxB_COMPLETE);
495393

496-
// define add operation (A + B = A / B) (divv)
497-
498-
// apply divv to (EXPmat and KRONEXPSUMmat) (M)
394+
// apply div to (EXPmat and KRONEXPSUMmat) (M)
499395
GrB_Matrix M;
500396
TRY(GrB_Matrix_new(&M, GrB_FP64, VERTICES_NUMBER, VERTICES_NUMBER));
397+
// define add operation (A + B = A / B) (div)
501398
GrB_BinaryOp divide_op;
502399
TRY(GrB_BinaryOp_new(&divide_op, (GxB_binary_function)&divide, GrB_FP64, GrB_FP64, GrB_FP64));
503400
TRY(GrB_Matrix_eWiseAdd_BinaryOp(M, EXPmat, NULL, divide_op, EXPmat, KRONEXPSUMmat, NULL));
504401
GxB_print(M, GxB_COMPLETE);
402+
505403
// ------------------------------------------------------------------------
506404
// run pagerank
507405
// ------------------------------------------------------------------------

0 commit comments

Comments
 (0)