Create random symmetric matrix with given cond number to pass it to pcg
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to generate random positive definitive symmetric matrix with given cond number, but the requirement is that PCG method should be able to solve it.
For now I use generation algorithm from this question. It does generate positive definitive symmetric random matrix with given cond number, but that is insufficient - pcg can't solve it even for smaller cond numbers. Pcg returns flag 4, which means that during algo it simply couldn't converge.
What am I doing wrong? Maybe there is better generating algorithm?
3 Commenti
Bruno Luong
il 11 Mar 2023
Modificato: Bruno Luong
il 11 Mar 2023
" I don't know the exact requirements of pcg honestly"
positive definitive symmetric matrix.
For now I use generation algorithm from this question. It does generate positive definitive symmetric
That's the problem, the algo in the question you quote: it does not generate positive matrix as you freely believe.
Risposta accettata
Bruno Luong
il 11 Mar 2023
Modificato: Bruno Luong
il 11 Mar 2023
n=10; % size of the system
condtarget = 1000;
% generate ransom spd matrix
[Q,~]=qr(randn(n));
r = rand(n,1);
r = (r-min(r))/(max(r)-min(r));
d=exp(r*log(condtarget));
A=Q'*diag(d)*Q
cond(A)
b=rand(n,1) % random rhs
x=pcg(A,b)
A*x % should close to b
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!