Bf and Bbus are sparse. But I guess the inverse of Bbus is not sparse anymore. Will it be different?
And is this an Octave problem or computer problem?
it is a known issue that certain operations on sparse arrays result in full arrays. just to confirm, you gave the line:
sparse(Bf(:, noref)) / sparse(Bbus(noslack, noref))
so they are both already sparse, you're just recasting them as sparse again to ensure that the output of your indexing call remains sparse? my understanding is that indexing operations on sparse arrays stay sparse whether they result in larger or smaller arrays, so the 'sparse' function calls there shouldn't be necessary.
I also believe the matrix division preserves sparseness. that seems to be the case with some simple tests at least.
is H already sparse? you're inserting sparse data into an existing array. maybe that's triggering the full conversion?