Convert CuArray(u) vector into diagonal sparse matrix

Hello everyone,

Is there a function that can convert a CuArray(u) of size(N) to a sparse diagonal matrix of size (N,N). I tried looking into the CUSPARSE functions but did not find anything helpful.

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

Thank you.

Is this a question about Julia? If so, you may get better help posting on a forum for CUDA.jl