@@ -27,23 +27,24 @@ def indexed_to_boolean_decomposition(graph, block_count):
2727
2828def transitive_reduction (assigns , mask ):
2929 result = Matrix (BOOL , assigns .ncols , assigns .ncols , name = "reduced_assigns" )
30- result << Matrix .mxm (mask , assigns , "land_lor " )
31- total = Matrix (BOOL , assigns .ncols , assigns .ncols , name = "closure" )
30+ result << Matrix .mxm (mask , assigns , "any_pair " )
31+ # total = Matrix(BOOL, assigns.ncols, assigns.ncols, name = "closure")
3232 unused_assigns = Matrix (BOOL , assigns .ncols , assigns .ncols , name = "unused_assigns" )
3333 unused_assigns (~ result .S ) << assigns
3434 closure = unused_assigns
35- total ("lor " ) << closure
36- # while closure.nvals > 0:
37- while True :
35+ # total("any ") << closure
36+ while closure .nvals > 0 :
37+ # while True:
3838 print ("Closure nvals = " , closure .nvals )
39- closure << Matrix .mxm (closure , unused_assigns , "land_lor " )
40- result ("lor " ) << Matrix .mxm (closure , mask , "land_lor " )
39+ closure << Matrix .mxm (closure , unused_assigns , "any_pair " )
40+ result ("any " ) << Matrix .mxm (closure , mask , "any_pair " )
4141 new_closure = Matrix (BOOL , assigns .ncols , assigns .ncols , name = "closure" )
4242 new_closure (~ result .S ) << closure
43- nnz = total .nvals
44- total ("lor" ) << closure
45- if total .nvals == nnz :
46- break
43+ #nnz = total.nvals
44+ # total("any") << closure
45+ closure = new_closure
46+ # if total.nvals == nnz:
47+ # break
4748 return result
4849
4950def to_label_decomposed_graph (graph , automata_size , initial_graph_size ):
@@ -56,18 +57,18 @@ def to_label_decomposed_graph(graph, automata_size, initial_graph_size):
5657 alloc_r << alloc .T
5758 print ("Boolean matrix for alloc_r nvals: " , alloc_r .nvals )
5859
59- # print("mask start")
60- # mask_v = Vector(BOOL, graph.ncols, name = "mask_vector")
61- # mask_v(op.lor) << alloc.reduce_columnwise("lor")
62- # mask_v(op.lor) << alloc.reduce_rowwise("lor")
60+ print ("mask start" )
61+ mask_v = Vector (BOOL , graph .ncols , name = "mask_vector" )
62+ mask_v (op .lor ) << alloc .reduce_columnwise ("lor" )
63+ mask_v (op .lor ) << alloc .reduce_rowwise ("lor" )
6364
6465 #print("entrypoints start")
6566
6667 #entrypoints = Vector(bool,graph.nrows, name="entrypoints")
6768 #entrypoints << graph.reduce_columnwise(op.lor)
6869 #mask_v(op.lor) << Vector.from_coo(list(set(range(0,graph.nrows)).difference(entrypoints.to_coo(values=False)[0])), values=True, dtype = BOOL)
6970
70- # mask_v(op.lor) << Vector.from_coo([i * automata_size for i in range(0, initial_graph_size)], values=True, dtype = BOOL, size= graph.ncols)
71+ mask_v (op .lor ) << Vector .from_coo ([i * automata_size for i in range (0 , initial_graph_size )], values = True , dtype = BOOL , size = graph .ncols )
7172
7273 load_i = Matrix (UINT64 , graph .ncols , graph .nrows , name = "load_i_after_intersection" )
7374 load_i << graph .select (graphblas .select .select_load ).apply (graphblas .unary .decode_load )
@@ -77,11 +78,11 @@ def to_label_decomposed_graph(graph, automata_size, initial_graph_size):
7778 store_i << graph .select (graphblas .select .select_store ).apply (graphblas .unary .decode_store )
7879 print ("Matrix for store_i nvals: " , store_i .nvals )
7980
80- # mask_v(op.lor) << load_i.reduce_columnwise("lor")
81- # mask_v(op.lor) << load_i.reduce_rowwise("lor")
81+ mask_v (op .lor ) << load_i .reduce_columnwise ("lor" )
82+ mask_v (op .lor ) << load_i .reduce_rowwise ("lor" )
8283
83- # mask_v(op.lor) << store_i.reduce_columnwise("lor")
84- # mask_v(op.lor) << store_i.reduce_rowwise("lor")
84+ mask_v (op .lor ) << store_i .reduce_columnwise ("lor" )
85+ mask_v (op .lor ) << store_i .reduce_rowwise ("lor" )
8586
8687 store_block_count = store_i .reduce_scalar ("max" ).get (0 ) + 1
8788 load_block_count = load_i .reduce_scalar ("max" ).get (0 ) + 1
@@ -109,14 +110,14 @@ def to_label_decomposed_graph(graph, automata_size, initial_graph_size):
109110
110111
111112
112- # assign_mask = mask_v.diag(name = "assign_mask")
113+ assign_mask = mask_v .diag (name = "assign_mask" )
113114
114115 assign = Matrix (BOOL , graph .ncols , graph .nrows , name = "assign_after_intersection" )
115116 assign << graph .select (graphblas .select .select_assign )
116117 print ("Boolean matrix for assign nvals: " , assign .nvals )
117118
118119
119- # assign << transitive_reduction(assign, assign_mask)
120+ assign << transitive_reduction (assign , assign_mask )
120121
121122 #assign_res = Matrix(BOOL, graph.ncols, graph.nrows, name = "assign_after_transitive_reduction")
122123 #assign_1 = Matrix.mxm(assign_mask, assign, "land_lor")
0 commit comments