Implemented creating templates.
Implemented creating G matrix. Small improvement in createH.m.