COS 323 - Computing for the Physical and Social Sciences |
Fall 2013 |
Course home | Outline and lecture notes | Assignments |
Q: Should it really be *this* slow? A: The total running time (for all values of n and 100 iterations each) should be several minutes. Obviously do your debugging with smaller datasets. If it's taking much longer than that: - Make sure that you initialize your accumulation variable (if you code the sequential addition with a for loop) to a single-precision zero, i.e. mySum = single(0); - Check that you are operating on n-element vectors (rather than n-by-n matrices) Q: What is "error"? What should be in the graph(s)? A: The most appropriate thing would be a graph with two curves: 1. Mean absolute difference between single-precision sequential summation and "ground truth". 2. Mean absolute difference between single-precision cascaded summation and "ground truth". "Ground truth" is approximated as the double-precision sum (computed using any method). Q: Do we need to submit 6 separate .m files? A: You should decide how to partition your code into self-contained, reusable functions, and put each one in a separate .m file. As long as everything is commented well and it's clear which bit of code does what, you may submit as many or as few .m files as is consistent with good coding practices. Q: Do we need to handle the case of non-powers-of-2 in cascaded summation? A: It's 3 extra lines of code, but if you're feeling *that* uninspired :-) we won't penalize for just handling powers of 2.