View Single Post
  #13   Spotlight this post!  
Unread 26-05-2013, 15:20
James Critchley James Critchley is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Apr 2011
Rookie Year: 2010
Location: Lake Orion, Michigan
Posts: 45
James Critchley is an unknown quantity at this point
Re: OPR-computation-related linear algebra problem

Nikhil,
Is there a reason why you are not using the "pcg" function which assumes symmetric positive definite inputs? This should be faster. Also please consider using the diagonal as a preconditioner. Unfortunately I do not have access the MATLAB at the moment. Could you try please the following? And sorry in advance for any bugs:

Ns = sparse(N);
D = diag(Ns);
Ds = sparse(diag(D)); #This was a bug... maybe it still is!

# Reference Solution
tic
output = Ns\d;
toc

# CG Solution
tic
output = pcg(Ns,d)
toc

# Diagonal PCG Solution
tic
output = pcg(Ns,d,[],[],Ds)
toc

# Reverse Cutthill-McKee re-ordering
tic
p = symrcm(Ns); # permutation array
Nr = Ns(p,p); # re-ordered problem
toc

# Re-ordered Solve
tic
output = Nr\d; #answer is stored in a permuted matrix indexed by 'p'
toc

Another advantage to the conjugate gradient methods is concurrent form of the solution within each iteration (parallel processing).

Best regards

Last edited by James Critchley : 26-05-2013 at 15:43.
Reply With Quote