Create random symmetric matrix with given cond number to pass it to pcg
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Fedor
el 11 de Mzo. de 2023
Comentada: Fedor
el 11 de Mzo. de 2023
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 comentarios
Bruno Luong
el 11 de Mzo. de 2023
Editada: Bruno Luong
el 11 de Mzo. de 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.
Respuesta aceptada
Bruno Luong
el 11 de Mzo. de 2023
Editada: Bruno Luong
el 11 de Mzo. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!