Read on for some helpful advice on How to square a matrix easily and effectively.
The function does the following, which is the function that I'm using to calculate the square matrix: function square (m) { // Square the matrix var sum = m.sum (); var size=m.length; // Get