Add some tests for collapsing and broadcasting (which finally works).

Also document broadcasting.
Enable the use of broadcast for elemwise kernels.
Small speed fix for the broadcast and contig case.