make output format a valid input format

An output format that prints valid input commands, so one can copy and re-execute the code.
From IRC

(04:57:05 PM) jwe: It might not be too hard to implement what you want. There is a flag in the pr-output functions for pr_as_read_format and many (but probably not all) of the types that are printed there do something with that. And it is not hooked in to the format function, so you can't enable it.

(04:57:31 PM) jwe: pr-output.cc and pr_as_read_syntax

extend sub2ind and ind2sub

We are extending sub2ind and ind2sub to work with triangular matrices. Currently private functions of mechanics.
A string argument triggers the behavior. The string argument can be "triu" or "tril". After this str argument we accept an extra scalar value indicating that the triangular matrix is off diagonal (as in tril and triu).
So, the first modification to the C++ code will be

Check if any of the argument is a str.

Check what kind of triangular matrix (up or low).

If the argument after the str argument is a scalar, it indicates off diagonal triangular matrix (we do not have algo for that yet, though).