Exchanging loops for 'col' and 'k' should work here as well. Optimizing for fast memory access is certainly device-specific here, one would need pretty tricky thread-assignments. Let's keep it out of this pull-request.