Create optimised functions for sigmoids

Includes log-sum-exp, and the dot product of a vector with it’s
soft-max version. Involved pulling rowwise_softmax out of the
array_utils module, hence all the changes.