I would like to write a function to generate a diagonally dominant matrix of random values. What I'm ultimately leading to is writing a code to implement the Jacobi method on this matrix in CUDA for a final project in one of my classes.
The problem is I don't really know how to do this. One idea I had was to create a random number generator and for each row of the matrix I'd check to see if the diagonally dominant criteria is satisfied. Otherwise I'd generate new numbers until it works. Then just repeat this for all the rows of the matrix. Now, I don't necessarily like this idea because for large matrices there is just no way of knowing how long it would take to generate such a matrix. Are there any known methods for creating such a matrix efficiently?