Speed-ups for matrix reductions and elementwise operations