Optimized code when array is c contiguous and added test to warn user.