Conjugate gradient for nonsymmetric problem

AI Thread Summary
The discussion centers on adapting the conjugate gradient method for nonsymmetrical boundary value problems, particularly in a 2D square grid scenario. The user seeks to solve a system where the matrix A is not symmetric, which poses a challenge since the conjugate gradient method is typically applicable only to symmetric matrices. Suggestions include using the biconjugate gradient algorithm, with a caution about its potential instability. The BiCGSTAB algorithm is recommended as a stabilized version of the biconjugate gradient method. Additionally, an alternative approach involves transforming the problem to solve A^T A y = A^T b, though this may affect numerical precision due to the condition number. The discussion also touches on the need for efficient solutions, as the user currently employs successive over-relaxation (SOR) and is looking for faster methods. There is a request for code snippets in C or C# for the conjugate gradient method.
ihggin
Messages
14
Reaction score
0
Hi, I was wondering if it is possible to adapt the conjugate gradient method (or if there's a variation of the method) for nonsymmetrical boundary value problems.

For example, I want to solve something like a 2D square grid, where f(x)=0 for all x on the boundary of the square, f(x_{i0,j0})=1 and f(x_{i1, j1}) for specified interior points, and

f(x_{i,j})=.1f(x_{i-1,j})+.2f(x_{i+1,j})+.3f(x_{i,j-1})+.4f(x_{i,j+1})

for all other interior grid points x_{i,j}. If I change f_{i,j} to a 1D vector y_{k}, and then write the system of eqs out, the matrix A in the system I want to solve (Ay=b) is not symmetric.

From what I've read, the conjugate gradient method only works for symmetric A, so I was wondering if there is some way to adapt the method, or a different way of setting up the system. If not, what would be the fastest way to solve this problem? (The only reason I'm interested in conjugate gradient is b/c I heard it's fast.) I'm currently using successive over-relaxation (SOR). Is there anything faster?
 
Technology news on Phys.org
ihggin said:
From what I've read, the conjugate gradient method only works for symmetric A, so I was wondering if there is some way to adapt the method, or a different way of setting up the system.

Google for "biconjugate gradient algorithm".

There are some traps here, because biconjugate gradient can be unstable. A practical stabilized version is the BiCGSTAB algorithm (also in Google!)
 
Another way the conjugate gradient method could be used is to solve
A^T A y = A^T b​
 
Hurkyl said:
Another way the conjugate gradient method could be used is to solve
A^T A y = A^T b​

True, provided it doesn't matter that the condition number of A^T A is the square of the condition number of A, which may decrease the numerical precision.

The biconjugate gradient method also involves multiplyng vectors by A^T, but it doesn't degrade the condition number.
 
Anybody has Conjugate Gradient code snippet in C or C#?
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top