A Gaussian-elimination-with-partial-pivoting routine solves for a matrix arising from…

PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Scientific programming for physicists · Research software practice, verification and validation

Scientific Computing for Physicists, Ch Is the equation solved right? Testing, debugging and code verification

Problem

A Gaussian-elimination-with-partial-pivoting routine solves Ax=bA\mathbf{x} = \mathbf{b} for a 50×5050\times50 matrix AA arising from a normal-mode calculation, with condition number κ(A)=3.4×104\kappa(A) = 3.4\times10^{4}. The backward-error bound for this class of kernel, derived earlier from the machine epsilon ϵmach=2−52\epsilon_{\rm mach} = 2^{-52}, gives a bound on the relative error of the computed solution of c κ(A) ϵmachc\,\kappa(A)\,\epsilon_{\rm mach}, with c=nc = n (the matrix dimension) for this pivoting strategy. ((a)) Derive the tolerance to use in a unit test that compares this routine's output with an independent solve in extended precision, whose own error is negligible beside this routine's, writing it as c κ ϵmach/2c\,\kappa\,\epsilon_{\rm mach}/2, and give its numerical value. ((b)) The routine's test is to be kept permanently as a regression test that runs automatically on every pull request, in the lockfile environment set up in the repository's continuous-integration job. Explain briefly why the tolerance from part (a), rather than a round number such as 10−610^{-6}, is what makes this regression test able to fail on a genuine bug (for example a wrong pivot rule) without also failing on harmless rounding differences between machines.

Browse the problem library