I didn't go with what was suggested here. Instead I'm creating a SGSparseVector on the fly from the SGVector. I don't really like the two consecutive loops above, but since dim << feature space, I think the overhead won't be significant.