Pretty vectorization for a matrix operation