c++ - Is there any efficient way to dynamically change the compress_matrix in boost? -


i using ublas::compressed matrix work umfpack, sparse linear solver. since doing simulation, every time linear system constructed differently might involve enlarging/shrinking coefficient matrix , sparse matrix multiplications. scale of linear system around 25k.

even there binding patch boost work umfpack, still need change matrix time time, figuring out number of non-zero values time-consuming(ideally, have give number of non-zero values when initialize matrix). also, use ublas::range append columns/rows dynamically.

so question is: there efficient way this? right it's slow me. transposing matrix dimension 15k costs 6s , appending 12k rows fast(because guess it's row-major matrix), appending same number of columns matrix can cost 20s(i guess same reason above, used column-major matrix total time required same).

kinda getting desperate here. suggestion welcome.

cheers.

i not familiar packages, why (ideally) have specify number of non-zero elements in matrix? can't over-specify , reduce in size?

i'm confused why adding columns should cost much. sparse format should able handle that. conclude 1 of 2 things happening. either matrix somehow being converted non-sparse matrix before being converted (seems horrible, , impossible in decent sparse matrix package) or code insertion quadratic, because repeatedly inserts values, shifting on others each time.

the latter seems likely. try roll own "insert column" code takes current sparse matrix, figures out how many more entries there are, allocates bigger block, , copies in sequentially, inserting new columns go. linear, , should instantaneous. don't know whether that's sufficient solve entire problem, should start.

furthermore, if matrix has on order of 25k entries, there no reasonable answer why copying or transposing should take more couple of milliseconds. think need benchmark individual pieces of problem , determine time going, unless above solution adding columns solves problem.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -