Programming Assignment # 3

$ 5.00

Programming Assignment # 3 Goals The goals of this third programming assignment are: 1. To ensure you understand the Jacobi and Gauss-Seidel solvers 2. To ensure you understand how to code up the Conjugate Gradient solver 3. To ensure you know how to compare the iteration count between two solvers Coding Requirements Begin with the…

Description

Programming Assignment # 3

Goals
The goals of this third programming assignment are:
1. To ensure you understand the Jacobi and Gauss-Seidel solvers
2. To ensure you understand how to code up the Conjugate Gradient solver
3. To ensure you know how to compare the iteration count between two solvers

Coding Requirements
Begin with the code provided on Canvas in finiteDifference.zip, which is very similar to what we developed
in class. Complete that code such that it does the following:
1. Executes the Jacobi, Gauss-Seidel, and Conjugate Gradient solvers. You are given the Jacobi solver. Use
it to create the Gauss-Seidel solver. You are given much of the Conjugate Gradient solver. However, look
for “TO-DO” phrases in solvers.h. You will need to complete that part of the code. Be sure to use the
Wikipedia reference in the CG routine when trying to complete the CG code.
2. Uses consistent convergence tests between the solvers. Notice that CG uses two tests while the others
use only one test. Modify the codes so that they all use the same tests.
Reporting Work
1. Create a PDF file that contains the following
(a) The complete source code listing including the original code and the code you added.
(b) A comparison of the number of iterations required for all solvers, such as
Solve system using Jacobi…
Jacobi/GS converged in 713 iterations
Solve system using Gauss-Seidel…
Jacobi/GS converged in 381 iterations
Solve system using Conjugate-Gradient…
CG converged in 56 iterations.

1

(c) Discussion of the iteration count. When you discuss the iteration count and its impact on final wall-
clock performance, be sure to comment on the complexity of a single CG iteration versus the com-
plexity of a Jacobi and Gauss-Seidel iteration. You will not be graded harshly on this particular task,

but please give it a try. You will be graded on effort and clarity.
2. Submit that PDF file in Canvas.
Grading Rubric
Component Expectations Weight
Discussion Discussion of iteration count and complexity per iteration 15%
Text output Showing iteration counts for each solver 15%
Plot as graphic Plot for all solvers 15%
Source Code Code listing