Computational Physics - Department of Physics

(Axel Boer) #1

212 6 Linear Algebra


made. Beyondn= 105 the relative error becomes bigger, telling us that there is no point in
increasingn. For most practical application a relative error between 10 −^6 and 10 −^8 is more
than sufficient, meaning thatn= 104 may be an acceptable number of mesh points. Beyond
n= 105 , numerical round off errors take over, as discussed in the previous chapter as well.


6.4.Write your own code for performing the cubic spline interpolation using either Blitz++
or Armadillo. Alternatively you can use the vector-matrix class included in this text.


6.5.Write your own code for the LU decomposition using the same libraries as in the previous
exercise. Find also the number of floating point operations.


6.6.Solve exercise 6.3 by writing a code which implements both the iterative Jacobi method
and the Gauss-Seidel method. Study carefully the number of iterations needed to achieve the
exact result.


6.7.Extend thereafter your code for the iterative Jacobi methodto a parallel version and
compare with the results from the previous exercise.


6.8.Write your own code for the Conjugate gradient method.


6.9.Write your own code for matrix-matrix multiplications using Strassen’s algorithm dis-
cussed in subsection 6.3.3.1 and compare the speed of your program with the matrix-matrix
multiplication provided by the Armadillo library.

Free download pdf