您当前的位置: 首页 >  矩阵

FPGA硅农

暂无认证

  • 2浏览

    0关注

    282博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

稀疏矩阵CSR存储的C++实现

FPGA硅农 发布时间:2020-10-16 20:53:11 ,浏览量:2

实现了稀疏矩阵的生成(指定稀疏程度)、稀疏矩阵转换为CSR、从CSR中恢复出矩阵、稀疏矩阵和向量的乘法等功能。从运行结果来看,稀疏矩阵存储为CSR格式和向量相乘的运行速度快于普通矩阵向量乘法,而且稀疏程度越高,优势越明显。

#include
#include
#include
#include
typedef int dtype;
using namespace std;
void csr_to_matrix(dtype *value,dtype *colindex,dtype *rowptr,int n,int a,dtype** & M){
   M=new int*[n];
   for(int i=0;i            
关注
打赏
1658642721
查看更多评论
0.0387s