Several energy density implementations contained code for matrix methods like sym, skew, transpose etc. This patch moves them all to the file linearalgebra.hh, to get rid of the redundancy.