@@ -55,15 +55,13 @@ typedef struct
5555
5656void check_user_age (bool * z , const User * x , GrB_Index _i , GrB_Index _j , const uint8_t * y ) // EdgeOwns
5757{
58- {
59- * z = (x -> age > * y );
60- }
58+
59+ * z = (x -> age > * y );
6160}
6261void check_payment_system (bool * z , const Card * x , GrB_Index _i , GrB_Index _j , const uint8_t * y )
6362{
64- {
65- * z = ((x -> system ) == * y );
66- }
63+
64+ * z = ((x -> system ) == * y );
6765}
6866
6967void tx_bool_mult (EdgeTX * z , const bool * x , const EdgeTX * y )
@@ -111,7 +109,7 @@ void exp_binop(double *z, const double *x)
111109
112110void F_op (double * z , const EdgeTX * x )
113111{
114- * z = (x -> sum / 1000 )/ (x -> count );
112+ * z = (x -> sum / 1000 ) / (x -> count );
115113}
116114void divide (double * z , const double * x , const double * y )
117115{
@@ -406,7 +404,7 @@ GrB_Info banking_page_rank(GrB_Matrix tx_edge_mat, GrB_Matrix owns_edge_mat, GrB
406404 TRY (GrB_Matrix_reduce_Monoid (EXPSUMvec , NULL , NULL , GrB_PLUS_MONOID_FP64 , EXPmat , NULL ));
407405 GxB_print (EXPSUMvec , GxB_COMPLETE );
408406
409- // do masked kroneker (mask: EXPmat, A: EXPSUMvec, B: ID vector) (KRONEXPSUMmat )
407+ // do masked mxm (mask: EXPmat, A: EXPSUMvec, B: ID vector) (EXPSUMmat )
410408
411409 GrB_Vector id_final ;
412410 TRY (GrB_Vector_new (& id_final , GrB_FP64 , VERTICES_NUMBER ));
@@ -418,19 +416,19 @@ GrB_Info banking_page_rank(GrB_Matrix tx_edge_mat, GrB_Matrix owns_edge_mat, GrB
418416 TRY (GrB_Matrix_new (& id_mat , GrB_FP64 , 1 , VERTICES_NUMBER ));
419417 TRY (GrB_Row_assign (id_mat , NULL , NULL , id_final , 0 , GrB_ALL , VERTICES_NUMBER , NULL ));
420418
421- GrB_Matrix KRONEXPSUMmat ;
422- TRY (GrB_Matrix_new (& KRONEXPSUMmat , GrB_FP64 , VERTICES_NUMBER , VERTICES_NUMBER ));
419+ GrB_Matrix EXPSUMmat ;
420+ TRY (GrB_Matrix_new (& EXPSUMmat , GrB_FP64 , VERTICES_NUMBER , VERTICES_NUMBER ));
423421
424- TRY (GrB_mxm (KRONEXPSUMmat , EXPmat , NULL , GxB_PLUS_TIMES_FP64 , v_mat , id_mat , NULL ));
425- GxB_print (KRONEXPSUMmat , GxB_COMPLETE );
422+ TRY (GrB_mxm (EXPSUMmat , EXPmat , NULL , GxB_PLUS_TIMES_FP64 , v_mat , id_mat , NULL ));
423+ GxB_print (EXPSUMmat , GxB_COMPLETE );
426424
427- // apply div to (EXPmat and KRONEXPSUMmat ) (M)
425+ // apply div to (EXPmat and EXPSUMmat ) (M)
428426 GrB_Matrix M ;
429427 TRY (GrB_Matrix_new (& M , GrB_FP64 , VERTICES_NUMBER , VERTICES_NUMBER ));
430428 // define add operation (A + B = A / B) (div)
431429 GrB_BinaryOp divide_op ;
432430 TRY (GrB_BinaryOp_new (& divide_op , (GxB_binary_function )& divide , GrB_FP64 , GrB_FP64 , GrB_FP64 ));
433- TRY (GrB_Matrix_eWiseAdd_BinaryOp (M , NULL , NULL , divide_op , EXPmat , KRONEXPSUMmat , NULL ));
431+ TRY (GrB_Matrix_eWiseAdd_BinaryOp (M , NULL , NULL , divide_op , EXPmat , EXPSUMmat , NULL ));
434432 GxB_print (M , GxB_COMPLETE );
435433
436434 // ------------------------------------------------------------------------
@@ -449,6 +447,37 @@ GrB_Info banking_page_rank(GrB_Matrix tx_edge_mat, GrB_Matrix owns_edge_mat, GrB
449447
450448 TRY (LAGr_PageRank_NoTeleport (& pagerank_ans , & iteraions , G , 1e-4 , 100 ));
451449 GxB_print (pagerank_ans , GxB_COMPLETE );
450+ GrB_free (& ID );
451+ GrB_free (& v );
452+ GrB_free (& owns_mat_filtered );
453+ GrB_free (& filtered_cards );
454+ GrB_free (& tx_bool_add_op );
455+ GrB_free (& tx_bool_mul_op );
456+ GrB_free (& tx_bool_mul_right_op );
457+ GrB_free (& tx_bool_monoid );
458+ GrB_free (& tx_bool_semiring );
459+ GrB_free (& tx_bool_semiring_right );
460+ GrB_free (& tx_mat_filtered );
461+ GrB_free (& tx_mat_filtered2 );
462+ GrB_free (& tx_is_nonempty_op );
463+ GrB_free (& keep );
464+ GrB_free (& tx_clean );
465+ GrB_free (& mean_op );
466+ GrB_free (& exp_op );
467+ GrB_free (& Fmat );
468+ GrB_free (& EXPmat );
469+ GrB_free (& EXPSUMvec );
470+ GrB_free (& id_final );
471+ GrB_free (& v_mat );
472+ GrB_free (& id_mat );
473+ GrB_free (& EXPSUMmat );
474+ GrB_free (& divide_op );
475+ GrB_free (& M );
476+ GrB_free (& pagerank_ans );
477+
478+ LAGraph_Delete (& G , msg );
479+
480+ return GrB_SUCCESS ;
452481}
453482
454483int main ()
@@ -490,4 +519,13 @@ int main()
490519 // ------------------------------------------------------------------------
491520
492521 TRY (banking_page_rank (tx_edge_mat , owns_edge_mat , users , cards ));
493- }
522+ GrB_free (& tx_edge_mat );
523+ GrB_free (& owns_edge_mat );
524+ GrB_free (& users );
525+ GrB_free (& cards );
526+ GrB_free (& user );
527+ GrB_free (& card );
528+ GrB_free (& tx_edge );
529+
530+ LAGraph_Finalize (msg );
531+ }
0 commit comments