diff --git a/src/C-interface/ellblock/bml_allocate_ellblock.c b/src/C-interface/ellblock/bml_allocate_ellblock.c index ca5138b4b..92392c52a 100644 --- a/src/C-interface/ellblock/bml_allocate_ellblock.c +++ b/src/C-interface/ellblock/bml_allocate_ellblock.c @@ -75,7 +75,7 @@ bml_get_block_sizes( { s_default_bsize[ib] = s_default_block_dim; } - s_default_bsize[s_nb - 1] = N % s_default_block_dim; + s_default_bsize[s_nb - 1] = N - s_default_block_dim * (s_nb - 1); } return s_default_bsize; } @@ -224,6 +224,8 @@ bml_zero_matrix_ellblock( int M, bml_distribution_mode_t distrib_mode) { + assert(N >= M); + bml_matrix_ellblock_t *A = NULL; switch (matrix_precision) diff --git a/src/C-interface/ellblock/bml_allocate_ellblock_typed.c b/src/C-interface/ellblock/bml_allocate_ellblock_typed.c index ea4c525c9..0b8129ede 100644 --- a/src/C-interface/ellblock/bml_allocate_ellblock_typed.c +++ b/src/C-interface/ellblock/bml_allocate_ellblock_typed.c @@ -105,7 +105,9 @@ void TYPED_FUNC( A->indexb[ind - 1] = A->indexb[ind]; A->ptr_value[ind - 1] = A->ptr_value[ind]; } - A->ptr_value[A->nnzb[ib] - 1] = NULL; + int ind = ROWMAJOR(ib, A->nnzb[ib] - 1, A->NB, A->MB); + A->ptr_value[ind] = NULL; + A->indexb[ind] = -1; break; } }