Educational implementation of Matrix class based on templates