@@ -529,15 +529,15 @@ k2mat_t k2jump(size_t size, const k2mat_t *a)
529529// the submatrices are not minimats since we are not at the last level of the tree
530530// :a is not all 0's, it could be all 1's
531531// note: a could be open ended
532- // backpointer should have been already followed
532+ // backpointers should have been already followed
533533// main_diag_1 if present is transmitted to the diagonmal submatrices
534534void k2split_k2 (const k2mat_t * a , k2mat_t b [2 ][2 ])
535535{
536536 assert (a != NULL && b != NULL );
537537 size_t size = a -> fullsize ;
538538 assert (size > 2 * MMsize );
539539 assert (size %2 == 0 );
540- assert (a -> main_diag_1 == false || a -> realsize > 0 ); // if main_dag real size mus be well defined
540+ assert (a -> main_diag_1 == false || a -> realsize > 0 ); // if main_diag real size mus be well defined
541541 assert (a -> open_ended || !k2is_empty (a )); // k2is_empty cannot be called for an open ended matrix
542542 // init size
543543 for (int i = 0 ;i < 4 ;i ++ ) {
@@ -618,7 +618,7 @@ void k2split_k2(const k2mat_t *a, k2mat_t b[2][2])
618618 subt_size [0 ] = k2treesize (a )- 1 ;
619619 else { // if treesize not available compute subtree size with a visit
620620 size_t next = pos ;
621- k2dfs_visit_fast (size /2 ,a ,& next );
621+ k2dfs_visit_fast (size /2 ,a ,& next ); // it would do the same visit later
622622 subt_size [0 ] = next - pos ;
623623 }
624624 }
@@ -629,9 +629,9 @@ void k2split_k2(const k2mat_t *a, k2mat_t b[2][2])
629629 int i = k /2 ; int j = k %2 ;
630630 if (root & (1 <<k )) { // k-th child is non empty
631631 if (a -> subtinfo || nchildren == 1 ) next = pos + subt_size [child ]; // jump to end of submatrix
632- else k2dfs_visit_fast (size /2 ,a ,& next ); // move to end of submatrix
633- k2clone_submatrix (a , pos , next , & b [i ][j ]); // create pointer to submatrix
634- pos = next ; // advance to next item
632+ else k2dfs_visit_fast (size /2 ,a ,& next ); // move to end of submatrix
633+ k2clone_submatrix (a , pos , next , & b [i ][j ]); // create pointer to submatrix
634+ pos = next ; // advance to next item
635635 if (a -> subtinfo ) {
636636 b [i ][j ].subtinfo = subt_info [child ]; // save subtinfo if available
637637 b [i ][j ].subtinfo_size = subt_info_size [child ++ ]; // save subtinfo_size and advance child
@@ -650,7 +650,7 @@ void k2split_k2(const k2mat_t *a, k2mat_t b[2][2])
650650 b [1 ][1 ].realsize = a -> realsize - size /2 ;
651651 }
652652 else {
653- b [0 ][0 ].realsize = size / 2 ; // b[1][1] has not main_diag_1
653+ b [0 ][0 ].realsize = a -> realsize ; // b[1][1] has not main_diag_1
654654 }
655655 assert (b [0 ][0 ].realsize <= b [0 ][0 ].fullsize );
656656 assert (b [1 ][1 ].realsize <= b [1 ][1 ].fullsize );
0 commit comments