Maybe I'm being slow, but is there any convenient function to calculate, for 2 vectors: \sum_i \sum_j x_i y_j (I had a matrix once, but it vanished without a trace)