AMSC 662 / CMSC 662 Fall 2013

Frequently Asked Questions for Homework 2

Question: 09-10-13 Do I have to use the Grace machines to do this assignment?

Answer: No. You may use any machine from which you can access Matlab. But your submission must run correctly on the Grace machines in order to get full credit for correctness.

Question: 09-10-13 Problem 1: when you say that matrices A and B should have "compatible dimensions", does this mean it is an error if the ith block of A has different dimensions than the ith block of B?

Answer: Yes.

Question: 09-10-13 Do my codes need documentation?

Answer: Yes, and this applies to all programming assignments.

For full credit, documentation at the top of the module should include:

  • purpose of the module, since this is certainly the first thing a user wants to know!
  • name of author, since this provides someone to whom bugs can be reported and questions asked.
  • original date of the module and a list of later modifications, since this gives information such as whether the module is likely to run under the current computer environment and whether it might include the latest advances.
  • description of each input parameter, so that a user knows what information needs to be provided and in what format.
  • description of each output parameter, so that a user knows what information is produced.
  • brief description of the method and references, to help a user decide whether the method fits his/her needs.
  • In-line documentation identifies the major sections of the module and provides some detail on the method used. It is important in specifying the algorithm, identifying bugs, and providing information to someone who might need to modify the software in order to solve a slightly different problem.

    Note that the documentation should be an integral part of the module; in other words, it is not enough to include it in a separate document, because a potential user might not have access to that document.

    An example containing all of this documentation can be found at mgsdoc.m but I do not require you to follow the style of that documentation.

    Question: 09-13-13 For Problem 1, should I write my own code for backslash or should I use Matlab's?

    Answer: Use Matlab's. The whole point of the problem is to use cell arrays effectively so that you can write a very small amount of code to build on what Matlab has.

    Question: 09-13-13 It says that A and B are compatible dimensions. Does that mean that the dimension of each block of A is the same as the dimension of the corresponding block of B?

    Answer: Yes. If not, it is an error condition that your program should catch.
    09-19-13
    You just need to report the error and quit. You do not need to perform any operations in this case.

    Typo found 09-19-13: The due date is Tuesday Sept 24, not "Tuesday Sept 27".

    Question 09-20-13: The example block diagonal matrix given to us for problem 1 is very ill conditioned. I struggled for a bit thinking my code was doing something wrong by spitting out NaN's when performing the '\', before I realized it was just the example given and my code was fine. Should we have our code report an error if one of the diagonal blocks is extremely ill-conditioned as is the case with A{1} of the example given? Or should we just let MATLAB report out the resulting NaN's?

    Answer: You can just let Matlab report the NaN's. I'm sorry for the unfortunate example.

    Question: 09-23-13 In question 2, it says that I should use Matlab's zeros function to initialize a Matlab array to hold the stack. However, it seems that we should use Matlab's cell arrays for the stack, instead of a normal array, because each entry of the stack is an array itself.

    Answer: I advise you to use a Matlab array to hold the stack. It is most convenient to make it nx4 or 4xn (you decide), since each entry in the stack has 4 double precision numbers. A cell array is too expensive for this application.