Move template sqr function to header.

Move template sqr funtion to header, has to be like this.
Merge pull request #2 from tproc12/master

Move template sqr function to header.