Changed ProfileMatrix to more generic Matrix
Added method to initialize Matrix with given length for arrays