Prev: one line data from text file , Where the end position is unknown
Next: Call for Papers:Special Issue on Cognitive Information Processing
From: Jeremy Roberts on 16 May 2010 13:33 I'm working on the direct solution of the discrete ordinates, a common technique in radiation transport. Without going into details, I create a set of diagonal vectors for constructing a sparse matrix K to solve Kx=b. The lower and upper diagonals are stored in kL and kU, while the center diagonal is kC. I construct K via K = spdiags([ kL(:,end:-1:1) kC kU ], -(bw-1):(bw-1), length(kC), length(kC)) This works just fine, and the resulting K gives the right solution, but the time it takes spdiags to execute dwarfs both the time it takes to create the diagonals and the time it takes to execute x = K\b. Is there a better way to use spdiags? Is there an alternative? |