提升稀疏矩阵内存要求 [英] Boost Sparse Matrix Memory Requirement
问题描述
我想使用Boost的稀疏矩阵的计算,其中最小的内存使用量的目标。不幸的是,文档页面没' ŧ包括稀疏矩阵实现的内存使用情况的讨论,当我通过它看。我也不知道如何确定有多少内存稀疏矩阵在任何给定的时间使用。
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?
我如何找出多少内存矩阵在给定时间采用t
?
How can I find out how much memory the matrix is using at a given time t
?
推荐答案
我不能给你一个确切的答案。但一般来讲一个稀疏矩阵使用的存储器的量是这样的矩阵的非零项的数目的倍数。一个常见的格式存储阵列中的'A'所有非零项(逐行)。房屋比第二阵列'B',这给出了从'A'和第三排相应的非零项的列索引告诉我在哪里阵'A'x行开始。
假设数据类型type_nnz,type_index与NNZ非零元素的N×N个稀疏矩阵对存储器的要求
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)
这篇关于提升稀疏矩阵内存要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!