convert to arma::mat in the beginning