Rewrap and extension of gen_mul into perl classes. Supports matrix patterns (known fixed values of 0 and 1).
Remove trailing whitespace in generated code.