Matrix BInverse implementation for both row-wise and col-wise storage