Effacer les filtres
Effacer les filtres

Store solution in linear iterative solver using CGS/biCG

1 vue (au cours des 30 derniers jours)
Chaitanya Sanghavi
Chaitanya Sanghavi le 6 Fév 2018
Réponse apportée : JK le 7 Fév 2018
Hello All, This might be a stupid question but I could not find an answer before. Lets say I use, [iter,flag,res.error] = cgs(A,b); where A is square matrix and b is a vector. I get convergence at 46th iteration.
Is is possible to store the solution at each iteration ? I see in Matlab this has been implemented using multi-threads and I assume the solver does not store the solution at each iteration and only updates the memory.
But for my analysis, I need to solution at each iteration. Is this possible ? Ofcourse I can write my own algorithm but would be nice if there is a easier way out !

Réponses (1)

JK
JK le 7 Fév 2018
Not sure if this will work, but might worth a try: Have you tried to provide A with a function handle @(x) A(x)? In the function A you can put:
global xx if xx(:,end) ~= x xx(:,end+1)=x; end
xx then contains an array of column vectors of x in global workspace. You must set it up to the proper number of rows for the first call.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by