第27卷第8期 计算机应用与软件 Vo1.27No.8
2010年8月 ComputerApplicationsandSoftware Aug.2010
稀疏矩阵快速转置算法的分析与优化
王 敏
(渭南师范学院计算机科学系 陕西 渭南 714000)
摘 要 介绍稀疏矩阵的三元组表压缩存储方案时,提出了利用数组首下标元素存储稀疏矩阵总行数、总列数和非零元素总个数
三方面信息的改进的存储定义方式。给出了基于新的定义结构上用C语言编写的快速转置算法,并通过对算法性能进行分析,提
出了仅使用一个数组的两种改进的快速转置算法。经过对比两种改进算法的时间复杂度和空间复杂度,总结出既具有原快速转置
算法时间复杂度低的优点,又降低了算法的空间复杂度的优化算法,达到了对原快速转置算法进行优化的目的。
关键词 稀疏矩阵 三元组表压缩存储 快速转置 时问复杂度 空间复杂度
ANALYSISAND 0PTIMISATIoN oFFAST TRANSPoSITIoN
ALGoRITHM oF SPARSEM ATRIX
WangMin
(DepartmentofComputerScience,WeinanTeachersUniversity,Weinan714000,Shaanxi,China)
Abstract Whendescribingthetriplelistcompressionstoragemethodsofthesparsematrix,inthispaperweproposeanimprovedstorage
definingmethodwhichusesanarrayelementinthefirstsubscriptofsequencetriplelistarraytostoretheinformationinregardtothetotal
numberofrows,totalnumberofcolumnsandtotalnumberoflion—zero elementsofthesparsematrix.Thepapergivesthematrixfasttranspo—
sitionalgorithm writteninCandbasedonthenewstructuredefinitionproposed,andpresentstwokindsofimprovedfasttranspositionalgo—
rithm,bothusejustonearray,throughtheanalysisofalgorithmperformance.Aftercomparingthetimecomplexityandspacecomplexityof
thesetwokindsofimprovedalgorithm ,weconcludetoanoptimisedalgorithm thatpossessestheadvantageoflowertimecomplexityinexisting
fasttrnaspositionalgorithm whilereducesthespacecomplexityofthatalgorithm aswell,anditreachesthepurposeofoptimisingexistingfast
transpositionalgorithm.
Keywords Sparsematrix Triplelistcompressionstorage Fasttransposition Timecomplexity Spacecomplexity
元组按 “行序为主、列序为辅”的顺序构成一种线性序列,此时
0 引 言 可采用顺序和非顺序两种方式进行存储 ,具体采用哪种