Store solution in linear iterative solver using CGS/biCG

1 visualización (últimos 30 días)
Chaitanya Sanghavi
Chaitanya Sanghavi el 6 de Feb. de 2018
Respondida: JK el 7 de Feb. de 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 !

Respuestas (1)

JK
JK el 7 de Feb. de 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.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by