title: Is there a way to broadcast boolean masks?
body: <p>I'm trying to reduce the number of calculations I do based on search distance.  I have N nodes and an <code>[NxN]</code> boolean mask that tells me what nodes are within X distance of the other nodes with <code>T</code> true values.</p>
  
  <p>I also have <code>[Nx(d)]</code> data for each node, where <code>(d)</code> can be <code>(1)</code>, <code>(3)</code>, or <code>(3x3)</code>. I want the "sparse" format which is a <code>[Tx(d)]</code> array so I can do vectorized calculations along the 0 axis. Right now I do this:</p>
  
  <p><code>sparseData=data.repeat(data.shape[0],axis=0).reshape(np.concatenate(([data.shape[0],data.shape])))[mask]</code></p>
  
  <p>Which works, but causes memory errors if <code>N</code> is too big, due to the <code>[NxNx(d)]</code> array I'm creating with <code>.repeat</code>  Is there a way to broadcast this?  If I do this:</p>
  
  <p><code>data[None,...][mask]</code></p>
  
  <p>It doesn't work, but it seems like there has to be a more efficient way to do this.</p>