I want to solve a 5x5 matrix using gradient iterative method. After ~34000 iteration I got result in given stopping tolerance. But can we modify/improve my iteration so that we can find solution in less iteration say 30000 steps?
Flatten b so it is a vector, get rid of all the transposing because it’s not needed for vector multiplication, define iP=Inverse[P], and try this for the nesting iterations:
You did not try what I said. You used for the nesting function (# + iP.(b - A.#).(b - A.#)/iP.(b - A.#).A.iP.(b - A.#) iP.(b - A.#)) &. That is not the function I recommended to use. In particular I count four uses of that inverse iP in yours, and only one in mine.