Hi David,
Without having tried this, I sense it might be a burden. I have a lot of values to set and don't really want to convert from flex.double via a dictionary. Are there any philosophical/technical/other reasons for not writing a set_selected method for sparse.vector? If not, I might try to do this.
First I am the author of that sparse matrix code. Then could you tell me what application you have in mind? My sparse matrix code has very specific memory and time trade-offs, that may not be suitable for your problem. But I can already answer your question: it would be slow as well as cumbersome to go through an intermediate dictionary. Initialising a sparse vector with a dictionary, I only implemented it to make testing easier. It is not designed to be used in heavy-duty production code. Moreover it would be perfectly legitimate for the sparse columns to support assignment through selections. I could easily make the following work: x = sparse.vector(10) # vector with 10 elements x.set_selected(index_selection, another_vector) x.compact() # part of the trade-offs I was talking about Best wishes, Luc