Matrix Multiplication Using NumericMatrix and NumericVector in Rcpp
问题 I am wondering is there a way of calculating matrix multiplication using NumericMatrix and NumericVector class. I am wondering if there is any simple way to help me avoid the following loop to conduct this calculation. I just want to calculate X%*%beta. // assume X and beta are initialized and X is of dimension (nsites, p), // beta is a NumericVector with p elements. for(int j = 0; j < nsites; j++) { temp = 0; for(int l = 0; l < p; l++) temp = temp + X(j,l) * beta[l]; } Thank you very much in