title: Numpy filter using condition on each element
body: <p>I have a filter expression as follows:</p>
  
  <p><code>feasible_agents = filter(lambda agent: agent &gt;= cost[task, agent], agents)</code></p>
  
  <p>where <code>agents</code> is a python list.</p>
  
  <p>Now, to get speedup, I am trying to implement this using numpy.</p>
  
  <p>What would be the equivalent using numpy?</p>
  
  <p>I know that this works:</p>
  
  <pre><code>threshold = 5.0
  feasible_agents = np_agents[np_agents &gt; threshold]
  </code></pre>
  
  <p>where <code>np_agents</code> is the numpy equivalent of <code>agents</code>.</p>
  
  <p>However, I want threshold to be a function of each element in the numpy array.</p>