Sparse Matrix Iterations?

Discussion in 'Physics & Math' started by Facial, Sep 24, 2015.

  1. Facial Valued Senior Member

    I recently wrote a short script in Matlab / Octave with the following pseudocode:

    1. Initialize F, s, Δs, b, and n.
    2. While s < b or F < 100,
    a. Compute F = some complicated function of s.
    b. Compute Δs = function of F.
    c. s = s + Δs.
    f. n++.

    When I write this as a for-loop the results can take hours to spit out, where n counts to the millions. I've taken a look at multicore processing but that only shaves off a fraction of computing time, whereas taking calculating this in terms of a sparse matrix would be many times faster. I've tried looking at procedures on how to do this with an example on routines such as this one where each answer influences the next one inside the vector, but I can't devise a way for it to work. Furthermore, I do not know the dimensions n of the final matrix. Is there hope for a solution?

Share This Page