Store solution in linear iterative solver using CGS/biCG

1 回表示 (過去 30 日間)
Chaitanya Sanghavi
Chaitanya Sanghavi 2018 年 2 月 6 日
回答済み: JK 2018 年 2 月 7 日
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 !

回答 (1 件)

JK
JK 2018 年 2 月 7 日
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.

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by