template matrix