Wrap up code in functions.

These include incomplete LUs, sparse sweeps and CPU version dense
sweeps.