I have a vector and matrix compution which work great as follows:

```
import numpy as np

r = 1
c = 13
x = np.ones((r, c)) # rxc
M = np.ones((c, c)) # cxc square    
Z = x.dot(M).dot(x.T) # (rxr) = (rxc).(cxc).(cxr)
print Z.shape

def mul(a,b): return a*b
assert reduce(mul,Z.shape)==r  # Z should have one value for each row 

```

I'd like to perform the same transform on the rows of x for an x that had many rows, like so:

```
r = 99
x = np.ones((r, c)) # rxc
... as above ...

```

This fails because Z (sensibly) ends up as a (99x99). But what I'd like is a (99x1) or (1x99), which can be calculated, as:

```
Z2 = np.array([row.dot(M).dot(row.T) for row in x])

```

Is there a way to calculate Z2 more directly in numpy, instead of using python iteration?