Matlab Sample Code

From SEWiki

Paul Hovland from Argonne National Laboratory gives two interesting cases.

In the first case, a programmer wants to create multiple variants of the same code. At some point, the programmer wants to merge the variants in order to have all three execute more efficiently at the same time. (This is more efficient because the costly operation doesn't get executed three times, but once.) Here is the Matlab code: gmres.m, bicgstab.m, tfqmr.m.

One could imagine a use case in which the programmer does a copy/paste/edit to create the new variants. The plan editor would track the shared code, and allow the programmer to merge the codes during reconciliation.

In the second case, the programmer extends an existing algorithm to add features to make it more efficient. In this case the algorithm is Newton's method, with the addition of a line searching routine to help the algorithm converge. Here is the Matlab code: brsol.m, brsola.m.