Creating sparse diagonal matrix of CuArray

Hemsh94
Wed, 05 Apr 2023 09:40:42 +0000
General Usage

Hello everyone,

If we have a vector (u), we can easily convert it into a sparse diagonal matrix using the command spdiagm(u).

I want to do the same operation using CUDA where u is defined as CuArray(u). The command spdiagm(u) gives the scalar indexing error and therefore it does not work.

I tried using CuSparseMatrixCSC(Diagonal(u)), it works but it is very slow. Is there a way to perform this task efficiently?

I am relatively new to CUDA so any help is appreciated.

Thank you.

1 post - 1 participant