フィルターのクリア

How can I define an array of sparse matrix? (both for GPU and CPU)

5 ビュー (過去 30 日間)
Sandra Martinez
Sandra Martinez 2022 年 5 月 16 日
回答済み: Amin zaami 2022 年 6 月 7 日
A=sparse(3,3)
MT=gpuArray(A);
M2(1,1)=1
%Error using gpuArray/subsasgn
%Sparse gpuArrays are not supported for this function.
L=sparse(3,3,1);
L(:,:,1)=A;
%N-dimensional indexing allowed for full matrices only.
L2=gpuArray(L);
L2(:,:,1)=MT;
%Error using gpuArray/subsasgn
%Sparse gpuArrays are not supported for this function.

採用された回答

James Tursa
James Tursa 2022 年 5 月 16 日
For CPU, you can use the ndSparse submission by Matt J on the FEX:
I am unaware of anything similar for GPU.

その他の回答 (1 件)

Amin zaami
Amin zaami 2022 年 6 月 7 日
See example below for sparse on GPU:
sparse(A1,A2,gpuArray(1),m1,m2);
sparse(41200,41200,gpuArray(1),41200,41200);
  • first 2 arguments for size, last two for memory,
  • there should be always A1<m1 & A2 <m2

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by