How to reassign values for sparse GPU arrays?

I created a sparse GPU array (say L=sparse(1:Nper-1,2:Nper,x,Nper,Nper), where x is a GPU array ). Then I tried to reassign values using: L(1,1)=0; L(1,2)=0;
I get the following error:
Error using gpuArray/subsasgn
Sparse gpuArrays are not supported for this
function.
Error in a/f (line 45)
L(1,1)=0; L(1,2)=0;
Can anyone tell me how to solve problem in simple way? (assume that I can't assign correct values while creating array...I have to reassign later)
Thank you.

 Respuesta aceptada

Joss Knight
Joss Knight el 14 de Nov. de 2018

1 voto

You can use FIND to retrieve the nonzeros and their row and column indices. Then replace the values you want and construct a new sparse array as before.

Más respuestas (0)

Categorías

Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Etiquetas

Preguntada:

pb
el 12 de Nov. de 2018

Respondida:

el 14 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by