I have nc columns in a data.table, and nc scalars in a vector. I want to take a linear combination of the columns, but I don\'t know ahead of time
nc
Add this option to your benchmark call:
ops = as.matrix(DT) %*% cf
On my device it was 30% faster than the matrix multiplication you tried.