[cctbxbb] sparse matrix

Luc Bourhis luc_j_bourhis at mac.com
Fri Jun 6 07:06:10 PDT 2014


On 6 Jun 2014, at 15:40, David Waterman <dgwaterman at gmail.com> wrote:

> I don't intend to assign any particular index in the matrix_column
> more than once. I'm not sure if that perhaps gives me the upper hand
> wrt the trade-offs you mention?

That's the other way around actually: I designed the sparse columns so as to make operations like 
x(i) += 1.0 or x(i) = 2.0			(a)
basically O(1), at the price of wasting some memory, and the necessity of calling x.compact() when the construction of the vector is finished. On the contrary, reading x(i) is O(log n) where n is the number of non-zero elements in x. I chose that because operations (a) are repeated many times to build a Jacobian by pieces and composition (the aim was constraints for small molecule crystallography). On the contrary, all sparse algorithms can be written so as to avoid indexing (by iterating through the known non-zero elements).

Actually, looking at my code, I realise that I designed it so that compact() is called as needed! You don't need to do it explicitly. 

In any case, it looks like the right structure if you want to deal with sparse Jacobian indeed. Ok, no problem, I'll add selection then. 

Best wishes,

Luc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20140606/7057e775/attachment.htm>


More information about the cctbxbb mailing list