AMSC 661 / CMSC 661 Homework 3 FAQ

Known typos:

  • Problem 1b: "Create 4 plots" should be "Create 5 plots" (In other words, 1 plot per eigenvalue.)
  • Problem 1: Change "unit square" to "square" and change "[-1,1]" to "(-1,1)" in two places.
  • Problem 1: You can find the true eigenvalues in Chapter 6 (because they are invariant under translation).
  • Problem 1b: If you want to plot log vs log or some other scheme, that is ok.
  • Question: How do we find the size of a finite element matrix if we use getpetuc?

    Answer: size(p) is close enough.

    Question: I am encountering a situation with pdetool, where it will change the sign of the eigenvector when the solver is run multiple times. I particularly noticed this when experimenting with different mesh sizes, although it can happen with consecutive solver runs even when there is no mesh change. The magnitude and shape of the plotted eigenvector are the same, just with a sign that alternates.

    Answer: If v is an eigenfunction, so is -v, so it just doesn't matter.

    Question: One thing you might want to put in the FAQ for assignment 3- if you use getpetuc, the eigenvalues pdetool computed will be placed in the output vector 'l'. This might save some trouble since people wouldn't have to mess with using pdeeig manually.

    Answer: OK.

    Question: For the pcg method in question 2, if we don't give it a max iteration it will max out at 20 iterations. Do we set the max iterations higher than that so that we can see how many iterations it takes?

    Answer: Yes.

    Question: How do I use the Cholesky factor L to solve a linear system?

    Answer: Note: if you use "inv(L)" or "L^(-1)" you will lose points, because these methods take too much time and lose accuracy.

    If A = L L^T, then Ax=b means L L^T x = b. Letting L^T x = y, we can solve Ax=b by forward and backward substitution: y = L \ b; x = L' \ y.

    Note: It is easy to make the mistake of asking pcg to use the Cholesky factor L, rather than M = L L^T, as the preconditioner. Read the documentation carefully and beware.

    Question: What interval do I use if I use pdeeig for problem 1b?

    Answer: Use an interval in which you know the desired eigenvalues lie. Some students, by the way, report that this routine stalls on the fine meshes. I had this problem, too, which is why I suggest in the assignment that you generate the matrix and then use eig. If you don't have problems with pdeeig, go ahead and use it.

    Question: Some of the eigenvalues appear twice. Is lambda_6 the 6th distinct one or the 6th one in the list in which some appear twice?

    Answer: The 6th one in the list in which some appear twice.

    Question: To get the size of the matrix you said: "size(p) is close enough." Should it be size(p,2)? And isn't that the sqrt of the matrix size since each mesh point is represented by a row in the matrix?

    Answer: The 2nd entry in size(p) is close to the number of rows in the matrix. The number of columns is the same as the number of rows.

    Question: Suppose I use symrcm to get a permutation vector p. How do I use it?

    Answer: To solve Ax=b, you factor the matrix A(p,p), use forward and back substitution to solve A(p,p) z = b(p), and then set x(p) = z.

    Note: Matlab 7.0 seems to have a bug in the GMRES interface. If you are having trouble with it, try Mathworks' bug fix, found by Jin Hyuk Jung.

    Question: What does the square root of p have to do with h?

    Answer: Think of the grids we used in the multigrid illustration in class. If there are n points (n vertices of the triangles), then h is proportional to approximately 1/sqrt(n).

    Question: In problem 2, you asked for the number of iterations for each method. Matlab returns two numbers in the iter vector

    form GMRES. Which one should be used?

    Answer: Neither! The first is the number of "outer iterations", each containing "restart" inner iterations. The second is the number of inner iterations in the last partial outer iteration. What you want is the total number of inner iterations so that you can measure work.

    Question: I'm wondering if we need to calculate the storage needed for iterative methods like we did on the 2nd problem from last quiz. If we use the theoretical form of CG on p.10 based on Arnoldi algorithm, the storage needed is a function of k, but if we use the practical form of CG the estimate is easy and independent of k.

    Answer: Yes, you want the practical form of cg.

    Question: If we use the latter, is there any similar practical form of GMRES?

    Answer: No, there is no way to implement GMRES with a constant number of vectors. That is why we need the restart parameter. If you are unsure of the storage used, look at the code using "type" or "which".

    Question: For determining storage of the different methods do we include the sparse matrix A and vector b from A*x=b?

    Answer: Yes.

    Question: I found Matlab 6.5 and 7.0 show quite different performances on CG with diagonal preconditioner. This results in different ordering of the 4 CG methods. My own computer is using 7.0. Does this cause any problem?

    Answer: When reporting computational times, it is always important to indicate the hardware and software used.

    Question: For the data matrices in Problem 2, do I count the storage for the full format or the sparse format?

    Answer: You need to store every data matrix in sparse format and count the storage used for that format. If you store the matrices in full format, then even your timings will be wrong.

    Question:

    Answer: