Registered Member
|
Hello,
I was wondering if there is an optimal way to achieve something I am going to describe. The matrix I am working with is symmetric with an arrow head like shape For most of the part of the sparse matrix I know the structure beforehand. So I reserver the exact number of elements per column and then insert elements from lowest-->highest rows number . I understand that I could be allocating a couple of extra elements which could help. Regardless, say that I want to insert more elements in a column, I assume there will have to be some reallocation that I would like to minimize.
Most of the times the insertion part is a block and I assume that if I do it one at a time is not going to be optimal. So what would be the best way to say insert a24 which would be a square matrix ? I guess something like .col(i).insert(start_row, end_row) could be useful ? (equivalent for row(i) for row major) And a related question, since I read somewhere that there now Map<SparseMatrix> is available but could not find info. Is there a way to use the Map such that I can say a24 += a*b where a and b are dense after the elements have been inserted? I know that block is const so I cant use that but I was wondering if there is a way since now all the elements are inserted and present. Thanks in advance.
Last edited by xerion on Sun May 15, 2016 4:20 am, edited 1 time in total.
|
Registered Member
|
Maybe Block class should work.
and you can operate blk |
Registered Member
|
I dont think that this is possible.
operator+= not available for SparseMatrix Block and operator= you get a nice error message for block = denseMatrix "THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS" |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient