Boost Sparse Matrix Memory Requirement

家住魔仙堡 提交于 2019-12-11 05:28:51

问题


I'm thinking of using Boost's Sparse Matrix for a computation where minimal memory usage is the goal. Unfortunately, the documentation page didn't include a discussion of the sparse matrix implementation's memory usage when I looked through it. Nor am I sure how to determine how much memory the sparse matrix is using at any given time.

How much memory will the sparse matrix use? Can you quote a source?

How can I find out how much memory the matrix is using at a given time t?


回答1:


I cannot give you an exact answer. But generally speaking a sparse matrix uses an amount of memory that is a multiple of the number of nonzero entries of the matrix. A common format stores all nonzero entries in an array 'A' (row by row). Stores than a second array 'B' which gives the column-index of the corresponding nonzero entry from 'A' and a third array telling me where in array 'A' row x begins. Assuming datatypes type_nnz, type_index a N*N sparse matrix with nnz nonzero elements the memory requirement is

sizeof(type_nnz)*nnz + sizeof(type_index)*(nnz+N)


来源:https://stackoverflow.com/questions/9284005/boost-sparse-matrix-memory-requirement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!