Added option for treating B_j as a sparse matrix